Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Ri-dog

macrumors newbie
Original poster
Jan 17, 2013
7
0
Healy, AK
Hi,

I have a relitivly simple question about doing a simple task with applescript.

I want to automate changing the "when the shell exits" menu in terminal (Preferences > Settings Tab > Shell). From "Don't close the window" to "Close the window".

Screen+shot+2013-01-17+at+5.21.10+PM.png


How would I go about doing this?

Thank's for the help!

- Ridog
 
Last edited:

kryten2

macrumors 65816
Mar 17, 2012
1,114
99
Belgium
You can try UI scripting.

Code:
-- Note : added delays so you can see what the script does
-- You can remove the delays
activate application "Terminal"
tell application "System Events"
	tell process "Terminal"
		-- insert GUI Scripting statements here
		click menu item "Preferences…" of menu 1 of menu bar item "Terminal" of menu bar 1
		delay 2
		click radio button 3 of tab group 1 of group 1 of window "Settings"
		delay 2
		click pop up button 1 of tab group 1 of group 1 of window "Settings"
		delay 2
		click menu item 1 of menu 1 of pop up button 1 of tab group 1 of group 1 of window "Settings"
		-- If you want to close the "Settings window"
		-- uncomment the next 2 lines
		-- delay 2
		-- click button 1 of window "Settings"
	end tell
end tell

Note : It will act on your default setting. Tested on Leopard. YMMV
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.