Update status from Twitter for Mac using AppleScript


I am trying to create a script that tweets several of my current actions in my computer but I couldn’t find an update status or alikes in the applescript dictionary of Twitter for Mac.
I am missing something or perhaps this is done on purpose?


I’m not aware of the Twitter for Mac application being scriptable at this time. You’d likely be better off leveraging a command-line utility like twurl or T for these purposes. Also, OSX Mountain Lion will have some native Twitter support: http://www.apple.com/macosx/mountain-lion/features.html#twitter


Hello @episod
Twitter for the Mac indeed has Applescript support! It has quite a lot of functions but I have the impression is more about reading information (getting followers, retweets, tweets, etc) rather than writing (posting updates).
I’ve tried Twurl for this purpose but I’ve found some errors when trying to update my status:

I am aware of Mountain Lion too! it looks promising but I really want this to be automated and I would rather not to wait… Is there anything I can do the current Twitter for Mac?


Did anyone ever find a solution to this or knows how to post a new tweet with the Twitter For Mac app using an applescript?


I’m not sure that this is the proper way but how about this?

– Begin
my tweet(“Hello Twitter!”)

on tweet(theText)
if number of characters of theText > 140 then
return false
end if
set theScript to "require ‘osx/cocoa’;p=OSX::NSPasteboard.pasteboardWithUniqueName;p.setString_forType(ARGV[1],OSX::NSStringPboardType);OSX::NSPerformService(ARGV[0], p);"
do shell script "/usr/bin/ruby -e " & quoted form of theScript & " " & quoted form of “Tweet” & " " & quoted form of theText
tell application “System Events” to keystroke return using command down
return true
end tweet
– End




Coding is…