|Jan 23, 2007, 12:44 PM||#1|
Help with AppleScript?
I was trying to develop an automator workflow that would automatically backup images in my Aperture library onto DVDs and I am hoping that somebody would be able to help me with this.
Basically here what the whole workflow would look like:
Take images from Aperture library that does not have keyword "DVD."
Create encrypted DVD-sized DMG with different labels (e.g. DVD001, DVD002)
Copy the images into the DMG files.
Apply the DMG label as a keyword in Aperture (e.g. DVD001) to each image (so it's possible to tell which DVD contains the backup image)
I know some of this is possible with Automator (that is applying labels, getting files etc.), but what I can't figure out is how to integrate applescript (to sort the files, create DMG) into the Automator workflow.
Could somebody please help me out with this?
Thanks so much!
|Jan 23, 2007, 02:04 PM||#2|
you can integrate AppleScripts directly into Automator in a number of ways. the most obvious is the Run AppleScript action which is located in the Automator category on the left. it basically gives you a little script editor where you can enter your custom code. it uses a variable called "input" which is the output of the previous action. so if your previous action output a group of images then input would be a list containing those objects. you can also choose not to use input at all and just have some standalone code in there. sometimes using the Run AppleScript action works but often i find myself having to use a combination of standalone scripts which trigger Automator workflows which i've saved as applications. this helps when you have to do any kind of repeats or loops since Automator doesn't have any looping. keep in mind that if the apps you are trying to control are scriptable then just ab out anything is possible, sometimes just takes a while to figure out.
"The spice must flow..."
|Jan 23, 2007, 04:39 PM||#3|
Thanks for your reply.
So I think I am making some progress with this. I think you're right that it may be better to do this all within Applescript since it can loop better.
Can you help with a specific example though?
I can get Applescript to export all the correct images that I want from Aperture into one folder. But once it is in that folder, is there anyway to sort them into separate folders each being say 4.6GB?
For example, say I have files (1.dng, 2.dng, .... 10000.dng). Can it automatically put (1.dng to 500.dng) into folder ("ONE"), and then (501.dng to 101.dng) into folder ("TWO"), and so on?
Thanks again for all your help!
|Jan 23, 2007, 05:24 PM||#4|
well there are a million ways to do that. off the top of my head i would start by simply counting up your images and creating your container folders based on that, either with AppleScript or just manually. then you can just do something like (and this is not code but you get the idea)
tell app "Finder"
move items 1 through 500 of folder "master folder" to folder "folder 1"
move items 501 through 1000 of folder "master folder to folder "folder 2"
and so on...
you could also get fancy with some repeat loops where you replace the numbers with a variable based on some basic math. depending on how much you feel like learning you could script the whole shebang by figuring out how to do the following:
-gather em up into a list
-grab a chunk
-make a new folder
-move the chunk into the new folder
if you want it to be fun and productive you should just tinkner, that's the only way to really "get" AppleScripting. also, go register in the forums at macscripter.net, it's a serious lifesaver and a great community.
"The spice must flow..."
|Thread Tools||Search this Thread|
|thread||Thread Starter||Forum||Replies||Last Post|
|Why so much Applescript?||Dranix||Mac Programming||25||May 2, 2014 01:05 AM|
|help with applescript||andrewisgod||Mac Programming||0||Apr 18, 2014 07:58 AM|
|AppleScript: How do I save multiple Excel sheets to one pdf using Applescript||sbtaylor1||Mac Programming||0||Oct 28, 2013 11:38 PM|
|AppleScript: How do I save multiple Excel sheets to one pdf using Applescript||sbtaylor1||Mac Applications and Mac App Store||0||Oct 28, 2013 11:32 PM|
|Help with an Applescript||Theydonboi||Mac Applications and Mac App Store||2||Nov 5, 2012 11:52 AM|
All times are GMT -5. The time now is 02:43 AM.