jang Posted May 1, 2006 Posted May 1, 2006 If I define something like $previous = object $number = 1 $next = $previous & $number $stop = 1 While $stop=1 If FileExists ($next) Then $Previous = $next $number = $number + 1 Else $stop = 0 Return $previous EndIf My question is when the program ends will $previous be equal to $next at the time $previous was defined, or will it have the new $number? thanks
Moderators SmOke_N Posted May 1, 2006 Moderators Posted May 1, 2006 (edited) No, but maybe sticking next = in the loop will do the trick:$previous = object $number = 1 $stop = 1 While $stop = 1 $next = $previous & $number If FileExists($next) Then ;$Previous = $next $number = $number + 1 Else $stop = 0 Return $previous EndIf WEnd Edit: I don't know if you should use $Previous = $next to be honest... Of course, I have no idea what your doing with it. Edit2: Run these to see what I'm saying:;With $previous = "Blah" $number = 1 $stop = 1 While $stop = 1 $next = $previous & $number If $previous <> '' Then;FileExists($next) Then $Previous = $next $number = $number + 1 Else $stop = 0 Return $previous EndIf MsgBox(0, '', $next) WEnd ;Without $previous = "Blah" $number = 1 $stop = 1 While $stop = 1 $next = $previous & $number If $previous <> '' Then;FileExists($next) Then $number = $number + 1 Else $stop = 0 Return $previous EndIf MsgBox(0, '', $next) WEnd Edited May 1, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
jang Posted May 1, 2006 Author Posted May 1, 2006 No, but maybe sticking next = in the loop will do the trick:$previous = objectMy intention is to actually keep the the previous at the time it was defined so I guess it works, thx
Geert Posted May 1, 2006 Posted May 1, 2006 Try this: $name = "object" $number = 1 $stop = 1 While $stop = 1 $next = $name & $number If FileExists($next) Then $Previous = $next $number = $number + 1 Else $stop = 0 EndIf WEnd MsgBox(0, "", $Previous)
Moderators SmOke_N Posted May 1, 2006 Moderators Posted May 1, 2006 My intention is to actually keep the the previous at the time it was defined so I guess it works, thxOk, well, my suggestion is to run the examples I just edited, so you can actually get an idea of what's happening. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
jang Posted May 1, 2006 Author Posted May 1, 2006 Ok, well, my suggestion is to run the examples I just edited, so you can actually get an idea of what's happening.Thanks it's fully working.
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