ZebrasInBlankets Posted May 9, 2005 Share Posted May 9, 2005 Basically I want to make a number equal 100% and if that number lets say drops 20% then do something.. So, $num = 1234 If $num < 80% Then Call("bob") SOmething in that manner.. Is it possible and how would I do it? Link to comment Share on other sites More sharing options...
Ejoc Posted May 9, 2005 Share Posted May 9, 2005 (edited) It's a pretty basic math formula... (x / y ) * 100 = % Edited May 9, 2005 by Ejoc Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs Link to comment Share on other sites More sharing options...
Smed Posted May 9, 2005 Share Posted May 9, 2005 (edited) $num = 345 $pct = 80 $oldnum = $num ; Do some stuff that changes the value of $num If $num < $oldnum*$pct/100 Then ; Do something else EndIf Something like that? EDIT: added the phrase "that changes the value of $num" Edited May 9, 2005 by Smed 601DisengageEnd Program Link to comment Share on other sites More sharing options...
Smed Posted May 9, 2005 Share Posted May 9, 2005 nope... test value is always the same as present value. If you need to know that its changed you must preserve the old value. The test you presented will always fail. 601DisengageEnd Program Link to comment Share on other sites More sharing options...
Smed Posted May 9, 2005 Share Posted May 9, 2005 MsgBox will fire when $x is exactly 80, but I think you have the right idea now. 601DisengageEnd Program Link to comment Share on other sites More sharing options...
quaizywabbit Posted May 9, 2005 Share Posted May 9, 2005 $baseline = 100; 100% $threshold = ($baseline * .80); set threshold at 80% if $baseline <= $threshold Then ; your code goes here EndIf [u]Do more with pre-existing apps![/u]ANYGUIv2.8 Link to comment Share on other sites More sharing options...
GaryFrost Posted May 9, 2005 Share Posted May 9, 2005 $baseline = 100; 100% $threshold = ($baseline * .80); set threshold at 80% if $baseline <= $threshold Then ; your code goes here EndIf<{POST_SNAPBACK}>I was going to tell you were correct, but you deleted your last post before i could. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
gamerman2360 Posted May 9, 2005 Share Posted May 9, 2005 (edited) I would: ;$x is the starting number $x / .8 = $y If $x < $y Then ;...... EndIf At least something like that. Edit: Nvm, thats a variable, lol... Edited May 9, 2005 by gamerman2360 Link to comment Share on other sites More sharing options...
quaizywabbit Posted May 9, 2005 Share Posted May 9, 2005 I was going to tell you were correct, but you deleted your last post before i could.<{POST_SNAPBACK}>I had trouble following it that way...so i put it in terms I'm familiar with... [u]Do more with pre-existing apps![/u]ANYGUIv2.8 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