samuelraub Posted June 24, 2023 Share Posted June 24, 2023 Hey everyone, macOS: 13.4.1 (22F82) Alfred: 5.1.1 [2138] I noticed some inconsitent behaviour with the File Action Trigger and Univeral Action Trigger (limited to Files): If triggered via the Alfred File Search, the clipboard stays unchanged. If triggered via the Universal Action Hotkey, the file get's copied to clipboard. (The described behaviour occurs regardless of the settings in "Universal Actions" -> "Workflow Keyword Inputs" and "Workflow Script Filters".) Steps to reproduce: Download this minimal test workflow: https://www.dropbox.com/scl/fi/fghkwc91zb2jdxvmxyz6m/test.alfredworkflow?dl=0&rlkey=bpkr2xx2cjxrmdmd0r4kjhct2 (Keyword is "test") Search a file with Alfred File Seach Execute the test workflow on it -> Clipboard stays unchanged Now highlight a file in Finder Hit your Universal Action Hotkey (default: option+Cmd+#) Execute the test workflow on it -> File gets copied to clipboard This makes it hard to develop workflows that interact with files and rely on the latest clipboard entry. Especially for people who don't have clipboard history enabled. An example: I'm trying to develop a workflow that encrypts a file with age. After encrypting the file the auto-generated passphrase from age gets copied into clipboard. For decryption, the workflow tries to retrieve the passphrase from latest clipboard entry - which doesn't work if executed by highlighting a file in Finder and triggering via the Universal Action Hotkey. Thanks in advance for any additional info or help. Best, Sam Link to comment
Andrew Posted June 24, 2023 Share Posted June 24, 2023 @samuelraub In Alfred's Advanced settings, set the "Selection Hotkeys" mode to "Restore previous clipboard item". Cheers, Andrew samuelraub 1 Link to comment
samuelraub Posted June 24, 2023 Author Share Posted June 24, 2023 48 minutes ago, Andrew said: @samuelraub In Alfred's Advanced settings, set the "Selection Hotkeys" mode to "Restore previous clipboard item". Cheers, Andrew Nice! Thank you very much. Yet - any tips on how to deal with this when developing a workflow like in the example above? Link to comment
zeitlings Posted June 27, 2023 Share Posted June 27, 2023 (edited) With the “Arg and Vars” utility you could set an environment variable to the previous clipboard with {clipboard:1} and read the variable to decrypt. For that to work, the clipboard history most likely has to be enabled though. Edited June 27, 2023 by zeitlings 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