p01 Kansas City Southern
Skip to main content

Recent Topics

xx
Printing scratch and win cards
by Tracy
February 22, 2019, 03:15:04 PM

xx
Mojave (and Acrobat DC)
by david
February 22, 2019, 09:26:02 AM

xx
Imposition Books - XMF
by Joe
February 21, 2019, 01:03:27 PM

xx
CWS 5
by wonderings
February 20, 2019, 04:02:55 PM

xx

xx
Markstools2 - State of the Industry?
by scottrsimons
February 19, 2019, 08:00:06 AM

xx
KBA CIP3 software
by Joe
February 18, 2019, 04:10:36 PM

xx
Dell PowerEdge R730 RAID
by mattbeals
February 18, 2019, 02:43:01 PM

xx
Prinergy 8.1.2 for sale
by abc
February 15, 2019, 05:50:39 PM

xx
Combine rows in excel to one row
by swampymarsh
February 15, 2019, 09:21:01 AM

Topic: applescript to automator workflow... (Read 267 times) previous topic - next topic

applescript to automator workflow...

Like i read below, i'm not the only one having trouble with automator...

So I found this script on the internet, which makes folders out of filenames then moving the files inside them.

--------

for file in *; do
if [[ -f "$file" ]]; then
mkdir "${file%.*}"
mv "$file" "${file%.*}"
fi
done

--------

It works with terminal but first you must ''direct'' it to the proper folder ( writing cd and folder address inside terminal, then pasting the script )

I'd like - and i tried - using this script as a folder action with no success.
( I saved it as .scpt flie inside library/folder action scripts and then enabling folder actions to a folder, without any luck)

Then i tried with automator, as a folder action workflow, same there.

I'd really appreciate if anyone could tell me how should i do this, make a ''hot folder'' with the script above, to which when i throw a file inside, a new folder is created named after the file and then the file is moved inside the new folder.

I could also do with automator tutorials, if anyone has any or could help me find them, even in youtube - but those i saw weren't very helpful!

Thanks in advance!

Re: applescript to automator workflow...

Reply #1
I'm not sure if this would help or not, but I use a ABFR (A Better Finder Rename) to do pretty much the reverse of what you're doing. Basically, rename a file based on the folder name. With it, I've made a few droplets where all I do is drop my file on it, and it will rename to the same name as the folder it's in, plus add a few other things for my workflow. It's really great, you can string together multiple actions for renaming & a boat load of other stuff.

http://www.publicspace.net/ABetterFinderRename/index.html

Re: applescript to automator workflow...

Reply #2
Thanks, that's not what i was really looking for.

Maybe i'm missing something but automator needs a lot of work (= develpment ) to be really useful.

Locking a pdf means you can't open it, no disable editing option available ), few -the least - resources in the web with tutorials or text on how to make your own service and import it to automator etc

I think the best option for automating tasks inside apps or with the finder is scripting, unless you work in a automated workflow like printready or prinergy.

 Best - not easy, but with plenty of documentation from adobe.

Thanks again!




Re: applescript to automator workflow...

Reply #4
I'd really appreciate if anyone could tell me how should i do this, make a ''hot folder'' with the script above, to which when i throw a file inside, a new folder is created named after the file and then the file is moved inside the new folder.

Hi motormount, a “simple” change to your code was all it took:

Code: [Select]
for file in "$@"; do
if [[ -f "$file" ]]; then
mkdir "${file%.*}"
mv "$file" "${file%.*}"
fi
done

Then setup the Automator Workflow like the attached image.

I had already done all of the hard work when learning how to incorporate ExifTool command line code into the Finder, so I’m glad that was all it took for your code!

http://prepression.blogspot.com/2016/12/automator-diy-exiftool-gui-services.html

.

Re: applescript to automator workflow...

Reply #5
First of all thanks a LOT.

But.

Even if i had figured out what to replace with the * representing the hot folder, i'd still be looking how to ''compose'' the workflow inside automator.

I'll check the prepression blog, but i still think automator needs  a lot of development to be useful.

Thanks Again !

Re: applescript to automator workflow...

Reply #6
Did you see the image attached to my previous reply? This shows how to configure the Automator Workflow for your script. Yes, this is not intuitive and one may have to spend hours researching the internet to make such things work.

The link to my blogpost is just a hint at what else is possible in Automator when using non GUI based methods, whether they be command line code, scripts etc.

In the case of Folder Actions, I believe that Automator is just a more accessible front end to the existing framework that was traditionally used by AppleScript, however I could be wrong. Despite AppleScript having an “easy to write syntax” it is still beyond many users. I agree that Automator could do with more work, it is not always obvious how to correctly order or structure flows.

 

Re: applescript to automator workflow...

Reply #7
 That's why the capitals were for, cause i saw the image, and like i wrote even if i had figure out what to write in the place of the asterix i would be still searching how to make it work inside automator.

That's why i also wrote that with scripting one might do more, there is a lot more documentation and examples all over the net.
( Talking about adobe apps and javascript )

Thanks again it works like it should and i know now how to rename a target folder!