Share YouTube link from iOS share sheet (via shortcuts) creates a file in an iCloud directory.
Hazel is watching that directory and when a file is added runs an apple script that takes the url from the text file and opens it in Downie
Downie is configured to save videos directly into my Plex library.
I have 1 & 3 solved. I’m stuck on 2. Here’s the AppleScript that works: tell application "Downie" open location "https://www.youtube.com/watch?v=leymqM3a8ho" end tell
But I can’t figure out a way to have Hazel replace that YouTube url with the text contents of the file that triggers the rule.
If I wanted to pass the content of a file to an AppleScript in Hazel, I’d probably do it like this, defining a function for calling the AppleScript within a shell script that reads in the file content to a variable I can then just pass in.
You could also read the content from the file directly in AppleScript. theFile is the object you would reference. I just personally find shell scripting is often more straight forward than AppleScripting.
Maybe not the answer you are looking for, and I would likely rather do this through a script as well, but this Keyboard Maestro macro works for me. It is triggered via AppleScript and Hazel:
Note, if the OP does happen to have Keyboard Maestro (all Mac automators should ), they would also have to leave their Mac unlocked to get this sort of interaction to work, which is bad practice from a security standpoint.