-- the name of your livejournal account
set my_name to "YOUR USERNAME"
-- the subject line for you entry:
set my_topic to "I'm Awesome!"
-- the body of your entry:
set my_post to "I posted this directly from AppleScript using LiveJournal's XML-RPC API. Kickass."
-- password dialog (sent in the clear, see LJ docs for safer methods)
copy {text returned of (display dialog "Enter password for " & quoted form of my_name with title ¬
"LiveJournal Post Event" with icon stop default answer "" with hidden answer), "clear"} to ¬
{my_pass, my_auth}
-- figure out the time and date of your post based on local system time
set post_time to time of (current date)
if post_time ≥ hours then
copy {post_time div hours, post_time mod hours} to ¬
{my_hour, minute_x}
copy {minute_x div minutes, minute_x mod minutes} to ¬
{my_minute, my_second}
else if post_time ≥ minutes then
copy {0, post_time div minutes, post_time mod minutes} to ¬
{my_hour, my_minute, my_second}
else
copy {0, 0, post_time} to {my_hour, my_minute, my_second}
end if
current date
copy {year of result, month of result as integer, day of result} to {my_year, my_month, my_day}
-- the actual post event
tell application "http://www.livejournal.com/interface/xmlrpc" to call xmlrpc ¬
{method name:"LJ.XMLRPC.postevent", parameters:¬
{{username:my_name, auth_method:my_auth, |password|:my_pass, |event|:¬
my_post, lineendings:"mac", subject:my_topic, security:"", allowmask:0, |year|:¬
my_year, mon:my_month, |day|:¬
my_day, hour:my_hour, min:my_minute}}}
-- open the entry in your default browser
open location (|url| of result)
x-posted