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


Click here to return to the 'Remote GUI login via Apple Remote Desktop' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Remote GUI login via Apple Remote Desktop
Authored by: cpbaldwin on Oct 11, '05 10:59:22AM

Based on the example you gave and if all computers use the same username and password a bash shell script would look like this. Also is an Applescript example below. The problem, is that neither one of them work. Just using the single line you gave don't work for me. If I ssh into the computer first and then give each command one by one it works, which defeats the purpose of this script.
Same with the Applescript. It just don't work. Everything that I've found and read about this indicates that both of these should work. If anybody out there can help figure this one out, I would appreciate it a lot.

#!/bin/bash

COMPUTERS=20
IPADDR="192.0.80."
USERNAME="username"
PASSWORD="password"
i=0
startip=2

while [ $i -le "$COMPUTERS" ]
do

ssh root@$IPADDR$startip osascript -e 'tell application "System Events" to keystroke "$USERNAME"';osascript -e 'tell application "System Events" to keystroke tab';osascript -e 'tell application "System Events" to delay 0.5';osascript -e 'tell application "System Events" to keystroke "$PASSWORD"';osascript -e 'tell application "System Events" to delay 0.5';osascript -e 'tell application "System Events" to keystroke return'

i=$(($i+1)) #this is for the loop counter
startip=$(($startip+1)) #this sets the ip address

done

exit 0

This is an Applescript script...

property COMPUTERS : 20
property IPADDR : "192.168.80."
property USERNAME : "username"
property passwd : "password"

set counter to 2

repeat COMPUTERS times
set tempip to "eppc://" & USERNAME & ":" & passwd & "@" & IPADDR & counter
set remote_computer to application "System Events" of machine tempip
using terms from application "System Events"
tell remote_computer
keystroke USERNAME
keystroke tab
delay 0.5
keystroke passwd
delay 0.5
keystroke return
end tell
end using terms from
set counter to counter + 1
end repeat



[ Reply to This | # ]