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

Pecans

macrumors member
Original poster
Jul 31, 2012
41
0
I am a new to programming applescripts. The one I am trying to get to work now is supposed to quit my screensaver and enter my password but I can't get it to work no matter what I try. Here's the code.


Code:
on run
	tell application "ScreenSaverEngine" to quit
	tell application "System Events" to keystroke 1 (this is to pull up the textfield for the password)
	delay 1
	tell application "System Events" to keystroke "MyPassword"
	delay 1
	tell application "System Events" to keystroke return
end run

Anyone have any ideas how to get this to work?
 
Last edited by a moderator:

numero

macrumors regular
Jul 23, 2002
106
3
OR
This works for me with one addition for my testing. I added a "delay 20" line right after the "on run". I setup my screen saver to require password password (under Security pref pane) and setup a hot corner for screen saver. I ran the script from the script editor and put my mouse in the hot corner. The 20 second delay gave me time to get the screen saver running. After the 20 seconds the password dialog shows up, the text is typed into it and the enter key is accepted. Screen saver is dismissed as expected.

How are you launching the script? Maybe it isn't getting triggered.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.