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

MaxusHastings

macrumors member
Original poster
Hey Everyone!

I am a recent Mac-Switcher (a week old...) and so far i am really enjoying the switch, slowly getting my head around the different shortcuts and methodology for OSX.

I have recently started playing around with Proximity and JackSMS to work with my iPhone and all in all it works great...except one little flaw.

The "away" script works great, and the return one does to, however when i return it executes everything but JackSMS doesnt "unlock" the screen even though its prompted to in the script. I am new to scripting and no doubt i missed something...below is a copy of each:

tell application "System Events"
set itunes_running to (exists process "iTunes")
end tell
if itunes_running is true then
tell application "iTunes"
pause
end tell
end if
-- Set JackSMS status to on, which also lock the computer
tell application "JackSMS" to set jack status to "on"
delay 1
-- Set Adium status to away
tell application "System Events"
set adium_running to (exists process "Adium")
end tell
if adium_running then
tell application "Adium" to go away with message "I am away from my computer"

end if

And here is the return script:

-- Set JackSMS status to off, which also lock the computer
tell application "JackSMS" to set lock screen to false

delay 1

-- Pause iTunes (might add in fancy fade later)
tell application "System Events"
set itunes_running to (exists process "iTunes")
end tell
if itunes_running is true then
tell application "iTunes"
play
end tell
end if


-- Set Adium status to back
tell application "System Events"
set adium_running to (exists process "Adium")
end tell
if adium_running then
tell application "Adium" to go available
end if

do shell script "defaults -currentHost write com.apple.screensaver askForPassword -int 0"
tell application "ScreenSaverEngine" to quit

say "Welcome back Master" using "Vicki"
delay 1
say "the current time is" using "Vicki"
say (time string of (current date)) using "Vicki"

end

I am no AppleScript expert so hope someone out there can either tell me if the script is at fault of JackSMS, it runs everything (including the welcome back voice prompt) however the screen stays locked...

Any help would be most appreciated!!

JackSMS Version: 1.0B6 (090)
OS X Version: SnowLeopard

Thanks!

Maxus
 
Hey,

So, JackSMS actually starts ScreenSaverEngine when you tell it to lock, and tells it to quit when you return. Therefor, the code:

Code:
do shell script "defaults -currentHost write com.apple.screensaver askForPassword -int 0"
tell application "ScreenSaverEngine" to quit

is redundant and unnecessary. Additionally, it removes the screensaver settings that you might have had before enabling JackSMS (which JackSMS restores upon you telling it to "unlock")

The real problem in this is that SnowLeopard breaks JackSMS. If you had a Leopard machine, your script would work fine. The problem lies in the following (about to get a little technical, but follow along if you want)

JackSMS modifies the values in the com.apple.screensaver to ask for password and do it immediately after the screensaver comes on. (Rather than giving you a 60 second grace period or something) After that, it uses a port to tell a background application (called loginwindow) in OSX to reload the screensaver settings. It then starts the screensaver.

During the unlock command, it sets the settings to not ask for a password, tells login window to re-read it, and then shuts down the screensaver. On leopard, the end result would be that screensaver would quit, and not needing a password, would return you to the desktop. Under SnowLeopard, however, you just get a black screen and no way to authenticate back in.

I am writing a program that borrows a lot of ideas from JackSMS and Proximity and integrates them nicely without much knowledge needed for AppleScripting from the user.

Currently, however, I am stuck at this point as well. Snow leopard broke the way JackSMS and my program did it, so now it's tough to tell where to go now.
 
Hey thewierdone2000!

Thanks for the reply, despite being a n00b on all this i think i follow it all!

Any ideas how you could work around it all? If you are working on a little something that does it all already i would be -really- interested in grabbing a copy at somepoint : )

Cheers,

Maxus
 
Right now the only solution jumping to my mind is running the screensaver within the program, and doing my own login window. Problem with that is that it probably gets foiled by cmd-opt-escape... so a lot of security that offers eh?

Frankly, if anyone had any ideas on something to try, I'd be more than game to try and whip something up.

There is also a possible hope that this is a bug, and not a feature of snow leopard in which case... fingers crossed for 10.6.1 ;-)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.