HotHead Posted March 8, 2018 Share Posted March 8, 2018 (edited) Hi All Apologies if this has already been dealt with (I have searched and not found any conclusive answer on the forum). Is there a way to have curly bracket placeholders other than {query} - specifically {clipboard:0}, {clipboard:1}, {clipboard:2}, ... - evaluated within a php script? It appears that {clipboard:7} does not get evaluated upon initialisation like {query} does, but rather remains a placeholder right up to the moment where it is passed to some Alfred output such as Large Type, and only then is the clipboard value retrieved from the DB. Code example: $query = "{query}"; // $query has been assigned the value passed to the script $i = 7; $history_item = "{clipboard:$i}"; // $history_item has not been assigned any value from the clipboad stack - it holds the literal string value '{clipboard:7}' That means I can't access, search, and manipulate the clipboard history items within my code. Will I need to query clipboard.alfdb manually, or is there a simpler solution? All help appreciated Edited March 8, 2018 by vitor Marked as solved Link to comment
deanishe Posted March 8, 2018 Share Posted March 8, 2018 2 hours ago, HotHead said: Is there a way to have curly bracket placeholders other than {query} - specifically {clipboard:0}, {clipboard:1}, {clipboard:2}, ... - evaluated within a php script? Not directly. Only the {query} macro is expanded in Script boxes (it's a legacy feature for compatibility with Alfred 2 workflows—you should use ARGV in Alfred 3). {var:…} and {clipboard:…} macros do work in other elements, however, so you can use an Args and Vars utility to set workflow variables using {clipboard:…} and read the variables from the environment in your PHP script. Link to comment
HotHead Posted March 8, 2018 Author Share Posted March 8, 2018 Thank you for a quick response, for the clarification, and the recommendation to move to ARGV, 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