AppleScript for kicking off batch process on folder?

This area contains the messages from the old Yahoo gcmac group after the port.
pbickford2
Posts: 0
Joined: Sun May 20, 2012 1:38 am

AppleScript for kicking off batch process on folder?

Post by pbickford2 »

I'd love to be able to have an AppleScript run to automatically perform two operations on a deeply nested group of folders. (About 300,000 files in all). I'm trying to make a copy of the folder structure which sets a specific maximum image size/quality and inserts a JPEG comment to each file. Three main questions: 1. Is there a way to control the saved JPG quality from within AppleScript? (I need to run versions of this script on a timer to create three different sets of files, at different sizes/quality settings) 2. Can the Comment be inserted purely via AppleScript? 3. Can a batch be invoked via AppleScript, instead of looping through each level of the folder hierarchy and performing the transformation commands on the files individually? The folders are in the form: [Pictures] [Group] [Publisher Name] [Subject] Picture Shot 1.jpg Picture Shot 2.jpg etc. [Other Subject] Picture Shot 1.jpg Picture Shot 2.jpg etc. [Other publisher name] ... [Other group] ... Any help much appreciated -Pete
thorstenlemke
Posts: 0
Joined: Fri Dec 30, 2016 12:00 pm

Re: AppleScript for kicking off batch process on folder?

Post by thorstenlemke »

Hello,hmm, AppleScript would be really slow for such an amount.Do you want the same comment in all files?Do you maybe have more details?Thorsten On 20.05.2012, at 00:38, pbickford2 wrote:   I'd love to be able to have an AppleScript run to automatically perform two operations on a deeply nested group of folders. (About 300,000 files in all). I'm trying to make a copy of the folder structure which sets a specific maximum image size/quality and inserts a JPEG comment to each file. Three main questions: 1. Is there a way to control the saved JPG quality from within AppleScript? (I need to run versions of this script on a timer to create three different sets of files, at different sizes/quality settings) 2. Can the Comment be inserted purely via AppleScript? 3. Can a batch be invoked via AppleScript, instead of looping through each level of the folder hierarchy and performing the transformation commands on the files individually?
pbickford@human-computing.com
Posts: 0
Joined: Wed May 23, 2012 5:25 pm

Re: AppleScript for kicking off batch process on folder?

Post by pbickford@human-computing.com »

Same comment in all files (basically, a copyright notice).I'm hoping to develop two versions of the script, ideally auto-run once a week:1. Convert all files in the folders and sub folders of Source Folder to go to Destination Folder A (maintaining folder structure), adding comment, saving with max dimensions 1500x1500 and saving as JPG with quality 702. Convert all files in the folders and sub folders of Source Folder to go to Destination Folder B (maintaining folder structure), adding comment, saving with max dimensions 1050x1050 and saving as JPG with quality 35-Pete-Peter BickfordPractice Area Lead, UXSlalom Consulting On May 22, 2012, at 10:52 AM, Thorsten Lemke <lemke@lemkesoft.de> wrote:   Hello,hmm, AppleScript would be really slow for such an amount.Do you want the same comment in all files?Do you maybe have more details?ThorstenOn 20.05.2012, at 00:38, pbickford2 wrote:   I'd love to be able to have an AppleScript run to automatically perform two operations on a deeply nested group of folders. (About 300,000 files in all). I'm trying to make a copy of the folder structure which sets a specific maximum image size/quality and inserts a JPEG comment to each file. Three main questions: 1. Is there a way to control the saved JPG quality from within AppleScript? (I need to run versions of this script on a timer to create three different sets of files, at different sizes/quality settings) 2. Can the Comment be inserted purely via AppleScript? 3. Can a batch be invoked via AppleScript, instead of looping through each level of the folder hierarchy and performing the transformation commands on the files individually?
thorstenlemke
Posts: 0
Joined: Fri Dec 30, 2016 12:00 pm

Re: AppleScript for kicking off batch process on folder?

Post by thorstenlemke »

Hello Pete, I would just define two batches in convert&modify and run them once a week. Thorsten On 23.05.2012, at 16:25, pbickford@human-computing.com wrote: > > Same comment in all files (basically, a copyright notice). > > I'm hoping to develop two versions of the script, ideally auto-run once a week: > > 1. Convert all files in the folders and sub folders of Source Folder to go to Destination Folder A (maintaining folder structure), adding comment, saving with max dimensions 1500x1500 and saving as JPG with quality 70 > > 2. Convert all files in the folders and sub folders of Source Folder to go to Destination Folder B (maintaining folder structure), adding comment, saving with max dimensions 1050x1050 and saving as JPG with quality 35 > > -Pete > > - > > Peter Bickford > Practice Area Lead, UX > Slalom Consulting
Peter Bickford
Posts: 0
Joined: Sat May 26, 2012 12:53 am

Re: AppleScript for kicking off batch process on folder?

Post by Peter Bickford »

That’s my general plan. Are there AppleScript hooks which would allow me to control these on a timer with those settings?  -Pete  From: gcmac@yahoogroups.com [mailto:gcmac@yahoogroups.com] On Behalf Of Thorsten LemkeSent: Wednesday, May 23, 2012 11:14 AMTo: gcmac@yahoogroups.comSubject: Re: [gcmac] AppleScript for kicking off batch process on folder?    Hello Pete,I would just define two batches in convert&modify and run them once a week.Thorsten On 23.05.2012, at 16:25, pbickford@human-computing.com wrote:> > Same comment in all files (basically, a copyright notice).> > I'm hoping to develop two versions of the script, ideally auto-run once a week:> > 1. Convert all files in the folders and sub folders of Source Folder to go to Destination Folder A (maintaining folder structure), adding comment, saving with max dimensions 1500x1500 and saving as JPG with quality 70> > 2. Convert all files in the folders and sub folders of Source Folder to go to Destination Folder B (maintaining folder structure), adding comment, saving with max dimensions 1050x1050 and saving as JPG with quality 35> > -Pete> > -> > Peter Bickford> Practice Area Lead, UX> Slalom Consulting
Larry
Posts: 0
Joined: Sat Oct 02, 2010 7:30 pm

Re: AppleScript for kicking off batch process on folder?

Post by Larry »

Pete, I just checked my Apimac Timer (I have the free version). The drop down button for the alarm clock says the pro version has an option for running an Apple Script at the alarm time. I really like this little app, you might try it out by Googling "Apimac Timer". It has many, many settings for what function to perform at alarm time. Hope this helps, Larry --- In gcmac@yahoogroups.com, "Peter Bickford" <pbickford@...> wrote: > > That's my general plan. Are there AppleScript hooks which would allow me to > control these on a timer with those settings? > > > > -Pete > > > > From: gcmac@yahoogroups.com [mailto:gcmac@yahoogroups.com] On Behalf Of > Thorsten Lemke > Sent: Wednesday, May 23, 2012 11:14 AM > To: gcmac@yahoogroups.com > Subject: Re: [gcmac] AppleScript for kicking off batch process on folder? > > > > > > Hello Pete, > > I would just define two batches in convert&modify and run them once a week. > > Thorsten > > On 23.05.2012, at 16:25, pbickford@... > <mailto:pbickford%40human-computing.com> wrote: > > > > > Same comment in all files (basically, a copyright notice). > > > > I'm hoping to develop two versions of the script, ideally auto-run once a > week: > > > > 1. Convert all files in the folders and sub folders of Source Folder to go > to Destination Folder A (maintaining folder structure), adding comment, > saving with max dimensions 1500x1500 and saving as JPG with quality 70 > > > > 2. Convert all files in the folders and sub folders of Source Folder to go > to Destination Folder B (maintaining folder structure), adding comment, > saving with max dimensions 1050x1050 and saving as JPG with quality 35 > > > > -Pete > > > > - > > > > Peter Bickford > > Practice Area Lead, UX > > Slalom Consulting >
David L. Wasley
Posts: 0
Joined: Wed Jun 22, 2005 5:55 pm

Re: AppleScript for kicking off batch process on folder?

Post by David L. Wasley »

An historical note, FWIW.  Those of you born before 1970 might recall the Unix "cron" feature by which one could schedule batch jobs to run at defined intervals.  One of the things we learned early on was to never schedule something to run between 1 AM and 2 AM, at least not on a Sunday.  Once a year it would not be run at all and once a year it would be run twice that day!  "cron" still exists on Macs, accessible via "terminal".I too like Apimac Timer, BTW. David On May 26, 2012, at 7:15 AM, Larry wrote:   Pete, I just checked my Apimac Timer (I have the free version). The drop down button for the alarm clock says the pro version has an option for running an Apple Script at the alarm time. I really like this little app, you might try it out by Googling "Apimac Timer". It has many, many settings for what function to perform at alarm time. Hope this helps, Larry --- In gcmac@yahoogroups.com, "Peter Bickford" <pbickford@...> wrote: > > That's my general plan. Are there AppleScript hooks which would allow me to > control these on a timer with those settings? > > > > -Pete > > > > From: gcmac@yahoogroups.com [mailto:gcmac@yahoogroups.com] On Behalf Of > Thorsten Lemke > Sent: Wednesday, May 23, 2012 11:14 AM > To: gcmac@yahoogroups.com > Subject: Re: [gcmac] AppleScript for kicking off batch process on folder? > > > > > > Hello Pete, > > I would just define two batches in convert&modify and run them once a week. > > Thorsten > > On 23.05.2012, at 16:25, pbickford@... > <mailto:pbickford%40human-computing.com> wrote: > > > > > Same comment in all files (basically, a copyright notice). > > > > I'm hoping to develop two versions of the script, ideally auto-run once a > week: > > > > 1. Convert all files in the folders and sub folders of Source Folder to go > to Destination Folder A (maintaining folder structure), adding comment, > saving with max dimensions 1500x1500 and saving as JPG with quality 70 > > > > 2. Convert all files in the folders and sub folders of Source Folder to go > to Destination Folder B (maintaining folder structure), adding comment, > saving with max dimensions 1050x1050 and saving as JPG with quality 35 > > > > -Pete > > > > - > > > > Peter Bickford > > Practice Area Lead, UX > > Slalom Consulting >
Peter Bickford
Posts: 0
Joined: Sat May 26, 2012 12:53 am

Re: AppleScript for kicking off batch process on folder?

Post by Peter Bickford »

Thanks for that.  I think at this point, my deeper questions are around the actual implementation of the AppleScript—Is it possible to kick off a preformed batch from one, or is it really a matter of iterating all the files/folders in a loop and setting the properties for each file as we go? (I worry that for 300,000+ files, the iterative approach would be super slow).  -Pete  -  Peter BickfordPrincipal, Human Computing95 S. Market Street #500San Jose, CA 95113-2306USA  Tel: 408-266-6883 x15  From: gcmac@yahoogroups.com [mailto:gcmac@yahoogroups.com] On Behalf Of David L. WasleySent: Saturday, May 26, 2012 11:19 AMTo: gcmac@yahoogroups.comSubject: Re: [gcmac] Re: AppleScript for kicking off batch process on folder?    An historical note, FWIW.  Those of you born before 1970 might recall the Unix "cron" feature by which one could schedule batch jobs to run at defined intervals.  One of the things we learned early on was to never schedule something to run between 1 AM and 2 AM, at least not on a Sunday.  Once a year it would not be run at all and once a year it would be run twice that day!  "cron" still exists on Macs, accessible via "terminal".  I too like Apimac Timer, BTW.              David  On May 26, 2012, at 7:15 AM, Larry wrote:  Pete,I just checked my Apimac Timer (I have the free version). The drop down button for the alarm clock says the pro version has an option for running an Apple Script at the alarm time. I really like this little app, you might try it out by Googling "Apimac Timer". It has many, many settings for what function to perform at alarm time.Hope this helps,Larry --- In gcmac@yahoogroups.com, "Peter Bickford" <pbickford@...> wrote:>> That's my general plan. Are there AppleScript hooks which would allow me to> control these on a timer with those settings?> > > > -Pete> > > > From: gcmac@yahoogroups.com [mailto:gcmac@yahoogroups.com] On Behalf Of> Thorsten Lemke> Sent: Wednesday, May 23, 2012 11:14 AM> To: gcmac@yahoogroups.com> Subject: Re: [gcmac] AppleScript for kicking off batch process on folder?> > > > > > Hello Pete,> > I would just define two batches in convert&modify and run them once a week.> > Thorsten> > On 23.05.2012, at 16:25, pbickford@...> <mailto:pbickford%40human-computing.com> wrote:> > > > > Same comment in all files (basically, a copyright notice).> > > > I'm hoping to develop two versions of the script, ideally auto-run once a> week:> > > > 1. Convert all files in the folders and sub folders of Source Folder to go> to Destination Folder A (maintaining folder structure), adding comment,> saving with max dimensions 1500x1500 and saving as JPG with quality 70> > > > 2. Convert all files in the folders and sub folders of Source Folder to go> to Destination Folder B (maintaining folder structure), adding comment,> saving with max dimensions 1050x1050 and saving as JPG with quality 35> > > > -Pete> > > > -> > > > Peter Bickford> > Practice Area Lead, UX> > Slalom Consulting>  
Christopher Stone
Posts: 0
Joined: Sat Jun 19, 2004 11:47 pm

Re: AppleScript for kicking off batch process on folder?

Post by Christopher Stone »

On May 26, 2012, at 13:59, Peter Bickford wrote:I think at this point, my deeper questions are around the actual implementation of the AppleScript—Is it possible to kick off a preformed batch from one, or is it really a matter of iterating all the files/folders in a loop and setting the properties for each file as we go? (I worry that for 300,000+ files, the iterative approach would be super slow).______________________________________________________________________Hey Pete,There's no way on God's green earth that you want to try to iterate through 300K files via the Finder with Applescript.  It'll choke.  Finder scripting has always been problematic for large numbers of items.If you have to iterate then the way to go is the shell.I've never scripted GC's batch operations, but I don't see on first inspection that you can initiate a large batch from Applescript.The only command I find is:convert file file ¬     using batch file ¬     to folder fileI've spent a half hour trying to make that work on a single file, and so so far the syntax eludes me (when it should be dead-simple).At the moment I'm thinking your job might be better suited to either ExifTool or ImageMagick, but I have not used these tools for that task and therefore cannot say for certain.http://www.sno.phy.queensu.ca/~phil/exi ... .org--Best Regards,Chris
thorstenlemke
Posts: 0
Joined: Fri Dec 30, 2016 12:00 pm

Re: AppleScript for kicking off batch process on folder?

Post by thorstenlemke »

Hello,currently you have to iterate all files with AppleScript.Thorsten Am 26.05.2012 um 20:59 schrieb Peter Bickford:   Thanks for that.  I think at this point, my deeper questions are around the actual implementation of the AppleScript—Is it possible to kick off a preformed batch from one, or is it really a matter of iterating all the files/folders in a loop and setting the properties for each file as we go? (I worry that for 300,000+ files, the iterative approach would be super slow).  -Pete  -
Post Reply