Hi Sam,
First, you have a typo in the ip address.
It should be „192.168.0.3“, not „192,168.0.3“.
It should be period, not comma there.
Then:
Why do you use the actual application „Terminal“ on the local mac?
Do you have to see the execution of your script?
On second thought, as you don’t have any mechanisms to catch errors, that’s not a bad idea, at all.
Then:
why you use osascript on the remote mac?
you’re already in „his“ or „hers" shell, so you can use shell commands to put him or her to sleep.
See „sh_text“ down below.
The „osascript“ didn’t work at all on my machines.
Then:
please don’t just „kill“ a process, when you think, it’s done it’s job.
I hope, that „av2“ is a user’s name, not an administrator’s name.
Leaving a remote mac logged in as an administrator isn’t a good idea!
Not even in „normal user mode“, an unattended mac should be left alone, sleeping for a longer time as absolutely necessary.
I’d recommend to use something like:
set sh_text to ("pmset sleepnow")
do script sh_text in window 1
delay 3
do script "exit" in window 1 -- exit from remote host
delay 3
do script "exit" in window 1 -- exit from local host
delay 3
quit -- quitting the terminal the clean way
-- this way, you get at least a note from the terminal, if something's not right.
end tell
I didn’t check, if those long delays are necessary at all.
Depends on bandwidth of your local network, too.