majed Posted October 7, 2009 Posted October 7, 2009 hi I want a loop to do the following: x=100; start point first result of the loop 100*1.2=120; is the second result of the loop 120*1.2=144; is the 3ed result of the loop 144*1.2=173; is the 4th result of the loop .... etc I tryed to solve it like this for $i=1 to 10 send (x*1.2) next it dosnt work; please help kind regards
Zedna Posted October 7, 2009 Posted October 7, 2009 $x = 100 for $i=1 to 10 $x = $x * 1.2 send ($x) Next Resources UDF ResourcesEx UDF AutoIt Forum Search
boogieoompa Posted October 7, 2009 Posted October 7, 2009 This should work, just enter the code and you have 2 seconds to get to notepad or what have you before it begins. Think this is what you were talking about. $x = 1 sleep(2000) For $i = 1 to 10 send($x*1.2&@CRLF) $x = $x+1 Next
boogieoompa Posted October 7, 2009 Posted October 7, 2009 Sorry meant to ... $x = 100 sleep(2000) For $i = 1 to 10 send($x*1.2&@CRLF) $x = $x * 1.2 Next
majed Posted October 7, 2009 Author Posted October 7, 2009 sorry the first 3 numbers are O.K then its not; some thing is missing (thanks)
boogieoompa Posted October 7, 2009 Posted October 7, 2009 I have it working fine, however it is not rounding for instance on your sheet you have the 4th iteration as 173 but 144 x 1.2 = 172.8. The script just deals with exact numbers so every iteration will give you an additional decimal place.
majed Posted October 7, 2009 Author Posted October 7, 2009 boogieoompa : yes its rounding problem results are: 120 144 1728 20736 248832 is it possible to solve it; I apriciate your help
Zedna Posted October 7, 2009 Posted October 7, 2009 (edited) $x = 100 for $i=1 to 10 $x = Round($x * 1.2, 0) send ($x) Next Edited October 7, 2009 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
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