Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jan 17, 2013, 09: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 01:23 AM. Reason: Added image
Ri-dog is offline   0 Reply With Quote
Old Jan 18, 2013, 01: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

Similar Threads
thread Thread Starter Forum Replies Last Post
iPhone: Safari and Email Automatically close ivreal Jailbreaks and iOS Hacks 5 Jan 7, 2014 05:01 PM
Resolved: Applescript : close word document (office 2011) wesleyh Mac Programming 2 Jan 26, 2013 10:23 AM
How to close all Apps automatically on iOS 6? Bankaimadness iOS 6 7 Nov 8, 2012 11:19 AM
applescript leaves terminal window open Zeke D Mac Programming 6 Jul 22, 2012 03:44 PM
Terminal command to open & close programs? yeeehaw Mac Programming 3 Jun 30, 2012 09:04 PM

Forum Jump

All times are GMT -5. The time now is 10:13 AM.

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

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