可以在Mac上運行多個實例或同一應用程序的副本。但AppleScript似乎無法單獨識別它們。假設我的應用程序是「FileMaker Pro」,並且我有多個副本正在運行。讓AppleScript告訴「FileMaker Pro」退出後,我相信會退出第一個運行的,這可能不是我希望它退出的那個。AppleScript,按ID退出應用程序,安全
我想編寫一個腳本,首先識別最前面的應用程序,然後關閉並執行其他一些操作(可能會將其他應用程序放在前面),然後安全地退出它在開始時標識的原始應用程序。
一些谷歌搜索我所做的發現建議,在那裏我通過進程ID標識最前面的應用程序,然後
做shell腳本「殺......」
但是從我可以告訴「殺」不要求保存更改等(所以它不會安全退出「)。
我想這個腳本來做什麼AppleScript退出命令或手動選擇退出文件菜單會做,包括要求保存更改或w討厭的人。
這可能嗎?如果是這樣如何?
即使您嘗試使用unix ID而不是名稱,Applescript也會始終處理您應用程序的最後打開的實例。解決方法是在應用程序中更改名稱以使其成爲FM1,FM2 ...,但它肯定會產生其他問題,特別是對於像FileMaker這樣的標準應用程序。然後要退出Filemaker的第一個實例,必須首先正確退出第一個之後打開的所有其他實例。要退出,請使用{command down}中的按鍵q來告訴「系統事件」區塊。 – pbell