2013-02-22 83 views
2

有沒有一種方法可以在我的腳本中同時使用「打開」和「選擇文件」,而無需重複以下示例中的操作代碼?Applescript:同時使用「打開」和「選擇文件」

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 

回答

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 
+0

感謝您的答覆adayzdone,但小程序的一些用戶希望能夠將其打開,選擇一個文件,而不是將文件拖到它上面。所以我需要兩種行爲。 – user2099623 2013-02-22 14:22:29

+0

明白了......看到我編輯的答案 – adayzdone 2013-02-22 14:24:59

1

另一種方法是從運行處理程序調用腳本的開放式處理:

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

tell me to open (choose file) 
相關問題