p01 Kansas City Southern
Skip to main content

Recent Topics

xx
InDesign Export to .txt
by Tracy
Today at 04:54:48 PM

clip

xx
Only took 30 years
by Skryber
Today at 02:47:25 PM

xx
Metal Plate Hanging Tab Thingies
by Farabomb
Today at 02:23:14 PM

xx
Preflight for black text
by Tracy
Today at 12:13:02 PM

xx
Need a good scanner for Mac High Sierra
by DPSprint
October 16, 2018, 09:26:03 PM

clip

xx
Xmpie or Fusion Pro
by pspdfppdfxhd
October 15, 2018, 02:09:06 PM

xx
Acrobat excessive RAM usage
by Joe
October 12, 2018, 06:20:51 PM

xx

xx
Mac Email Client
by Joe
October 11, 2018, 02:01:39 PM

Topic: Re: AppleScript/Automator to create folder based on partial file name, move files (Read 1041 times) previous topic - next topic - Topic derived from Re: AppleScript/Autom...

Re: AppleScript/Automator to create folder based on partial file name, move files

Reply #15
That sounds good, does this script need adjusting?
I see it says "your script goes here"
also I don't know how to save it as a Service with Automater
can you give me the steps on how to use this? very interesting.

Re: AppleScript/Automator to create folder based on partial file name, move files

Reply #16
Tracy, when creating a new Automator doc, you can select “Service” or another option.

Screenshot attached.

I’d advise you to Google up and search for Automator and or AppleScript sites, there are many websites out there with great info to get beginners past the initial hurdles of getting started.

Re: AppleScript/Automator to create folder based on partial file name, move files

Reply #17
Hey thanks Swampy!
That should help

Re: AppleScript/Automator to create folder based on partial file name, move files

Reply #18
Hey thanks Swampy!
That should help

After creating your new blank service in Automator, copy/paste in the code and hit the “compile” spanner icon as attached.

To run, contextual/control/right click on a file and select your service command.

Re: AppleScript/Automator to create folder based on partial file name, move files

Reply #19
That sounds good, does this script need adjusting?
I see it says "your script goes here"
also I don't know how to save it as a Service with Automater
can you give me the steps on how to use this? very interesting.

No adjustment required, the bit that is marked as:

(* Your script goes here *)

Is what is known as a “comment” which is ignored by the scripting engine and is used to document the script.

That line can be left, or removed.

In an earlier post I showed AppleScript code in two separate attachments, one “complex” and one “simplified”.

Re: AppleScript/Automator to create folder based on partial file name, move files

Reply #20
As previously mentioned, I personally find ExifTool a whole lot easier to use and it is easy enough to put it into an Automator service for easy right click access.

The AppleScript code posted by Fat Boy Tim used 43 lines of code and 1051 characters.

The equivalent ExifTool command only uses 1 line of code and 91 characters and is cross platorm (apart from the specific shell script bits that are Mac OS only).

Both methods process "instantly" and will create a new folder based on the filename of the selected file and move the file into the newly created folder. The ExifTool command has the advantage of working on multiple selected files. Of course, ExifTool can “only do so much" and it is not a scripting language, so it is a case of horses for courses.

Code: [Select]
/usr/local/bin/exiftool '-directory<${directory}/${filename;s/(^.+)(\.[^.]*$)/$1/}' -r "$@"

 

Re: AppleScript/Automator to create folder based on partial file name, move files

Reply #21
This is excellent stuff, I will practice it an read about it.
I hope I get it!
wish you guys were here  :laugh: