Skip to content

Commit

Permalink
Updated growl notifications to applescript spec on growl.info
Browse files Browse the repository at this point in the history
  • Loading branch information
phpfunk committed Dec 10, 2011
1 parent 309ed60 commit be609e8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ Download


## Version History ##
### 1.1.1 - December 9, 2011###
- Updated growl support to applescript spec on growl.info

### 1.1.0 - August 16, 2011###

- For SMS you no longer need the country code if number if U.S.
Expand Down
Binary file modified Skype Controls.alfredextension
Binary file not shown.
2 changes: 1 addition & 1 deletion source.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
### Controls ##### call# sms# start or init# quit or kill or exit or end# set cf (on | off)# set cf to vm (on | off)# set cf rules ([[username|phone][,username|phone]])# set cf timeout# get cf# get cf to vm# get cf rules# get friends################################# Call Number: skype call 5551212# Call Skype User: skype call phpfunk# Call Speed Dial: skype call 1# SMS Number: skype sms +14845551212 This is my message# Toggle Call Forwarding: skype set cf on | skype set cf off# Set CF Timeout: skype set cf timeout 15 (15 seconds)# Toggle CF Voicemail: skype set cf to vm on | skype set cf to vm off# Set CF Rules: skype set cf rules user,+14845551212 | skype set cf rules +14845551212# Get CF: skype get cf# Get CF Voicemail: skype get cf to vm# Get CF Rules: skype get cf rules# Get Friends: skype get friends# (If phone number does not have a country code for SMS it will default to +1)### END ####on sendMsg(nm, t, d) tell application "GrowlHelperApp" set the allNotificationsList to {nm} set the enabledNotificationsList to {nm} register as application "Skype" all notifications allNotificationsList default notifications enabledNotificationsList icon of application "Skype" notify with name nm title t description d application name "Skype" end tellend sendMsgon replaceText(find, replace, subject) set prevTIDs to text item delimiters of AppleScript set text item delimiters of AppleScript to find set subject to text items of subject set text item delimiters of AppleScript to replace set subject to "" & subject set text item delimiters of AppleScript to prevTIDs return subjectend replaceTextto splitString(aString, delimiter) set retVal to {} set prevDelimiter to AppleScript's text item delimiters log delimiter set AppleScript's text item delimiters to {delimiter} set retVal to every text item of aString set AppleScript's text item delimiters to prevDelimiter return retValend splitStringon alfred_script(q) set notify_title to "" set notify_msg to "" set res to "" set s to {"start", "init"} set e to {"end", "quit", "kill", "exit"} tell application "Skype" #start skype if q is in s then activate #kill skype else if q is in e then quit # CALL can be: # USERNAME -- CALL phpfunk # PSTN -- CALL NUMBER # SPEED DIAL CODE -- CALL 1 else if "call" is in q then set notify_title to "Call Error" set q to my replaceText("call ", "", q) set res to send command "CALL " & q script name "Make a Call with Alfred" # Send an SMS # skype sms NUMBER MESSAGE # First Create SMS and get message ID # NEXT set the SMS message # THEN send SMS and get return message else if "sms" is in q then set notify_title to "SMS Error" set q to my replaceText("sms ", "", q) set tmp to my splitString(q, " ") set nm to item 1 of tmp # If "+ is not found, add +1 to number if "+" is not in nm then set nm to "+1" & nm end if set res to send command "CREATE SMS OUTGOING " & nm script name "Send SMS with Alfred" # If message was created, move on if "STATUS COMPOSING" is in res then set msg to my replaceText(nm & " ", "", q) set eyed to my splitString(res, " ") set eyed to item 2 of eyed set res to send command "SET SMS " & eyed & " BODY " & msg script name "Send SMS with Alfred" set res to send command "ALTER SMS " & eyed & " SEND" script name "Send SMS with Alfred" # If message was successfully sent, set notification if " SEND" is in res then set notify_msg to "Your message was successfully sent to " & nm set notify_title to "Success" end if end if # All the Skypes gets you can dream of else if "get" is in q then # Return user's call forwarding rules if "cf rules" is in q then set notify_title to "Call Forwarding Rules" set res to send command "GET PROFILE CALL_NOANSWER_TIMEOUT" script name "Check CF with Alfred" set res to my replaceText("PROFILE CALL_NOANSWER_TIMEOUT ", "", res) set notify_msg to "Calls will be forwarded after " & res & " seconds to " set res to send command "GET PROFILE CALL_FORWARD_RULES" script name "Check CF with Alfred" if "," is not in res then set notify_msg to notify_msg & "Nobody" else set res to my splitString(my replaceText("PROFILE CALL_FORWARD_RULES ", "", res), ",") set x to 1 set overall to 1 repeat count (res) times set nm to item overall of res set add_it to false try (nm as number) div 1 if "+" is in nm then set add_it to true end if on error set add_it to true end try if add_it is equal to true then if overall is greater than 3 then set notify_msg to notify_msg & " and then " end if set notify_msg to notify_msg & nm end if set x to x + 1 set overall to overall + 1 end repeat end if # Return back if call forwarding is on or off else if "cf to vm" is in q then set notify_title to "Call Forwarding Voicemail Enabled" set res to send command "GET PROFILE CALL_SEND_TO_VM" script name "Check CF VMwith Alfred" if "FALSE" is in res then set notify_msg to "No" else set notify_msg to "Yes" end if # Return back if call forwarding is on or off else if "cf" is in q then set notify_title to "Call Forwarding Enabled" set res to send command "GET PROFILE CALL_APPLY_CF" script name "Check CF with Alfred" if "FALSE" is in res then set notify_msg to "No" else set notify_msg to "Yes" end if # Return back the user's friend list else if "friends" is in q then set notify_title to "Your Friends" set res to send command "SEARCH FRIENDS" script name "Find Friends with Alfred" if res is equal to "" or res is equal to "USERS" or res is equal to "USERS " then set notify_msg to "You have no friends :(" else set notify_title to "Your Friends (Copied to Clipboard)" set notify_msg to my replaceText("USERS ", "", res) set the clipboard to notify_msg as text end if end if # Skype set actions else if "set" is in q then #Overall setting of boolean variable set bool to "False" if "on" is in q then set bool to "True" end if #Set call forwarding rules if "cf rules" is in q then set notify_title to "Call Forwarding Rules" set q to my replaceText("set cf rules ", "", q) set rules to "" if "," is in q then set tmp to my splitString(q, ",") set x to 1 repeat count (tmp) times set rules to rules & "0,60," & my replaceText(" ", "", item x of tmp) set x to x + 1 end repeat else set rules to "0,60," & q end if set res to send command "SET PROFILE CALL_FORWARD_RULES " & rules script name "Set CF Rules with Alfred" if "ERROR" is not in res then set notify_msg to "Forwarders set to : " & q end if #Set call forwarding timeout else if "cf timeout" is in q then set notify_title to "Call Forwarding Timeout" set q to my replaceText("set cf timeout ", "", q) set res to send command "SET PROFILE CALL_NOANSWER_TIMEOUT " & q script name "Set CF Timeout with Alfred" if "ERROR" is not in res then set notify_msg to "Calls will be forwarded after " & q & " seconds." end if #Set call forwarding to voicemail else if "cf to vm" is in q then set notify_title to "Call Forwarding Voicemail Enabled" set res to send command "SET PROFILE CALL_SEND_TO_VM " & bool script name "Set CF VM with Alfred" if "FALSE" is in res then set notify_msg to "No" else set notify_msg to "Yes" end if #Set call forwarding to true or false else if "cf" is in q then set notify_title to "Call Forwarding Enabled" set res to send command "SET PROFILE CALL_APPLY_CF " & bool script name "Set CF with Alfred" if "FALSE" is in res then set notify_msg to "No" else set notify_msg to "Yes" end if end if end if end tell #On fail or error if "ERROR" is in res or "FAIL" is in res then set notify_msg to my splitString(res, ": ") try set notify_msg to item 2 of notify_msg on error set notify_msg to res end try sendMsg(notify_title, notify_title, notify_msg) # if not fail, but there is a message, show it else if notify_msg is not equal to "" then sendMsg(notify_title, notify_title, notify_msg) end if end alfred_script
### Controls ##### call# sms# start or init# quit or kill or exit or end# set cf (on | off)# set cf to vm (on | off)# set cf rules ([[username|phone][,username|phone]])# set cf timeout# get cf# get cf to vm# get cf rules# get friends################################# Call Number: skype call 5551212# Call Skype User: skype call phpfunk# Call Speed Dial: skype call 1# SMS Number: skype sms +14845551212 This is my message# Toggle Call Forwarding: skype set cf on | skype set cf off# Set CF Timeout: skype set cf timeout 15 (15 seconds)# Toggle CF Voicemail: skype set cf to vm on | skype set cf to vm off# Set CF Rules: skype set cf rules user,+14845551212 | skype set cf rules +14845551212# Get CF: skype get cf# Get CF Voicemail: skype get cf to vm# Get CF Rules: skype get cf rules# Get Friends: skype get friends# (If phone number does not have a country code for SMS it will default to +1)### END ####on sendMsg(nm, t, d) tell application "System Events" set isRunning to (count of (every process whose bundle identifier is "com.Growl.GrowlHelperApp")) > 0 end tell if isRunning then tell application id "com.Growl.GrowlHelperApp" set the allNotificationsList to {nm} set the enabledNotificationsList to {nm} register as application "Skype" all notifications allNotificationsList default notifications enabledNotificationsList icon of application "Skype" notify with name nm title t description d application name "Skype" icon of application "Skype" end tell end ifend sendMsgon replaceText(find, replace, subject) set prevTIDs to text item delimiters of AppleScript set text item delimiters of AppleScript to find set subject to text items of subject set text item delimiters of AppleScript to replace set subject to "" & subject set text item delimiters of AppleScript to prevTIDs return subjectend replaceTextto splitString(aString, delimiter) set retVal to {} set prevDelimiter to AppleScript's text item delimiters log delimiter set AppleScript's text item delimiters to {delimiter} set retVal to every text item of aString set AppleScript's text item delimiters to prevDelimiter return retValend splitStringon alfred_script(q) set notify_title to "" set notify_msg to "" set res to "" set s to {"start", "init"} set e to {"end", "quit", "kill", "exit"} tell application "Skype" #start skype if q is in s then activate #kill skype else if q is in e then quit # CALL can be: # USERNAME -- CALL phpfunk # PSTN -- CALL NUMBER # SPEED DIAL CODE -- CALL 1 else if "call" is in q then set notify_title to "Call Error" set q to my replaceText("call ", "", q) set res to send command "CALL " & q script name "Make a Call with Alfred" # Send an SMS # skype sms NUMBER MESSAGE # First Create SMS and get message ID # NEXT set the SMS message # THEN send SMS and get return message else if "sms" is in q then set notify_title to "SMS Error" set q to my replaceText("sms ", "", q) set tmp to my splitString(q, " ") set nm to item 1 of tmp # If "+ is not found, add +1 to number if "+" is not in nm then set nm to "+1" & nm end if set res to send command "CREATE SMS OUTGOING " & nm script name "Send SMS with Alfred" # If message was created, move on if "STATUS COMPOSING" is in res then set msg to my replaceText(nm & " ", "", q) set eyed to my splitString(res, " ") set eyed to item 2 of eyed set res to send command "SET SMS " & eyed & " BODY " & msg script name "Send SMS with Alfred" set res to send command "ALTER SMS " & eyed & " SEND" script name "Send SMS with Alfred" # If message was successfully sent, set notification if " SEND" is in res then set notify_msg to "Your message was successfully sent to " & nm set notify_title to "Success" end if end if # All the Skypes gets you can dream of else if "get" is in q then # Return user's call forwarding rules if "cf rules" is in q then set notify_title to "Call Forwarding Rules" set res to send command "GET PROFILE CALL_NOANSWER_TIMEOUT" script name "Check CF with Alfred" set res to my replaceText("PROFILE CALL_NOANSWER_TIMEOUT ", "", res) set notify_msg to "Calls will be forwarded after " & res & " seconds to " set res to send command "GET PROFILE CALL_FORWARD_RULES" script name "Check CF with Alfred" if "," is not in res then set notify_msg to notify_msg & "Nobody" else set res to my splitString(my replaceText("PROFILE CALL_FORWARD_RULES ", "", res), ",") set x to 1 set overall to 1 repeat count (res) times set nm to item overall of res set add_it to false try (nm as number) div 1 if "+" is in nm then set add_it to true end if on error set add_it to true end try if add_it is equal to true then if overall is greater than 3 then set notify_msg to notify_msg & " and then " end if set notify_msg to notify_msg & nm end if set x to x + 1 set overall to overall + 1 end repeat end if # Return back if call forwarding is on or off else if "cf to vm" is in q then set notify_title to "Call Forwarding Voicemail Enabled" set res to send command "GET PROFILE CALL_SEND_TO_VM" script name "Check CF VMwith Alfred" if "FALSE" is in res then set notify_msg to "No" else set notify_msg to "Yes" end if # Return back if call forwarding is on or off else if "cf" is in q then set notify_title to "Call Forwarding Enabled" set res to send command "GET PROFILE CALL_APPLY_CF" script name "Check CF with Alfred" if "FALSE" is in res then set notify_msg to "No" else set notify_msg to "Yes" end if # Return back the user's friend list else if "friends" is in q then set notify_title to "Your Friends" set res to send command "SEARCH FRIENDS" script name "Find Friends with Alfred" if res is equal to "" or res is equal to "USERS" or res is equal to "USERS " then set notify_msg to "You have no friends :(" else set notify_title to "Your Friends (Copied to Clipboard)" set notify_msg to my replaceText("USERS ", "", res) set the clipboard to notify_msg as text end if end if # Skype set actions else if "set" is in q then #Overall setting of boolean variable set bool to "False" if "on" is in q then set bool to "True" end if #Set call forwarding rules if "cf rules" is in q then set notify_title to "Call Forwarding Rules" set q to my replaceText("set cf rules ", "", q) set rules to "" if "," is in q then set tmp to my splitString(q, ",") set x to 1 repeat count (tmp) times set rules to rules & "0,60," & my replaceText(" ", "", item x of tmp) set x to x + 1 end repeat else set rules to "0,60," & q end if set res to send command "SET PROFILE CALL_FORWARD_RULES " & rules script name "Set CF Rules with Alfred" if "ERROR" is not in res then set notify_msg to "Forwarders set to : " & q end if #Set call forwarding timeout else if "cf timeout" is in q then set notify_title to "Call Forwarding Timeout" set q to my replaceText("set cf timeout ", "", q) set res to send command "SET PROFILE CALL_NOANSWER_TIMEOUT " & q script name "Set CF Timeout with Alfred" if "ERROR" is not in res then set notify_msg to "Calls will be forwarded after " & q & " seconds." end if #Set call forwarding to voicemail else if "cf to vm" is in q then set notify_title to "Call Forwarding Voicemail Enabled" set res to send command "SET PROFILE CALL_SEND_TO_VM " & bool script name "Set CF VM with Alfred" if "FALSE" is in res then set notify_msg to "No" else set notify_msg to "Yes" end if #Set call forwarding to true or false else if "cf" is in q then set notify_title to "Call Forwarding Enabled" set res to send command "SET PROFILE CALL_APPLY_CF " & bool script name "Set CF with Alfred" if "FALSE" is in res then set notify_msg to "No" else set notify_msg to "Yes" end if end if end if end tell #On fail or error if "ERROR" is in res or "FAIL" is in res then set notify_msg to my splitString(res, ": ") try set notify_msg to item 2 of notify_msg on error set notify_msg to res end try sendMsg(notify_title, notify_title, notify_msg) # if not fail, but there is a message, show it else if notify_msg is not equal to "" then sendMsg(notify_title, notify_title, notify_msg) end if end alfred_script
Expand Down

0 comments on commit be609e8

Please sign in to comment.