2011-11-22 42 views
0

为了将.MOV文件(h.264)导入Final Cut Pro,我需要一个与.MOV具有相同文件名的相应.THM文件。是否可以用AppleScript或Automator做到这一点?这是我想做的事:Applescript从其他文件创建和重命名文件

  1. 创建已经存在在我的HD
  2. 使用.MOV文件名
  3. 重命名“TEMPLATE.THM”文件“TEMPLATE.THM”文件的副本对.MOV文件的文件夹执行此操作,为每个.MOV文件创建一个具有相同文件名的.THM文件。

回答

1

天儿真好

这可能不是最快的方法 - 但我看到你还在等待答案 - 所以这里的东西让你开始。在查找器中选择所有的MOV文件并在脚本编辑器中运行。

set theTemplate to "Macintosh HD:Users:[user name]:[folder:location]:TEMPLATE.THM" 

tell application "Finder" 
    set theFiles to selection 
    repeat with thisFile in theFiles 
    set thisName to name of thisFile 
    set theFolder to container of thisFile 
    set newFile to duplicate theTemplate to theFolder 

    set text item delimiters of AppleScript to "." 
    set thisName to text item 1 of thisName 
    set text item delimiters of AppleScript to "" 

    set newName to (thisName & ".THM") 
    set name of newFile to newName 
    end repeat 
end tell 

去的模板路径的最简单的方法是在Finder中选择它并运行此:

tell application "Finder" 
    set theFile to selection as string 
end tell 

这将使路径在结果窗口 - 只是将其复制到上面脚本的第一行。

希望帮助

相关问题