hey guys, im trying to get into UI scripting but im abit lost…
i would like to start things off simple, say buy just clicking a button on a display box.
i have a script that presses command shift and “q” (logout) but ive been trying to get the script to press the log out button but to no avail =[
any help?
tell application "System Events" to keystroke "q" using {command down, shift down}
What application are you trying to press buttons in? You need to activate it first.
The script below saves a TextEdit document with the name “testfile”.
activate application "TextEdit"
tell application "System Events" to keystroke "s" using {command down, shift down}
tell application "System Events" to keystroke "testfile"
activate application "TextEdit" -- the next line didn't work until I added this, I guess the first "activate" was timing out.
tell application "System Events" to keystroke return
end
System Events provides a “logout” command, and UI Scripting should be allways the last option (I think). Try this:
tell app "System Events" to log out
This command is in the “power” suite.
Thanks guys,
ive managed to get a script to do what i wanted to from both replies:
tell application "System Events" to log out
tell application "System Events" to keystroke return