正常工作,這個腳本是打開的微軟應用程序,然後3秒告訴應用程序打開,然後退出時不是AppleScript的
tell application "Finder"
set myFolder to ((startup disk as text) & "Applications:Microsoft Office 2011") as alias
set myFiles to (every item of myFolder) as alias list
open myFiles
end tell
delay 3
tell application "System Events" to set the visible of every process to true
set white_list to {"Finder"}
try
tell application "Finder"
set process_list to the name of every process whose visible is true
end tell
repeat with i from 1 to (number of items in process_list)
set this_process to item i of the process_list
if this_process is not in white_list then
tell application this_process
quit
end tell
end if
end repeat
on error
tell the current application to display dialog "An error has occurred!" & return & "This script will now quit" buttons {"Quit"} default button 1 with icon 0
end try
end tell
但是當我運行該腳本,它在這之後停止後退出。 (編輯),它似乎關閉每一個應用程序除了Microsoft應用程序
tell application "Finder"
set myFolder to ((startup disk as text) & "Applications:Microsoft Office 2011") as alias
set myFiles to (every item of myFolder) as alias list
open myFiles
都打開和關閉應用程序的腳本工作的偉大分別,但我似乎不知道如何加入他們的行列。如果有人知道這是爲什麼發生,那會很好。由於
你怎麼知道後「開MYFILES」停止? *延遲3 *沒有可見的效果。您可以嘗試將一些*顯示對話框「Hello 1」*等放入腳本中,以確切查看它停止的位置。 – 2014-09-24 23:28:20
hmm well顯示對話框在「打開myFiles」後工作,但我知道它停止的原因是因爲當我運行腳本時,在「打開myFiles」後不久,帶有「記錄,停止,運行,編譯」按鈕的蘋果腳本工具欄返回當你還沒有運行腳本的時候,它的樣子(對不起,我真的不知道該怎麼解釋,希望你能理解) – 2014-09-25 02:51:30