insilico Posted February 27, 2009 Share Posted February 27, 2009 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! OwestoffCow 1 Link to comment Share on other sites More sharing options...
Inverted Posted February 27, 2009 Share Posted February 27, 2009 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 Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted February 27, 2009 Share Posted February 27, 2009 A for-loop would be easiest For $X = 1 to 360 ;do something with $X Next .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
Ealric Posted February 27, 2009 Share Posted February 27, 2009 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] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now