Request for Script Assistance

Ok, I admit I’m a total newb. But I can’t imagine this being that hard.

Quick background: Part of my job requires me to occasionally download and sequence screenshots from user’s PC’s. The files are stored on a server with a webpage style layout with a image having a sequential name (like 200723090001.jpg, 200723090002.jpg, etc).

I have a series of scripts that I run in Terminal that allow me to give the URL of the folder I want images from, and then give it a start number and an end number, then I redirect it to an HTML file. This is then saved as a Web Archive, which I then run through File Juicer to isolate the imges out. I then run another script that renames them based on the criteria I provide.

I don’t expect it all to be one click, but I would like a little less typing as I currently type out the entire command in Terminal by hand, for example:

./ ‘’ 10 18 → Desktop/SS.html

The script above adds the range of numbers provided and then appends.html, as well as adds the HTML codes around it all to make an HTML file of just the images.

I’m wanting to automate as much of it as possible, and am somewhat proud of what I have so far.

I don’t much care what language it takes, but I do want to learn how it works so I can tweak it on my own.

So where do I start? I see there was a post about passing commands to the terminal, but I would also need to pass some user reqested info as well.

Where do I start?

Model: MacBook Pro 2.33GHz
AppleScript: 1.10.7
Browser: Safari 419.3
Operating System: Mac OS X (10.4)

Perhaps I just haven’t had enough coffee this morning, but Im not follwing the entire html part of whats going on and why it’s nessecary if you know the path to the image and the image name.

Assuming you do you could just pop up three dialog boxes asking for path, start range, end range and then use a loop with curl to download the images.

If this approach sounds like it would work let us know, shouldnt take more than a few minutes to throw together.

The HTML part simply made for an easy way to get the image to File Juicer. Sometimes I just have to do a few images, but sometimes its a hundred images. When its high in image count, its much faster to load the HTML, save as archive, then juice it than it is to right click, save as.

I admit I have no idea what curl is, but what you decribe is pretty much correct. I shouldn’t need more than path, start and end range, and also a destination input. That’s all I can think of it needing anyway.

Okay here is a basic version to get you started

set imageFolderPath to text returned of (display dialog "Please enter the image folder path" default answer "")
set imageName to text returned of (display dialog "Please enter the image name" default answer "")
set startRange to text returned of (display dialog "Please enter the image start range" default answer "")
set endRange to text returned of (display dialog "Please enter the image end range" default answer "")

set shellCommand to "curl " & imageFolderPath & imageName & "[" & startRange & "-" & endRange & "].jpg -o ~/Desktop/\"" & imageName & "#1.jpg\""
do shell script shellCommand

Okay so for testing purposes I have 10 images online through

So when asked to enter the parts I enter

Please enter the image folder path:
Please enter the image name: images-
Please enter the image start range: 1
Please enter the image end range: 10

It then downloads all 10 images to my desktop named images-1.jpg up to images-10.jpg

So hopefully thats the sort of thing you are looking for and we can work from there :smiley:

That looks like a good start, and I even somewhat understand what its saying. lol.

So my next question is can we get it to auto parse the name section. As in, if you give it:

It knows to chop of the last 4 characters plus how ever many digits myrange is. For example, as it is now I have three scripts: sequence2, sequence3 and sequence4, which correspond to how many digits I need it to modify. I don’t mind running them each serpeate as I am now, but I owuld think it could simply match what range I feed it. so if I say the range is 10-28, it’s a 2 digit sequence. If I put in 89-107, its a three digit sequence, etc. I can put in leading zeros if needed, I don’t mind.

Lastly, I need to specify the output folder. Although everything goes into ~\Pictures\Captures and then I would make a folder specific to the request number, then a subfolder of the computer name that generated the captures. So a completed destination path would be something like:


Oh yeah, and I’m curious … what is curl?

curl (or cURL) is a command line tool for transferring files with URL syntax :stuck_out_tongue_winking_eye:

So how about this what are some specific examples of info you would like to feed into the system (in an ideal world) and what you would expect to happen at that point. ie… so I can see what you would be entering to come up with that specified output path… and I didn’t follow wether leading zeroes did or did not exist :smiley:

Actually, I got it working now. Your script was enough of a springboard for me to modify it where needed. Thanks, I owe ya a beer!

Heheh, glad to help!