Jump to content

Recommended Posts

Posted

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?

Posted (edited)

It's a pretty basic math formula... (x / y ) * 100 = %

Edited by Ejoc
Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs
Posted (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 by Smed

601DisengageEnd Program

Posted

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

Posted

MsgBox will fire when $x is exactly 80, but I think you have the right idea now.

601DisengageEnd Program

Posted

$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
Posted

$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.

 

Posted (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 by gamerman2360
Posted

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...