Posting to a Wordpress Blog via Applescript

I’m sure it’s possible with AS, obviously a shell script of some sort. I’m useless with shells though :frowning:

Here is a Ruby script I just put together to post to a WordPress blog.
It appears everything is working except the ‘categories’. Each time I
post it is my default category that shows up and not what I send with
the script.

(AFAIK there is no way to post to WordPress using vanilla AppleScript.)

I was just looking for something else in Hanaan Rosenthal’s book and saw
an example of calling xmlrpc from AppleScript on page 723.

tell application "http://url-to-xml-rpc-service"
    call xmlrpc {method name: the_method, parameters: parameter_list }

I have not tried it but it is a starting place if you need to use AppleScript.
end EDIT:



You can call it from AppleScript like this.

on quoteMe(q_string)
	return quoted form of q_string
end quoteMe

set post_cmd to "/usr/bin/ruby ~/desktop/post.rb"
set post_cmd to post_cmd & space & quoteMe("My Post Title")
set post_cmd to post_cmd & space & quoteMe("my-post-title")
set post_cmd to post_cmd & space & quoteMe("Once upon a time there were three little bears..." & return)
set post_cmd to post_cmd & space & quoteMe(return & "on with the rest of the story" & return)
set post_cmd to post_cmd & space & quoteMe("['Applescript']")
set post_cmd to post_cmd & space & quoteMe("['AppleScript', 'Xcode']")
do shell script post_cmd

Awesome :smiley:
Thanks Craig I’ll try it out :slight_smile:

You’re welcome. Let me know how it works out.