see who is logged in ?

Im trying to create an applescript that runs at login and see if the user is logged in to another computer on the network?..

I can get the output by running the command “whoami”… but then how can i scan the network and see if the same user is logged in somewhere else?!


Try this:

do shell script "ssh -b [address] whoami" -- replace "[address]" with the desired IP address

I don’t know the exact syntax of ssh, so good luck. :wink:

Hope this helps.

Thanks a million…
but can i replace the address with a network range ?

Try a repeat loop with a value that changes every iteration until the value reaches a certain number.

Sample code is below.

set x to 0
    set y to x + 1
    set x to y
    display dialog "Iteration " & x buttons {"Cancel", "Continue"} default button 2
    if x is 10 then
        exit repeat
    end if
end repeat

Replace the [address] in the “do shell script” thingamajig with this:

" & [variable name] & "

There’s a space after the second quotation mark, but with the way the board software formats posts, it always deletes such “mistakes”. I wish there were a way to disable that…

However, if you want to do all that within a single “do shell script” line, I’m afraid I can’t help you. SSH doesn’t support such things.