我拥有.dvdmedia格式的所有这些电影,我想将它们全部转换为更小的文件大小,例如.mp4。
但我需要做的是创建一个AppleScript,将单个文件复制到一个文件夹' Conversion'。删除文件夹中的文件后,它将复制下一个项目并删除上一个项目。
我已经完成了一个自动化脚本,一旦项目被添加到文件夹就开始通过TurboHD格式化文件然后删除文件并将转换后的项目移动到另一个文件夹'已完成'
有人能帮我解决这个问题吗?
请注意,电影的位置在NAS驱动器上
答案 0 :(得分:0)
那里:)我编码了以下内容。请注意将其保存为应用,并选中在运行处理程序后保持打开状态。
您必须将来源和目标路径设置为您的环境中的路径。
最后,您必须设置返回值。该值设置等待下一次执行的间隔(秒)。如果您的每次转化大约需要一个小时,我想我会每5分钟检查一次,这意味着处理程序必须返回300.
-- The idle-Handler defines a repetitive task
-- Note: Save as Application with option "Stay open after run handler"
on idle
-- define the folders to watch
set theSourceFolder to (POSIX file "/Users/myHomeFolder/Desktop/Conversion_Source") as alias
set theTargetFolder to (POSIX file "/Volumes/myMountedVolume/Conversion") as alias
-- check the contained files (get visible files only because of .DS_Store etc.)
tell application "System Events"
set availableSourceFiles to every file of theSourceFolder whose visible is true
set filesOfTargetFolder to files of theTargetFolder whose visible is true
end tell
-- if no more source file is available, quit this script
if (count of availableSourceFiles) = 0 then
quit
end if
-- if the target folder is empty start move
if (count of filesOfTargetFolder) = 0 then
-- get the first item from source folder
set sourceFile to (first item of availableSourceFiles) as alias
-- use the Finder to copy the file
tell application "Finder"
-- duplicate the file to the target folder
duplicate sourceFile to theTargetFolder
-- move the source file to trash after copy
move sourceFile to trash
end tell
end if
-- the integer returned is the time to wait (in seconds)
-- here: two minutes
return 120
end idle
享受,迈克尔/汉堡