有没有办法在我的脚本中同时使用“on open”和“choose file”,而不必像下面的例子那样重复动作代码?
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
答案 0 :(得分: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
答案 1 :(得分:1)
另一种方法是从运行处理程序调用脚本的开放处理程序:
on open theFiles
tell application "QuickTime Player 7" to open theFiles
end open
tell me to open (choose file)