Skip to content

Instantly share code, notes, and snippets.

@troutcolor
Last active April 12, 2019 02:10
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save troutcolor/51cf0f81308210886b97c5fe2dafc6d0 to your computer and use it in GitHub Desktop.
Save troutcolor/51cf0f81308210886b97c5fe2dafc6d0 to your computer and use it in GitHub Desktop.
This is a script for alfred to post to a WordPress, adding the category micro, post format status and as a note. There is no title. I use a hotkey cmd-alt-cnrl-m alfred passes the selected text in the topmost app to the script as q. I don't deal with special chars. Password hard coded is probably not a good idea. Obviously you could edit categor…
on alfred_script(q)
set myBlogUsername to "USERNAME"
set myBlogPass to "PASSWORD"
set cat to {category:{"Micro"}, kind:{"note"}}
set poststrut to {post_type:"post", post_status:"publish", post_format:"status", post_title:"", post_content:q, terms_names:cat, comment_status:"open"}
tell application "http://example.com/xmlrpc.php"
set myPosts to call xmlrpc {method name:"wp.newPost", parameters:{"1", myBlogUsername, myBlogPass, poststrut}}
return myPosts
end tell
end alfred_script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment