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

Lock/unlock screen using AppleScript and Salling Clicker Apps
I know there are hints in the system here for locking the screen, but this is a different and fancy one. Basically, what I want is to lock the screen while I am away from my computer using Salling Clicker, and then unlock it when I am back. I found the newly-released JackSMS (covered as part of this hint) has a cool scriptable function.

Just put this script code in the "Leaving Proximity" section of Salling Clicker's Phone Events:
tell application "JackSMS" to set lock screen to true
And put this code in the "Entering Proximity" section:
tell application "JackSMS" to set lock screen to false
So what is the cool point here? When you are back, you do not need enter your password; your computer gets automatically unlocked without any user intervention. I did not find any other way to do this (someone please correct me if I am wrong).

[robg adds: My Palm Treo, unfortunately, doesn't support Phone Events, so I can't test this one.]
    •    
  • Currently 1.67 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (3 votes cast)
 
[19,952 views]  

Lock/unlock screen using AppleScript and Salling Clicker | 5 comments | Create New Account
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: jctull on Jun 22, '06 11:28:02AM
This worked nicely for me. The hint is a bit sparse on details. What you need to do is install JackSMS and start it (have it set to start at login in the JackSMS preferences from the menu item -- yes, another menu item).

Next, double-click the example JackSMS clicker script to have it installed by Salling Clicker, assuming this is already installed and running. Next, open the Salling prefs and check the box next to JackSMS Demo Script in the Phone Events tab. Highlight the demo script and select Edit in Script Editor from the actions drop-down item. Add the line:
tell application "JackSMS" to set lock screen to false
immediately after the 'on process entering proximity a_terminal' line.

Next add the line:
tell application "JackSMS" to set lock screen to true
after the 'tell application "JackSMS" to set jack status to "on"' in the 'on process leaving proximity a_terminal' section.

Close and save the script and all should work without requiring you to input your password now if you have the Security preference set to require password when waking from sleep or screensaver and a good phone.

[ Reply to This | # ]
Lock/unlock screen using AppleScript and Salling Clicker
Authored by: rsnyder on Jun 22, '06 06:39:23PM

Is it just me, or does this seem like a security hole? I realize that someone would need to need to have your device as the "key" to unlock your system, but call me paranoid. I don't want someone to be able to unlock my system (and have access to my applications as me) without entering a password.

I love the Sailing Clicker. I have purchased two licenses and have used it for many years. In earlier versions of the OS/Sailing Clicker this "unlock screen on return" functionality was included. But when it went away (in 10.3, I think) I actually thought it was a good thing.

But, to each his/her own.



[ Reply to This | # ]
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 | # ]