开发者

AppleScript to click "Don't Save" on window close

开发者 https://www.devze.com 2023-02-10 18:18 出处:网络
I am using AppleScript to close windows in Google Sketchup as follows: $ osascript -e \'tell application \"SketchUp\" to close window 1开发者_开发技巧\'

I am using AppleScript to close windows in Google Sketchup as follows:

$ osascript -e 'tell application "SketchUp" to close window 1开发者_开发技巧'

When I close the window, the program prompts me to save, and there is a dialog box with buttons "Don't Save", "Cancel", and "Save...".

How do I make my script click on the "Don't Save" button in this situation?

Also, if there is a better way of closing the window, I'm all ears.


$ osascript -e 'tell application "SketchUp" to close window 1 saving no'


If you don´t have to use Applescript, you could enable tab to hop through the buttons in the save dialog.

First press cmd+ w to close the window, than try to cycle through the buttons by pressing tab. If you do not see a little blue highlight hopping around the buttons, press ( fn + ) ctrl+F7 to enable this feature. You should now see a blue highlight around the leftmost (in Sketchup: "do not save") button. You can navigate over the highlighted button with pressing tab and select the highlighted button with pressing space.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号