Padoriku Posted December 19, 2024 Posted December 19, 2024 I wrote this osascript to open "Preview" and select File->New From Clipboard. I tested it in terminal and it successfully does so. But when I trigger it with Alfred, nothing happens. Alfred debugger shows [05:56:25.914] Logging Started... [05:56:29.144] Save Clipboard to File[Keyword] Processing complete [05:56:29.147] Save Clipboard to File[Keyword] Passing output '' to Run Script I'm not sure how to get osascript logs to also print in Alfred debugger. My custom logs don't seem to be in the debugger at all. Here is my script on run argv log "running workflow" set appToCall to "" if count of argv = 1 then set appToCall to item 1 of argv end if if appToCall = "" then set appToCall to "Preview" end if set retryCount to 0 set maxRetries to 5 repeat until application appToCall is frontmost or retryCount >= maxRetries delay 0.5 set retryCount to retryCount + 1 tell application appToCall to activate end repeat tell application "System Events" log "sending to app" tell process appToCall if appToCall = "Preview" then log "app is Preview" click menu item "New from Clipboard" of menu "File" of menu bar 1 end if end tell end tell end run
vitor Posted December 19, 2024 Posted December 19, 2024 Welcome @Padoriku, Please see How to Ask for Help with a Workflow for a primer on the information to include when asking for assistance. Following those short points only takes a minute and makes everyone better equipped to help you. We need to see your workflow and to know how you’re calling it. Also, be sure to check Understanding the Scripting Environment.
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