Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Lock/unlock screen using AppleScript and Salling Clicker' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Lock/unlock screen using AppleScript and Salling Clicker
Authored by: Lutin on Jun 23, '06 04:20:45AM
Found this, don't remember where.

It allows Salling Clicker to log you back in, without typing your password.
WARNING: Careful, as it can cause a few security breaches (password saved in clear text, simulate the typing of it key by key, so if the focus is not a password field, everyone could read it)

property mypassword : "your_password"
property casestring : "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
using terms from application "SEC Helper"
	
	--	on process entering proximity a_terminal
	tell application "System Events"
		set the process_flag to (exists process "ScreenSaverEngine")
	end tell
	if the process_flag then
		tell application "SEC Helper"
			simulate keyboard charcode (ASCII number return)
			delay 2
			considering case
				repeat with i from 1 to count mypassword
					if (item i of mypassword is in casestring) then
						simulate keyboard modifiers {"shift"} charcode (ASCII number (item i of mypassword))
					else
						simulate keyboard charcode (ASCII number (item i of mypassword))
					end if
				end repeat
			end considering
			delay 1.5
			simulate keyboard charcode (ASCII number return)
		end tell
	else
		return
	end if
	--	end process entering proximity
end using terms from


[ Reply to This | # ]
Lock/unlock screen using AppleScript and Salling Clicker
Authored by: jctull on Dec 06, '06 04:07:14PM
For my needs, this is perfect and does not require another background app running. For whatever reason, this was not working for my new MacBook Pro.

This could be because I use a different method for turning on screen locking using proximity (I do not like my screen locking when I am at home for various reasons). I found this method of using the Keychain Access menu item from another hint:

activate application "SystemUIServer"
tell application "System Events"
	tell process "SystemUIServer"
		repeat with i from 1 to number of menu bar items of menu bar 1
			tell menu bar item i of menu bar 1
				click
				try
					if name of menu item 1 of front menu is "Lock Screen" then
						click menu item "Lock Screen" of front menu
						exit repeat
					end if
				end try
			end tell
		end repeat
	end tell
end tell
I modified the unlocking script as follows to overcome a problem with the return simulation not working:
property mypassword : "your_password"
property casestring : "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
using terms from application "SEC Helper"
	
	--	on process entering proximity a_terminal
	tell application "System Events"
		set the process_flag to (exists process "ScreenSaverEngine")
	end tell
	if the process_flag then
		tell application "SEC Helper"
			simulate keyboard charcode (ASCII number return)
			delay 2
			considering case
				repeat with i from 1 to count mypassword
					if (item i of mypassword is in casestring) then
						simulate keyboard modifiers {"shift"} charcode (ASCII number (item i of mypassword))
					else
						simulate keyboard charcode (ASCII number (item i of mypassword))
					end if
				end repeat
			end considering
			simulate keyboard charcode (ASCII number tab)
			delay 0.01
			simulate keyboard charcode (ASCII number tab)
			delay 0.01
			simulate keyboard charcode (ASCII number tab)
			delay 0.01
			simulate keyboard charcode (ASCII number space)
		end tell
	else
		return
	end if
	--	end process entering proximity
end using terms from


[ Reply to This | # ]
Lock/unlock screen using AppleScript and Salling Clicker
Authored by: GVesterg on May 10, '09 06:50:33AM
The Salling AppleScript unlock script didn't work for me, so I rewrote it. You may want to change the delay statements to delay values that suit you better:
property mypassword : "Some Password"
property MypasswordLc : "some password" -- Same password in lower case
property casestring : "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

using terms from application "SEC Helper"
  on process entering proximity a_terminal
    tell application "System Events"
      set the process_flag to (exists process "ScreenSaverEngine")
    end tell
    if the process_flag then
      delay 15
      tell application "SEC Helper"
        simulate keyboard charcode (ASCII number return)
        delay 12
        considering case
          repeat with i from 1 to count mypassword
            if (item i of mypassword is in casestring) then
              simulate keyboard modifiers {"shift"} charcode (ASCII number (item i of MypasswordLc))
            else
              simulate keyboard charcode (ASCII number (item i of MypasswordLc))
            end if
          end repeat
        end considering
        simulate keyboard charcode (ASCII number return)
      end tell
    else
      return
    end if
  end process entering proximity
end using terms from


[ Reply to This | # ]