Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jan 17, 2013, 08:32 PM   #1
Ri-dog
macrumors newbie
 
Join Date: Jan 2013
Location: Healy, AK
Applescript to make terminal close automatically?

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".



How would I go about doing this?

Thank's for the help!

- Ridog

Last edited by Ri-dog; Jan 18, 2013 at 12:23 AM. Reason: Added image
Ri-dog is offline   0 Reply With Quote
Old Jan 18, 2013, 12:53 PM   #2
kryten2
macrumors 6502a
 
Join Date: Mar 2012
Location: 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
__________________
Space Corps Directive 34124
kryten2 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 07:20 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC