Hints, tips and tricks for newbies
Moderators: Dorian (MJT support), JRL
-
koleviko
- Junior Coder
- Posts: 45
- Joined: Thu Nov 20, 2008 2:59 pm
Post
by koleviko » Wed Apr 08, 2009 5:41 pm
File is stored on file.
How do I make files from 1 to 1000.
Code: Select all
Let>Counter=1000
Repeat>Counter
Add>counter,1
let>Pic=C:/a/1.bmp
ScreenCapture>10,100,10,100,%Pic%
// 2.bmp
// 3.bmp
// 4.bmp
// to 1000.bmp
// ?????????????????
Until>Counter=1000
Last edited by
koleviko on Thu Apr 09, 2009 2:30 pm, edited 1 time in total.
-
Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
-
Contact:
Post
by Bob Hansen » Wed Apr 08, 2009 6:00 pm
You are almost there. But you are starting your counter at 1001, not at 1. You have initialized it to be 1000 before you are incrementing it by 1. You need a separate value for the total that you want.
Try this (untested):
Code: Select all
Let>Total=1000
Let>Counter=0
Repeat>Counter
Add>Counter,1
let>Pic=C:/a/%Counter%.bmp
ScreenCapture>10,100,10,100,%Pic%
Until>Counter=%Total%
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
-
koleviko
- Junior Coder
- Posts: 45
- Joined: Thu Nov 20, 2008 2:59 pm
Post
by koleviko » Wed Apr 08, 2009 7:01 pm
Hi, not well explained. Sorry.
I want this way.
But I saved the old file instead of a new 2.bmp; 3.bmp; 4.bmp to 1000 or mactch.
Code: Select all
label>start
wait>1
Ask>Do you want make Picture ?,Yes
If>Yes=NO,End
let>Pic=C:/a/1.bmp
ScreenCapture>10,100,10,100,%Pic%
// 2.bmp
// 3.bmp
// 4.bmp
// to 1000.bmp
// ?????????????????
goto>start
label>End
Last edited by
koleviko on Thu Apr 09, 2009 2:29 pm, edited 2 times in total.
-
Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
-
Contact:
Post
by Bob Hansen » Wed Apr 08, 2009 9:57 pm
Sorry, I guess I misunderstood your first request.
And I have no idea what you mean with the modified request. But hang in there, someone else be along to help you out.
Or maybe you can try another explanation ... ? Having your code is always best for us, but this time I think you also need to put into words what your script is supposed to do.
For example, something like this:
"Prompt the user to see if they want to make a picture. If yes, save the screen with name 1.bmp, if no, then end the script. If they say Yes, then save the screen with the next number, one digit higher than the last saved numbered name. After saving the picture, wait one second and ask this question again".
The statement above is probably not correct, but just an example of how you could present your problem to us.
Last edited by
Bob Hansen on Thu Apr 09, 2009 12:21 am, edited 1 time in total.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
-
Me_again
- Automation Wizard
- Posts: 1101
- Joined: Fri Jan 07, 2005 5:55 pm
- Location: Somewhere else on the planet
Post
by Me_again » Wed Apr 08, 2009 11:56 pm
Maybe you want something like this?
Code: Select all
Let>sernum=1
label>start
wait>1
Ask>Do you want make Picture ?,Yes
If>Yes=NO,End
ScreenCapture>10,100,15,150,c:\temp\myfile%sernum%.bmp
Let>sernum=sernum+1
goto>start
label>End
Note that your ScreenCapture command:
ScreenCapture>10,100,10,100,%Pic%
won't capture anything because the upper left and lower right coordinates are the same, 10,100, so there is no area between them.
-
koleviko
- Junior Coder
- Posts: 45
- Joined: Thu Nov 20, 2008 2:59 pm
Post
by koleviko » Thu Apr 09, 2009 2:22 pm
Excellent! I had a scheme, although overwrite files in a new start.
Here's my final idea. .
Code: Select all
Let>how=c:\a\*.bmp
CountFiles>c:\a\*.bmp,how,0
label>start
wait>0.2
Ask>Do you want make Picture ?,Yes
If>Yes=NO,End
ScreenCapture>10,100,15,150,c:\a\%how%.bmp
Let>how=how+1
goto>start
label>End
"Note that your ScreenCapture command:
ScreenCapture>10,100,10,100,%Pic% " - It was just an example.
Last edited by
koleviko on Thu Feb 25, 2010 3:42 pm, edited 1 time in total.
-
Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
-
Contact:
Post
by Bob Hansen » Thu Apr 09, 2009 3:03 pm
I think that you need to eliminate one variable.
You are using "how" for two different purposes ....
1. Used as a string value to hold a path: Let>how=c:\a\*.bmp (not needed?)
2. Used as a number to hold total number of files in a folder
You should also move the count incrementer to happen before Screen Capture. That will stop the first overwrite.
Let>how=%how%+1
ScreenCapture>10,100,15,150,c:\a\%how%.bmp
Unsolicited comments:
I would probably not use "Yes" as the result variable name for Ask. It seems confusing to me. I would use something like vMakePicture instead to make reading the scripts and the logs easier to understand. I also usually name my variables with a leading lowercase "v" to help identify variable names in the scripts from other non-variable words.
Ask>Do you want make Picture ?,vMakePicture
If>vMakePicture=NO,End
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
-
koleviko
- Junior Coder
- Posts: 45
- Joined: Thu Nov 20, 2008 2:59 pm
Post
by koleviko » Thu Apr 09, 2009 5:39 pm
Yes, good idea. I made a correction. This is better!
Code: Select all
CountFiles>C:\a\*.bmp,how,1
label>start
wait>0.2
Ask>Do you want make Picture ?,not
If>not=NO,End
ScreenCapture>10,100,15,150,C:\a\%how%.bmp
Let>how=%how%+1
goto>start
label>End