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

auschase

macrumors newbie
Original poster
Sep 26, 2011
9
0
Can someone help me with this applescript. I am trying to keystroke the result from the dialog.
PHP:
display dialog "" default answer "" buttons {"OK"} default button 1
set STUnum to result

tell app "System Events" to keystroke "blah" & STUnum
 
Last edited:
Use this:

PHP:
display dialog "" default answer "" buttons {"OK"} default button 1
set STUnum to text returned of the result

tell application "System Events" to keystroke "blah" & STUnum
 
You need to use "text returned of result", so :

Code:
set STUnum to text returned of result

EDIT : Dammit, beaten by seconds.
 
Also, How would you tell it to click the button "add favorite server" in Finder>Go>Connect to server?
 
PHP:
tell application "System Events"
	tell application "Finder" to activate
	keystroke "k" using {command down}
end tell
 
Sorry to keep asking questions I am new at this but, would anyone know why I can't click any of the check boxes in Language & text of application System Preferences

PHP:
tell application "System Preferences"
			activate
			set the current pane to pane "com.apple.Localization"
			reveal anchor "InputMenu" of pane id "com.apple.Localization"
		end tell
		tell application "System Events" to click checkbox "Keyboad & Character Viewer" of table "inputmenu" of scroll area 1 of tab group 1 of window "Language & text" of application "System Preferences"
thakns
 
I'm not very good with GUI scripting, I try to avoid it. I could probably help you get your end goal though. What is it you're trying to do in System Preferences?
 
I am trying to click a check box on the left hand side of Language & Text> InputMenu.
This is what I have so far:
PHP:
tell application "System Events"
			tell process "System Preferences"
				if value of checkbox "1" of row "hebrew" of table "input menu" of scroll area 1 of tab group 1 of window "Language & Text" is 0 then
					click checkbox "Hebrew" of tab group 1 of window "Language & Text"
				end if
			end tell
		end tell
 
Change: (This works)
PHP:
tell application "System Events"
			
			
			tell process "System Preferences"
				set value of text field 1 of tab group 1 of window "Language & Text" to "Hebrew"
				click button 1 of text field 1 of tab group 1 of window "Language & Text"
				tell application "System Events" to keystroke return
				if value of checkbox 1 of row 1 of table 1 of scroll area 1 of tab group 1 of window "Language & Text" is 0 then
					click checkbox 1 of row 1 of table 1 of scroll area 1 of tab group 1 of window "Language & Text"
					click button 2 of text field 1 of tab group 1 of window "Language & Text"
				else
					click button 2 of text field 1 of tab group 1 of window "Language & Text"
				end if
			end tell
			tell process "System Preferences"
				if value of checkbox 1 of row 1 of table 1 of scroll area 1 of tab group 1 of window "Language & Text" is 0 then
					click checkbox 1 of row 1 of table 1 of scroll area 1 of tab group 1 of window "Language & Text"
				end if
			end tell
			
		end tell
 
Just out of curiosity, how do you colour code your scripts like that? I'm especially interested in colouring conditional keyworks like "if" and "else" but the fomatting preferences in AppleScript Editor don't seem to allow that.
 
Just out of curiosity, how do you colour code your scripts like that? I'm especially interested in colouring conditional keyworks like "if" and "else" but the fomatting preferences in AppleScript Editor don't seem to allow that.

That's just MacRumor's php tag. To change the colours, go into AppleScript's preferences and click the formatting tab.
 
I can't seem to colour conditional keyworks like "if" and "else" separately unfortunately.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.