Like the name suggest "Do the following to the matched file or folder" is passing each file separately over. In some cases this is not ideal.
If the folder content matches my rules the following file actions get triggered:
- Convert all images
- Mark them yellow when they are finished.
- Run Automator workflow*
- Display a Growl notification that the job is done.
*There's this Automator workflow from Brett Terpstra that…
- takes a Finder selection of files
- optimizes the images (optional)
- copies them to your local blog uploads directory on your hard drive
- the files actullay get stored in a subfolder with actual date, c.f. "uploads/2013/02"
- it puts all links in your clipboard as Markdown formated inline links.
How to tackle this?
Option 1 would be to gather all files, put them in the clipboard and let Brett's workflow run it's magic on the copied files in the clipboard.
The script is a ruby script (https://gist.github.com/ttscoff/4514795) which runs as an Automator workflow passing input to stdin.
Option 2 would be to rebuild this:
- Get a filenames like "pic1.png, pic2.png"
- Reformat each name and add it to append it to the clipboard:
- http://myblog.com/uploads/2013/02/pic1.png
- http://myblog.com/uploads/2013/02/pic2.png - Run John Gruber's Regex on the clipboard:
Search:- Code: Select all
(?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))
Replace:- Code: Select all

… to reformat those image links to the Markdown image link syntax  - Actually moving the files to the local upload folder on the hard drive with the date as folder structure base for filing. If the directory doesn't exist it has to be created.
To me option 1 looks way simpler. The question is if Hazel can pull it off with the help of AppleScript or a shell script.