Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- on JoinList(l, del)
- set RetVal to ""
- set OldDel to AppleScript's text item delimiters
- set AppleScript's text item delimiters to del
- set RetVal to l as string
- set AppleScript's text item delimiters to OldDel
- return RetVal
- end JoinList
- on SplitList(t, del)
- set RetVal to {}
- set OldDel to AppleScript's text item delimiters
- set AppleScript's text item delimiters to del
- set RetVal to every text item of t
- set AppleScript's text item delimiters to OldDel
- return RetVal
- end SplitList
- on ReplaceString(theText, oldString, newString)
- set OldDel to AppleScript's text item delimiters
- set AppleScript's text item delimiters to oldString
- set tempList to every text item of theText
- set AppleScript's text item delimiters to newString
- set theText to the tempList as string
- set AppleScript's text item delimiters to OldDel
- return theText
- end ReplaceString
- set OnlineFriends to {}
- tell application "System Events"
- set powerCheck to ((application processes whose (name is equal to "Skype")) count)
- if powerCheck = 0 then
- set end of OnlineFriends to "Skype is not running."
- else
- tell application "Skype"
- set SkypeStatus to send command "GET CONNSTATUS" script name "online users"
- if SkypeStatus is "CONNSTATUS ONLINE" then
- set AppleScript's text item delimiters to " "
- set Friends to send command "SEARCH FRIENDS" script name "online users"
- set Friends to my ReplaceString(Friends, " ", ",")
- set Friends to my ReplaceString(Friends, ",,", ",")
- set FriendsList to my SplitList(Friends, ",")
- set NumFriends to number of items in FriendsList
- repeat with i in FriendsList
- if (i begins with "DISABLEDxmpp:") or (i begins with "USERS") or (i is "echo123") then
- --ignore these
- else
- -- Determine online status and get details only for online friends
- set FriendStatus to send command "GET USER " & i & " ONLINESTATUS" script name "online users"
- if text item 4 of FriendStatus is "ONLINE" then
- set aUser to send command "GET USER " & i & " FULLNAME" script name "online users"
- set aUser to text items 4 thru end of aUser
- set aUser to my JoinList(aUser, " ")
- if aUser is "" then set aUser to i
- set amoodtext to send command "GET USER " & i & " MOOD_TEXT" script name "online users"
- if number of text items in amoodtext > 3 then
- set amoodtext to text items 4 thru end of amoodtext
- set amoodtext to my JoinList(amoodtext, " ")
- if amoodtext is "" then
- set end of OnlineFriends to aUser
- else
- set end of OnlineFriends to aUser & " (" & amoodtext & ")"
- end if
- end if
- end if
- end if
- end repeat
- if (count OnlineFriends) > 0 then
- set OnlineFriends to my JoinList({"Skype Friends:"} & OnlineFriends, "
- ")
- else
- set beginning of OnlineFriends to "No Skype Friends online at this time."
- end if
- else
- set beginning of OnlineFriends to "Skype is offline."
- end if
- end tell
- end if
- end tell
- return OnlineFriends
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement