Jump to content

ilium007

Member
  • Posts

    10
  • Joined

  • Last visited

Recent Profile Visitors

420 profile views

ilium007's Achievements

Helping Hand

Helping Hand (3/5)

0

Reputation

  1. Thanks - I generally prefer keywords as there is no way I can remember all the shortcut keys I use daily. I'll have a play with the AppleScript.
  2. Workflow and HEIC image .zip link: https://alpha.transfer.sh Google Drive link: https://drive.google.com/drive/folders/12dLkyce2Ll00XnTzAe61kyHy1qbbza2N?usp=sharing What I am trying to achieve: Workflow triggered from keyword Take one or many selected HEIC files from current Finder window and pass each sequentially to the shell script that runs a simple imagemagick command Post a notification to the O/S once each image is converted
  3. I have deleted the workflow 20 times over trying to get it to work. I will re-create and upload.
  4. I am sure I've been able to do this easily in the past. I want the currently selected HEIC files in the Finder app to be passed as filenames to a shell script to convert to JPG files and remove the HEIC image files. Nothing I have tried works. Screenshot below shows a "File Action" specifying .HEIC file types feeding the shell script with a keyword feeding into the shell script as pictured. Script is simply: /usr/local/bin/magick mogrify -monitor -format jpg "{query}"
  5. Should have known better than to start a flame war. Apologies for offending your product
  6. No, I am re-thinking how I approach it. I don't want external scripts, I was doing it in Alfred so I could just manage a workflow plugin. In the Linux world args passed to scripts are space delimited. Not sure why Alfred decided to do it different. Maybe it was ease of input in the GUI keyword prompt (spaced strings would then have to be quoted), not sure, but I know it is a bit is a pain for my needs. At least it could have been an option. I think I will just write a one liner int he Alfred script input to break apart $1 at spaces to create my args.
  7. Hi - I am trying to run a bash script and pass in 3 args from and Alfred keyword input type. I want to validate the input and exit if 3 args are not passed. The issue I have is that when using "with input as argv" bash only sees a single argument, ie. I can't then do something like: if [ "$#" -ne 3 ]; then echo "3 arguments required" exit 1 fi because bash only sees a single arg verified with a test script: echo "$#" > /Users/ilium007/sandpit/ilium007.txt echo $@ >> /Users/ilium007/sandpit/ilium007.txt which results in: 04:44 pm ilium007@MBP ~/sandpit $ cat ilium007.tst 1 a s d f g ie. 1 arg passed when I actually passed in 5 args I wrote a seperate bash script (external to Alfred) to test my code and it works as expected: 04:51 pm ilium007@MBP ~/sandpit $ cat test1.sh #!/bin/bash echo "$#" > /Users/ilium007/sandpit/ilium007.txt echo $@ >> /Users/ilium007/sandpit/ilium007.txt 04:51 pm ilium007@MBP ~/sandpit $ and then call it passing in 5 args: 04:50 pm ilium007@MBP ~/sandpit $ ./test1.sh a s d f g 04:50 pm ilium007@MBP ~/sandpit $ cat ilium007.txt 5 a s d f g 04:50 pm ilium007@MBP ~/sandpit $ How should I be doing this from within Alfred ? Do I need to read into a bash list and then look at the length of the list ?
  8. I needed a workflow to handle multiple images so I modified this one to do just that. Hope you don't mind. My code below: on alfred_script(target_width) set theCount to 0 set currSelection to {} tell application "Finder" set theSelection to selection end tell repeat with this_file in theSelection -- try to get a jpg or png try tell application "Finder" set myPath to POSIX path of (this_file as text) end tell tell application "Image Events" -- open the image file set this_image to open myPath -- get dimensions of the image copy dimensions of this_image to {W, H} -- calculate scale factor with given width and scale the image set scale_factor to target_width / W scale this_image by factor scale_factor save this_image in myPath close this_image -- get new image width and height for output set new_W to round (W * scale_factor) rounding as taught in school set new_H to round (H * scale_factor) rounding as taught in school set new_size to new_W & " x " & new_H end tell -- set the_return to (W & " x " & H & " → " & new_size) as text -- return the_return set theCount to theCount + 1 on error errStr number errorNumber return "No image file found!" end try end repeat return ("Processed " & theCount & " images") as text end alfred_script
×
×
  • Create New...