AppleScript C Perl Shell Xcode Other

Check and log when Skype user is online

Post Reply
coding / applescript     Views: 3581Prev .. Next
Check and log when Skype user is onlinePosted: Friday, June 25, 2010 [14:19:13] - 1
rootPosted by:rootMember Since:
June 16 2010
Posts: 357
If you want to know if Skype user is online and when he/she was online - you could write a small AppleScript to do so.
In addition you could log user status change. I use log feature in particular when I am away to see if my Skype watchdog for the server was up (if it was up).

A small AppleScript:
View Codeset Badid to false
do shell script "echo |perl -n -e 'if(-f \"/skype.logs/last.skp.txt\") {unlink \"/skype.logs/last.skp.txt\";}'"
repeat until Badid is true

set Prog to do shell script "ps axj"
if Prog does not contain "Skype" then
set OnlStat to SkypeCall("Your_skype_login")
end if

tell application "Skype"
set result to send command "GET USER watchdog ONLINESTATUS" script name "getType"
set PrData to result
delay 2
do shell script "perl /skype.logs/skype.stat.cgi " & quoted form of PrData
end tell
--set Badid to true
delay 60
end repeat

on SkypeCall(login)
set AppleScript's text item delimiters to " "
tell application "Skype"
set foo to send command "GET USER " & login & " ONLINESTATUS" script name "MyScript"
set UserStatus to my GetPart(foo, 4, " ")
if UserStatus is "ONLINE" then
return true
end if
end tell
end SkypeCall

on GetPart(s, p, d)
set theList to every text item of s
return (item p of theList)
end GetPart


and Perl log script:
View Code$d = $ARGV[0];
#print "here - ";
if($d =~ m/STATUS/) {
$d =~ s/(ONLINESTATUS)( )(.*?)$/$&/si;$wr=$3;
print "$d ($wr)\n";
$d =~ s/USER( )(.*?)( )/$&/;$usr = $2;
if(-f "/skype.logs/last.$usr.skp.txt") {$last = `cat /skype.logs/last.$usr.skp.txt`;} else {$last='aaa';}
unless($last eq $wr) {
open(TXL,">/skype.logs/last.$usr.skp.txt");print TXL $wr;close(TXL);
$localtime = `date`;chop $localtime;$localtime =~ tr/ //s;
($wd,$mo,$da,$ti,$sh,$ye) = split(/\s/,$localtime);$ut=time;
open(TXT,">>/skype.logs/Skype.$usr.$mo.$ye.txt");
print TXT "$localtime\t$ut\t$usr\t$wr\n";
close(TXT);
} ## END IF DIFFERENT
}


Make sure path to programs and logs in AppleScript and Perl script are fully qualified.
If user status changes - it will be logged.There's no place like ~
coding / applescriptPrev .. Next
 
Post Reply
Home - Coding: AppleScript C Perl Shell Xcode Other
Our Telegram Group