Thanks for the help, but I’m totally confused…
This is my complete script (what I started with)
using terms from application "Quicksilver"
on process text tweet
my growlRegister()
set charcount_limit to 140
set charcount_tweet to (count characters of tweet)
set over_limit to (charcount_tweet - charcount_limit)
-- Check tweet length
if charcount_tweet ≤ charcount_limit then
--Display sending notification
growlNotify("Sending Tweet", tweet)
-- Log into twiter.com
tell application "Keychain Scripting"
set twitter_key to first Internet key of current keychain whose server is "twitter.com"
set twitter_login to quoted form of (account of twitter_key & ":" & password of twitter_key)
end tell
set twitter_status to quoted form of ("status=" & tweet)
try
-- Send tweet
do shell script "curl --user " & twitter_login & " --data-binary " & twitter_status & " [url=http://twitter.com/statuses/update.json]http://twitter.com/statuses/update.json"[/url]
-- Display success message
growlNotify("Tweet Sent", tweet)
on error
-- Display error message
growlNotify("Error Sending Tweet", "There was an Error sending your Tweet. No, I don't know what went wrong either. Try again!")
end try
else
set dialog_display to "Your tweet is longer than the 140 character limit by " & over_limit
activate
display dialog dialog_display & " characters. Your entire message can't be delivered by sms." buttons {"Edit tweet", "Post tweet anyway"} default button 1 with icon 2
if the button returned of the result is "Post tweet anyway" then
--Display sending notification
growlNotify("Sending Tweet", tweet)
-- Log into twiter.com
tell application "Keychain Scripting"
set twitter_key to first Internet key of current keychain whose server is "twitter.com"
set twitter_login to quoted form of (account of twitter_key & ":" & password of twitter_key)
end tell
set twitter_status to quoted form of ("status=" & tweet)
try
-- Send tweet
do shell script "curl --user " & twitter_login & " --data-binary " & twitter_status & " [url=http://twitter.com/statuses/update.json]http://twitter.com/statuses/update.json"[/url]
-- Display success message
growlNotify("Tweet Sent", tweet)
on error
-- Display error message
growlNotify("Error Sending Tweet", "There was an Error sending your Tweet. No, I don't know what went wrong either. Try again!")
end try
else
set selection of application "Quicksilver" to tweet
end if
end if
-- is iChat open?
tell application "System Events"
set iChatOn to count (every process whose displayed name is "iChat")
end tell
-- is Adium open?
tell application "System Events"
set AdiumOn to count (every process whose displayed name is "Adium")
end tell
-- is Proteus open?
--tell application "System Events"
-- set ProteusOn to count (every process whose displayed name is "Proteus")
--end tell
-- is Skype open?
tell application "System Events"
set SkypeOn to count (every process whose displayed name is "Skype")
end tell
-- if iChat is open, then tweet baby!
if iChatOn is greater than 0 then
try
tell application "iChat"
set the status message to tweet
end tell
on error
growlNotify("iChat Failled", "Chainging iChat status failled.")
end try
end if
-- Adium tweeting
if AdiumOn is greater than 0 then
try
tell application "Adium"
set my status message to tweet
end tell
on error
growlNotify("Adium Failled", "Chainging Adium status failled.")
end try
end if
-- Proteus tweeting
--if ProteusOn is greater than 0 then
-- try
-- tell application "Proteus"
-- set my current status to tweet
-- end tell
-- on error
-- growlNotify("Proteus Failled", "Chainging Proteus status failled.")
-- end try
--end if
-- Skype tweeting
if SkypeOn is greater than 0 then
try
set SkypeText to "SET PROFILE MOOD_TEXT " & tweet
tell application "Skype"
send command SkypeText script name "SkypeTweet"
end tell
tell application "Quicksilver"
set process text to tweet
end tell
on error
grolwNotify("Skype Failled", "Changing Skype status failled.")
end try
end if
end process text
end using terms from
using terms from application "GrowlHelperApp"
-- Register Growl
on growlRegister()
tell application "GrowlHelperApp"
register as application "Tweet" all notifications {"Alert"} default notifications {"Alert"} icon of application "Script Editor.app"
end tell
end growlRegister
-- Notify using Growl
-- Example: growlNotify("This is an Alert","This is a test of the Growl Alert System")
on growlNotify(grrTitle, grrDescription)
tell application "GrowlHelperApp"
notify with name "Alert" title grrTitle description grrDescription application name "Tweet"
end tell
end growlNotify
end using terms from
And this is what I changed it to based on the above, which now doesn’t do a whole lot of anything
on twitter_login()
--Display sending notification
growlNotify("Sending Tweet", tweet)
-- Log into twiter.com
tell application "Keychain Scripting"
set twitter_key to first Internet key of current keychain whose server is "twitter.com"
set twitter_login to quoted form of (account of twitter_key & ":" & password of twitter_key)
end tell
set twitter_status to quoted form of ("status=" & tweet)
try
-- Send tweet
do shell script "curl --user " & twitter_login & " --data-binary " & twitter_status & " [url=http://twitter.com/statuses/update.json]http://twitter.com/statuses/update.json"[/url]
-- Display success message
growlNotify("Tweet Sent", tweet)
on error
-- Display error message
growlNotify("Error Sending Tweet", "There was an Error sending your Tweet. No, I don't know what went wrong either. Try again!")
end try
end twitter_login
using terms from application "Quicksilver"
on process text tweet
my growlRegister()
set charcount_limit to 140
set charcount_tweet to (count characters of tweet)
set over_limit to (charcount_tweet - charcount_limit)
-- Check tweet length
if charcount_tweet ≤ charcount_limit then
my twitter_login()
else
set dialog_display to "Your tweet is longer than the 140 character limit by " & over_limit
activate
display dialog dialog_display & " characters. Your entire message can't be delivered by sms." buttons {"Edit tweet", "Post tweet anyway"} default button 1 with icon 2
if the button returned of the result is "Post tweet anyway" then
twitter_login()
else
set selection of application "Quicksilver" to tweet
end if
end if
-- is iChat open?
tell application "System Events"
set iChatOn to count (every process whose displayed name is "iChat")
end tell
-- is Adium open?
tell application "System Events"
set AdiumOn to count (every process whose displayed name is "Adium")
end tell
-- is Proteus open?
--tell application "System Events"
-- set ProteusOn to count (every process whose displayed name is "Proteus")
--end tell
-- is Skype open?
tell application "System Events"
set SkypeOn to count (every process whose displayed name is "Skype")
end tell
-- is aMSN open?
tell application "System Events"
set aMSNOn to count (every process whose displayed name is "aMSN")
end tell
-- if iChat is open, then tweet baby!
if iChatOn is greater than 0 then
try
tell application "iChat"
set the status message to tweet
end tell
on error
growlNotify("iChat Failled", "Chainging iChat status failled.")
end try
end if
-- Adium tweeting
if AdiumOn is greater than 0 then
try
tell application "Adium"
set my status message to tweet
end tell
on error
growlNotify("Adium Failled", "Chainging Adium status failled.")
end try
end if
-- Proteus tweeting
--if ProteusOn is greater than 0 then
-- try
-- tell application "Proteus"
-- set my current status to tweet
-- end tell
-- on error
-- growlNotify("Proteus Failled", "Chainging Proteus status failled.")
-- end try
--end if
-- Skype tweeting
if SkypeOn is greater than 0 then
try
set SkypeText to "SET PROFILE MOOD_TEXT " & tweet
tell application "Skype"
send command SkypeText script name "SkypeTweet"
end tell
tell application "Quicksilver"
set process text to tweet
end tell
on error
grolwNotify("Skype Failled", "Changing Skype status failled.")
end try
end if
-- aMSN tweeting
if aMSNOn is greater than 0 then
try
tell application "aMSN"
set aMSNText to "::MSN::changePSM " & tweet
do script aMSNText
end tell
on error
growlNotify("aMSN Failled", "Changing aMSN status failled.")
end try
end if
end process text
end using terms from
using terms from application "GrowlHelperApp"
-- Register Growl
on growlRegister()
tell application "GrowlHelperApp"
register as application "Tweet" all notifications {"Alert"} default notifications {"Alert"} icon of application "Script Editor.app"
end tell
end growlRegister
-- Notify using Growl
-- Example: growlNotify("This is an Alert","This is a test of the Growl Alert System")
on growlNotify(grrTitle, grrDescription)
tell application "GrowlHelperApp"
notify with name "Alert" title grrTitle description grrDescription application name "Tweet"
end tell
end growlNotify
end using terms from
I get the whole calling the name of the handler and stuff, it’s the variables and things that confused me. I don’t know what things are called, this is my first applescript project and it’s been totally trial and error so far…