2

有没有办法在我的脚本中同时使用“打开”和“选择文件”,而不必像下面的示例中那样重复操作代码?

on open myMovie
    tell application "Quicktime Player 7"
    open myMovie
    end tell
end open

set myMovie to choose file
    tell application "Quicktime Player 7"
    open myMovie
    end tell
4

2 回答 2

2
on open myMovies
    repeat with aMovie in myMovies
        tell application "QuickTime Player 7" to open aMovie
    end repeat
end open

on run
    set myMovie to choose file
    tell application "QuickTime Player 7" to open myMovie
end run
于 2013-02-22T14:15:42.273 回答
2

另一种方法是从运行处理程序调用脚本的打开处理程序:

on open theFiles
    tell application "QuickTime Player 7" to open theFiles
end open

tell me to open (choose file)
于 2013-02-22T18:13:52.480 回答