GUI script help, need to get contents of text field

Hi,
I am trying to make a GUI script that will get the contents of a text field, say of Safari… and set it to a variable

Anyone have any ideas? I am new to GUI scripting
Thanks :slight_smile:

Hi,

the common syntax for GUI scripting is


activate application "Safari"
tell application "System Events"
	tell process "Safari"
		set myVar to value of text field 1 of . of window 1
	end tell
end tell

You can determine the UI Element for example with Apple’s UIElementInspector

Thanks,
And I would guess to set the value of a text field you would say set value of text field 1 of . of window 1 to “Whatever”?

Exactly