can't seem to get program to stop when i need it to
i have been trying to make a vbs script that re names files have them named like bg1 bg2 bg3 bg4... i have the program doing this but for some reason the program wont stop i need some help with this.
Set WshShell = WScript.CreateObject("WScript.Shell")
strtext = inputbox("Da file nme plz :3 :")
f = inputbox("How much files are there:")
WshShell.SendKeys "{RIGHT}"
WshShell.SendKeys "{LEFT}"
Dim a
a = inputbox("Number to start at:")
do
a=a+1
WshShell.SendKeys "{F2}"
WshShell.SendKeys (strtext & a)
WshShell.SendKeys "{TAB}"
loop while a<f
WshShell.SendKeys "{ENTER}"
inputbox("done :3")
Re: can't seem to get program to stop when i need it to
Your loop is wrong:
Code:
Do While i>10
some code
Loop
Re: can't seem to get program to stop when i need it to
Loop looks ok to me, or sort of anyway. The while part probably should be on the Do rather than the loop so that it does not execute it a>f on the first pass
It assigns a starting value to f and to a before the loop
A is incremented inside the loop
loop condition is while a<f which at some point would be false and end the loop assuming of course a number is actually entered in the input box for f otherwise it could run forever
That said if the goal is to rename some files that is not the way to go about it.
You may want to look into the FSO and how to use it to rename a file and forget about using SendKeys