Launch screen saver on a remote machine

I am using this script

set module_path to “/System/Library/Screen Savers/SaveHollywood.saver” --the posix path of the screensaver file
set module_name to “Hollywood” --the name of the screensaver file without the extension

do shell script “/usr/bin/defaults -currentHost write com.apple.screensaver moduleName '” & module_name & “’ &&/usr/bin/defaults -currentHost write com.apple.screensaver modulePath '” & module_path & “'”
try
tell application id “com.apple.ScreenSaver.Engine” to launch
end try

which I found here to switch screen savers and it works really well, what I would like to do is use the same script but activate it on a remote machine just wondering if any one had any ideas. I have just started scripting for remote machines and I can launch files and control the DVD player, I just cant get the screen saver to change/launch.
Cheers
Steve

Hi Steve,

this is a common code to launch applications on a remote machine.
As it’s not possible to target not running applications directly,
you have to open the bundle identifier via the Finder, which is the only
application on the remote machine, which runs always


property user_name : "user" -- admin username
property pass_word : "pass" -- admin password
property uid : "501" -- user id of remote machine
property host_name : "remoteComputer.local"

set s to "eppc://" & user_name & ":" & pass_word & "@" & host_name & "/Finder?uid=" & uid

if check_user(s) then
	tell application s
		using terms from application "Finder"
			open application file id "com.apple.ScreenSaver.Engine"
		end using terms from
	end tell
end if

-- check if user is logged in
on check_user(eppc)
	using terms from application "Finder"
		try
			tell application eppc to get (desktop as string)
			return true
		on error
			return false
		end try
	end using terms from
end check_user

Note: Remote Apple Events must be enabled in the Preference Pane Sharing on the remote machine

Greetings and thank you a lot!! This script works wonderfully!

I use the script by running it from an app(*) that links my bluetooth-enabled mobile phone to my intel Mac mini at my cubicle, so when my phone leaves range, it runs the script (the app has a feature to run scripts when entering and leaving proximity range). The “other”, remote mac I am controlling is a G3 iMac running 10.3.9 “Panther”.

The only trouble I’ve found is that once I come back to my seat (phone entering bluetooth range on the Mac Mini) I could just press a key on the remote computer (the G3 iMac) and it would quit the screensaver, showing me the option of putting the password to return to the screen. However, the screen only goes black, and I usually have to reboot the machine after that (it hangs up).

I assume that, since on the script there is the user_name and pass_word options, these could be used as well to “unlock” the screen saver through the script once the phone enters range and the appropriate script is run.

My question is… How do I make the remote computer to safely come out of the screensaver? I have a very small knowledge of AppleScript and tried replacing “open” on line 10 with “quit” and “close” and it didn’t worked. I assume there must be other parameters I am not acquainted with.

Again, thank you very, very much in advance!!.

(*) This app is BluePhone Elite v.1.1.1

Model: Mac mini, (OS X 10.4.11), iMac G3, (OS X 10.3.9)
Browser: Safari 531.9
Operating System: Mac OS X (10.4)