Jump to content


  • Posts

  • Joined

  • Last visited

Hans-Pe's Achievements

Helping Hand

Helping Hand (3/5)



  1. That's it! Thank you! In order to feed multiple files into a workflow, automator requests to get the list of file pathes to be piped from stdin separated by newlines (see man). So I added printf in front of automator.
  2. I built some Quick Actions in Automator (e.g. with pdf actions like "Combine PDF Pages"). I wonder if and how it is possible to reuse them in Alfred and invoke them in Alfred File Actions. I would prefer to invoke them from Alfred's user interfaces instead to have to memorize crazy keyboard shortcuts or to have to ⌃click the file selection in Finder. I am running BigSur. - Hans-Peter
  3. deanishe, you are right. It's an AppleScript thing. I compared the scpt-files produced with Scripteditor and with osacompile. Same length and they are nearly identical, they differ only in the event code used for property path of document: Scripteditor generates ppth, which is correct and osacompile generated FTPc, which is property path of class URL, I found a list of event codes in gist. You objected to my use of "Run NSAppleScript". OK, I merged the two AS now into a single "Run Script", this simplifies the whole workflow and makes it more efficient. Thanks for your comments -Hans-Peter
  4. I wrote a workflow which queries System Events for the currently active application. The result is used in a tell block to query the application for the path of the file corresponding to the top window. Finally this path is used to pop up Alfred's file action menue. Short Snippet to show the principle and describe my question: tell application activeApp set the_doc to front document set the_name to the name of the_doc set the_result to path of the_doc end tell When run outside Alfred, the snippet works as expected. But it throws AppleScript error -1728 when included inside Run NSAppleScript and Run Script (/usr/bin/osascript). The error is thrown at the third set command, that is, I am able to get the front document and its name property, but I fail to access the document's property path. -1728:„TextEdit“ hat einen Fehler erhalten: „path of document "alfred"“ kann nicht gelesen werden. Running the script from Sripteditor works fine. Running the compiled AppleScript with osascript from terminal also works fine. Running the AppleScript text with osascript (I think, this is how Alfred is doing it) from terminal yields -1728 as in the Alfred case. To make it work in a workflow, I have to compile the script with the help of Scripteditor and run the resulting scpt-file with osascript in a shell in Run Script: query=$1 echo -n $(osascript frontfile.scpt "$query") I provide two workflow-files on Github: frontmostdoc.alfredworkflow is the released and working workflow frontmostdoc-prototype.alfredworkflow shows how I started and demonstrates the issues describes above: keywords "wo" and "ou" are failing, keyword "where" works. Is there a bug in osascript or did I run into some kind of restriction in the AppleScript Language macOS BigSur Version 11.4 - Hans-Peter
  • Create New...