运行 当前脚本中的多个 Applescript
Run several Applescripts from within current script
我想扩展我现有的...
run script file "Macintosh HD:Users:pathTo:myScript.scpt"
到运行 在给定目录中找到的所有脚本。我试过了...
tell application "Finder" to set scriptsToRun to files of folder POSIX file "/Users/pathTo/" as alias list
run script file scriptsToRun
但运气不好。此外,除非必要,否则我并不特别需要在我的等式中涉及 Finder。任何建议表示赞赏。
scriptsToRun 是一个列表,因此您需要在列表中重复 运行 每个单独的列表。请注意,我使用括号来确保代码在 Finder 行中被正确解释。
另请注意,您不需要 "run script" 行中的 "file",因为文件列表已经是别名文件列表...来自 Finder 行。如果你有一个字符串格式的文件列表,你只需要 "file" 这个词,然后你会在每个字符串之前使用 "file" 使它成为 运行 之前的文件说明符。
祝你好运。
tell application "Finder" to set scriptsToRun to (files of folder POSIX file "/Users/pathTo/") as alias list
repeat with aScript in scriptsToRun
run script aScript
end repeat
我想扩展我现有的...
run script file "Macintosh HD:Users:pathTo:myScript.scpt"
到运行 在给定目录中找到的所有脚本。我试过了...
tell application "Finder" to set scriptsToRun to files of folder POSIX file "/Users/pathTo/" as alias list
run script file scriptsToRun
但运气不好。此外,除非必要,否则我并不特别需要在我的等式中涉及 Finder。任何建议表示赞赏。
scriptsToRun 是一个列表,因此您需要在列表中重复 运行 每个单独的列表。请注意,我使用括号来确保代码在 Finder 行中被正确解释。
另请注意,您不需要 "run script" 行中的 "file",因为文件列表已经是别名文件列表...来自 Finder 行。如果你有一个字符串格式的文件列表,你只需要 "file" 这个词,然后你会在每个字符串之前使用 "file" 使它成为 运行 之前的文件说明符。
祝你好运。
tell application "Finder" to set scriptsToRun to (files of folder POSIX file "/Users/pathTo/") as alias list
repeat with aScript in scriptsToRun
run script aScript
end repeat