Sign in to follow this  
Followers 0
insilico

Save File As with increasing digits eg. a1.jpg, a2.jpg, a3.jpg etc.

4 posts in this topic

I want write a script that does the following:

1. Perform a program command

2. Save the file as "a1.jpg"

3. Perform another program command (slightly different)

4. Save the file as "a2.jpg"

5. etc

I need it to loop 360 times then stop. So i end up with 360 files, all slightly different, named a1.jpg, a2.jpg, a3.jpg... a360.jpg

How do I make the digit at the end of the filename increase (+1) in every loop? How do i make it stop after 360 times?

Thanks!

1 person likes this

Share this post


Link to post
Share on other sites



Use a variable ...

You can use the & operator to construct the file names, like this :

filename = "a" & $number & ".jpg"

and then you increment the number like this

$number = $number + 1

Share this post


Link to post
Share on other sites

For $i = 1 To 360
    Send("{CTRLDOWN}{SHIFTDOWN}S") ; uses CTRL + SHIFT + S for save as (use your own here)
    Send("{CTRLUP}{SHIFTUP}")
    sleep(0500) ; wait for the prompt
    Send("{a" & $i & ".jpg} {ENTER}")
    Sleep(0500) ; wait for the save to complete
Next

Many ways of doing this but a For > Next loop is probably your best bet. If you are working from within a program, you can find out the shortcut for file > save as and use that with send keys and give it a sleep for the delay between the program prompt and another sleep delay for the saving of the file.

This is just a very bare "untested" example.


My Projects: [topic="89413"]GoogleHack Search[/topic], [topic="67095"]Swiss File Knife GUI[/topic], [topic="69072"]Mouse Location Pointer[/topic], [topic="86040"]Standard Deviation Calculator[/topic]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0