Jump to content

Jasondm007

Member
  • Content Count

    123
  • Joined

  • Last visited

  • Days Won

    4

Jasondm007 last won the day on November 28

Jasondm007 had the most liked content!

About Jasondm007

  • Rank
    Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. @sballin You already know how much I love this workflow, so I won't bore you with more praise! Ha If you're still accepting suggestions for tinkering with the workflow, is it possible to add another action modifier that allows users to open the selected note in its own window (i.e., instead of the default that always opens in the app's main window)? There are often times when I need to quickly look at something in a note while I'm working on another one, and I've love to be able to do that a little more quickly. Thanks!
  2. Jasondm007

    selection in macos + keyword

    @GuiB Please ignore that last question. I think I understand how it works now. In most cases, it's just the "tell application ..." line(s) that will get changed, correct? And, subsequent references to each file are to the "fileAlias" variable? For example, the code below follows your approach to open each file in the Preview app (nothing special about Preview here - I just wanted to make sure that I understood how everything worked). on trim(theText) return (do shell script "echo \"" & theText & "\" | xargs") end trim on run argv set my text item delimiters to tab set theFileList to text items of (item 1 of argv) repeat with theFile in theFileList set fileAlias to (POSIX file trim(theFile) as alias) tell application "Preview" to open fileAlias end repeat end run Thanks!
  3. @sballin This is amazing!! I can't thank you enough! I was able to get it working just by opening the app in its current location inside of the workflow (and approving the permissions - re: unidentified developer). It works perfectly!!
  4. Jasondm007

    selection in macos + keyword

    @GuiB This is amazing!! Thanks a ton. Am I correct to say that - in most applications of this method - only the highlighted portions of the following image would change (i.e., the portion of the script beginning with "set fileAlias ..." and ending with "... downloads folder)")? So, if I were to create another workflow, I'd be adding its new code to that highlighted portion and referencing each file with the "trim(theFile)" variable? Thanks!!
  5. Jasondm007

    selection in macos + keyword

    @GuiB Thanks a ton for tinkering with your script, and for the detailed explanation. This was tremendously insightful, and has helped me understand how to fix a bunch of my partially-operational workflows. This is awesome! I hate to impose on you any more than I already have, but I am curious if you had any advice for dealing sending multiple files to AppleScripts (i.e., instead of sending the files to a bash script at the end, how might you split the file list for an AppleScript to operate)? A lot of my workflows use AppleScripts, and I'd love to make them work with multiple files, too. While I should probably start learning more bash, I often gravitate towards AppleScripts because I find them easier to understand and test with Mac's Script Editor (as I'm sure other newbies do as well). Alfred - the app, its developers, and the community - are great, but I wish the app contained more examples like the one that you created. Thanks again for all of your help!
  6. Jasondm007

    selection in macos + keyword

    @GuiB This is awesome!! In fact, I think that Alfred ought to include more examples like this for those of us newbies or scripting novices (e.g., in the Getting Started or Examples menu)!! Thanks a ton! I'm not sure if I'm doing something incorrectly, but I wasn't able to get the Run Script (bin/bash) to work as specified in your previous post above. By making the following small changes, however, it seems to be working great (changing the subsequent reference in the automator line from $trimmedPath to $file). # Change IFS to TAB and expand into an array IFS=$'\t' filesListArr=($@) # Loop over the file list array for file in "${filesListArr[@]}" do trimmedPath="$(echo -e "${file}" | tr -d '[:space:]')" # Your script to be run automator -i "$file" "/Users/Name/Library/Services/Name.workflow" done Does this look correct to you? It seems to be working, but I'm concerned it will break! Thanks! To make things easier for us to test, I've created a workflow that uses an actual bash script to move files to a user's downloads folder. The workflow has been uploaded for you here: https://nofile.io/f/ZWURw7ub90s. The file action at the top of the workflow operates perfectly (yellow - top). However, I'm having problems implementing your approach with a keyword (purple - middle). When it runs, it always drops one of the files (e.g., if run on 4 files, it will work for 3 of them, etc.). However, the hotkey - which runs the same bash script - operates perfectly (pink - bottom). Based on this example, how would you suggest applying your model to the keyword example in the uploaded workflow (purple - middle)? For quick reference - and for others who may not want to download the uploaded test workflow - below you will find a (1) screenshot of it, as well as the code from the (2) osascript and (2) bash scripts (purple - middle): Screenshot Osascript set my text item delimiters to tab tell application "Finder" to set theSelection to selection as alias list repeat with i from 1 to count of theSelection set item i of theSelection to POSIX path of item i of theSelection as string end repeat return theSelection as text Bash Script # Change IFS to TAB and expand into an array IFS=$'\t' filesListArr=($@) # Loop over the file list array for file in "${filesListArr[@]}" do trimmedPath="$(echo -e "${file}" | tr -d '[:space:]')" # Your script to be run mv -i "$file" ~/Downloads done Thanks for your help!
  7. Jasondm007

    selection in macos + keyword

    @GuiB Thanks for getting back to me, and for taking a look at this. I really appreciate it. By chance, does the osascript need to be updated? I'm still having the same issue. When troubleshooting - to see what the file list looks like - I attached that step to a clipboard, and the files look a little different (one of the files looks correct, but the other has "Macintosh HD" specification). Is it possible that this is the step with the problem? Thanks again for all of your help!
  8. Jasondm007

    selection in macos + keyword

    @GuiB Thanks for posting the following workflow: This was extremely helpful! Similar to @Misha I was trying to get a keyword to operate like a hotkey - which passes the selected items from Finder - and your workflow helped tremendously. That said, even after following the example, I was not able to get my workflow working with more than one file at a time (i.e., when more than one file is selected in Finder and you want to run the script on each of the files). It just runs for one of the files that are selected. Is there anything special that needs to be done to your example workflow when working with multiple files? For example, I'd like to send a few files to an automator script. When I run the script from a file action on one or more files, I use the following bash script (with input as query): files="{query}" IFS=" " set $files for file in $files do automator -i "$file" "/Users/NAME/Library/Services/NAME.workflow" done It works great, but I was hoping to run the script from a keyword, too. To accomplish this, I tried adapting your workflow. First, I changed the osascript step to the following (adding the first line😞 set my text item delimiters to tab tell application "Finder" to return POSIX path of (selection as text) Then, I changed the bash script step to the following (with input as argument😞 query=$1 IFS=" " set $1 for file in $1 do automator -i "$1" "/Users/NAME/Library/Services/NAME.workflow" done However, it only ever works on one of the files that are selected in Finder. From what I can tell after digging around, it looks like the number $1 is telling the bash script to only run on the first file. Is this correct? If so, how should your model be adapted to run for each file? Oddly enough, if I attach the osascript step (above - second snippet of code provided) to the original file action's bash script (above - first snippet of code provided), it does the same thing when run from a keyword. As a result, I think the problem is with the osascript step (above - second snippet of code provided)? I added the "set my text item delimiters to tab" to your script, but perhaps it needs a few more changes (i.e., so that it copies the names of each file in the same manner that a hotkey would using the macOS selection option)? Thanks for your help (and for posting this example workflow)!!
  9. Jasondm007

    PDF Metadata Editor?

    @vitor By chance, did you get an opportunity to look at my previous post on editing multiple files at once? Thanks again for all of your help!
  10. @sballin I don't mean to hijack this thread, but I have a Notes-related question that I was hoping to bounce off you that is somewhat related to your workflow: Namely, do you know how to create local file link for a specific note in the Notes app (i.e., one that could be inserted - like any other file link - into any text editor)? Since your workflow searches for, and opens specific notes, I thought you might know the answer. While I understand that I can generate a link for a note by using the Share option in the Notes app, I don't want to actually share the notes with other people. Instead, I'd just like to insert links in other notes and other local text editors that I could click to open within the Notes app (i.e., using the standard Add link... option). In short, I was hoping to create links that would operate like Finder (file:///path...) or Evernote's so-called "Classic Note Link" (evernote:///view/path...), but I have no idea how the Notes app stores its notes. Ideally, I was hoping to create workflow that would copy a specific note's link/path to the clipboard based on either: the note that is in the Notes app's frontmost window, OR as an alternative action from your workflow's search results (e.g., using ⌥+↩︎ to copy, to the clipboard, the link of a note selected from your workflow's search results). I suspect both options are incredibly difficult ... so please feel free to ignore this message. In any event, thanks for any help you can lend!!
  11. @sballin Thanks a ton! This feature is incredibly helpful. If you live Stateside, I hope you and your family had a great Thanksgiving! All the best!
  12. Thanks @sballin!! I almost gave up on Notes before this workflow! This thing is a life saver. Sorry if I wasn't clear in my previous post. I meant to ask whether the folders, themselves, could show up as individual results (i.e., (1) among the individual note results or (2) by themselves, if an argument was added to the main script filter)? I ask because there are times when I want to open a folder without knowing which specific note that I might have placed the material in that I'm looking for (i.e., in cases where I don't have a good enough idea of what I'm even looking for). I'd also like to be able to use it as a fallback search for times when the usual workflow isn't returning the note that I am looking for, but I know the folder where it's located. In short, I'm just looking for an easy way to search for, and open, folders. Thanks again for sharing this workflow! It's great.
  13. @sballin Thanks for sharing this workflow. It's great, and has saved me a ton of time. Out of curiosity, are there any small changes that could be made to your script filter so that it only searches for folders (i.e., as a new script filter based on the NS workflow)? Or, alternatively, is it possible to see folders in the results of the standard search (i.e., alongside/within the standard results for the individual notes)? Thanks again!
  14. Jasondm007

    PDF Metadata Editor?

    @vitor I'm not sure what's wrong with it, but I can't get your suggested script working (quoted above). The good news is that the old one works fine. And, I actually simplified it to the following: on alfred_script(q) do shell script "/usr/local/bin/exiftool -overwrite_original -all= " & q end alfred_script It deletes everything, and it appears to work well with multiple files, too - which is great! Related Question: I've been trying to come up with an easy way to write the same input to multiple files at once (e.g., if you wanted to rename several files with the same author), do you have any suggestions for how to approach it? First, I tried feeding into your initial workflow, but I couldn't get anywhere (e.g., coming in at the second step - skipping the part where you'd read the current values and select a field). Instead, I tried adjusting the shell script above, but I haven't had any luck with it either. More specifically, I created a file action that accepts multiple pdfs, that is linked to an Arg & Vars utility that captures the variable pdf_file (Name) with the selected files {query} (Value) that feeds to a keyword input for the user to input the author's name for all of the files, and that feeds to another Run NSAppleScript with the following code: on alfred_script(q) do shell script "/usr/local/bin/exiftool -overwrite_original -Author=" & q pdf_file end alfred_script Here, I thought that q would pick up the value of the author's name from step 3, and that the variable pdf_file could be referenced from step 2. Any idea what's wrong with the shell script above? I'm sure that I probably screwed up the later portion of the code (" & q pdf_file), but I also wasn't sure if I had to "set" the pdf_file variable in the script, too? To make things easy, I've broken this workflow off and uploaded it here: https://cl.ly/b76255aa15d9 . And, to test, the same PDFs from before can be used. You'd just need more than one of them: https://cl.ly/1618a40a381d Thanks for any help you can lend!!
  15. Jasondm007

    PDF Metadata Editor?

    @vitor I finally figured out how to run the shell script in the appropriate manner through Alfred. For others that might be interested in doing the same, the following code will remove all of the metadata at once from a PDF (i.e., all the metadata that the EXIFtool can reach, anyways): on alfred_script(q) set posixPath to quoted form of POSIX path of q do shell script "/usr/local/bin/exiftool -overwrite_original -all= " & posixPath end alfred_script Thanks!
×