alpo Posted August 13, 2017 Share Posted August 13, 2017 I'm trying my hand on a new workflow that is supposed to perform a search in Evernote using AppleScript and return the results as XML for Alfred to display. (I am aware of the existing Evernote workflows, but I'm trying something specific) 1. I created a flow with a Run NSAppleScript action 2. In the script I'm doing something simple for now on alfred_script(q) -- your script here tell application "Evernote" set theResults to (find notes "tag:qq " & q) end tell if theResults = {} then set theOut to my empty_xml(q) else set theOut to my to_xml(theResults) end if -- display dialog theOut return theOut end alfred_script on empty_xml(query) set xml to "<items>" set xml to xml & "<item uid='notfound' arg='' valid='yes'>" set xml to xml & "<title>Unanswered quick question</title>" set xml to xml & "<subtitle><![CDATA[No answers found for question" & query & "]]></subtitle>" set xml to xml & "<icon>icon.png</icon>" set xml to xml & "</item>" set xml to xml & "</items>" return xml end empty_xml on to_xml(theResults) return "" end to_xml 3. The above returns a result in the form <items><item uid='notfound' arg='' valid='yes'><title>Unanswered quick question</title><subtitle>No answers found for question </subtitle><icon>note.png</icon></item></items> <!-- or --> <items><item uid='evernote:///view/2147483647/s112/bc3656b2-b355-4f7d-8347-126f00e37d4d/bc3656b2-b355-4f7d-8347-126f00e37d4d/' arg='evernote:///view/2147483647/s112/bc3656b2-b355-4f7d-8347-126f00e37d4d/bc3656b2-b355-4f7d-8347-126f00e37d4d/' valid='yes'><title><![CDATA[What the address of the Oracle office in Oakland?]]></title><icon>icon.png</icon></item></items> which to me look valid. This is not working in the sense that I don't see any errors or results. What am I doing wrong? thanks Link to comment
deanishe Posted August 13, 2017 Share Posted August 13, 2017 You can only return results for Alfred to display from Script Filters, not Run Scripts or Run NSAppleScripts. Link to comment
alpo Posted August 13, 2017 Author Share Posted August 13, 2017 TIL. Thank you @deanishe! Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now