Jump to content

pass variables to alfred script

Recommended Posts

Hi there i have a workflow where a hotkey would trigger the "Keyword" input and the pass the argument into a var utility and set "title" var to the current query.


In the end i have an alfred script which will post to wordpress self hosted blog.


I have tried this:

on alfred_script(q)
	set myBlogUsername to "myusername"
	set myBlogPass to "mypassword"
	set poststrut to {post_type:"post", post_status:"publish", post_format:"status", post_title:"{var:title}", post_content:"test"}	
	tell application "https://myblogdomain.com//xmlrpc.php"
		set myPosts to call xmlrpc {method name:"wp.newPost", parameters:{"1", myBlogUsername, myBlogPass, poststrut}}
		return  myPosts				
	end tell
end alfred_script

But it won't pass the var, just use it as a string. i also tried {$title} and ${title}...

CleanShot 2021-04-05 at 09.47.47.png

CleanShot 2021-04-05 at 09.47.11.png

CleanShot 2021-04-05 at 09.46.57.png

CleanShot 2021-04-05 at 09.46.48.png

Link to comment

{var:...} expansion doesn’t work in Script boxes. Please see the stickied thread on workflow variables:



Note: Workflow variables don't work at all in Run NSAppleScript. Don't use that. Use Run Script with Language = "/usr/bin/osascript (AS)" instead.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...