Sign in to follow this  
Followers 0

Hi I need some help

14 posts in this topic

Posted

I new to autoit and im just really trying a simple calculator Automation.

to find out tax and total price.

$fftax = 6.5 ;florida
$fTax = Inputbox("Tax Rate","Whats your states tax","6.5")
;This checks what state your tax rate is in.
If $fTax == $fftax Then
ControlClick("Calculator", "", "[ID:136]") ;tells to click the 6
ControlClick("Calculator", "", "[ID:84]") ;tells click the (.) key
ControlClick("Calculator", "", "[ID:135]") ;tells click the 5
ControlClick("Calculator", "", "[ID:92]")
EndIf

But i realized thats not quite what im lookin for. so my question really is

How would i go about it automate it with out me telling it

ControlClick("Calculator", "", "[iD:136]") ;tells to click the 6

ControlClick("Calculator", "", "[iD:84]") ;tells click the (.) key

ControlClick("Calculator", "", "[iD:135]") ;tells click the 5

ControlClick("Calculator", "", "[iD:92]")

my self...

Like if i told it my tax rate was the 6.5 , how can i make it automaticly know to put in 6.5 with out me doing what i did above?

Share this post


Link to post
Share on other sites



Posted

Try Send('6.5')

Next time use better topic title!

Share this post


Link to post
Share on other sites

Posted

no thats bascly what that does i figured it out. was reading more help files better if i use

ControlSend("Calculator", "", "[CLASS:Button]", "" & $Ap)

Controlsend better cause im useing inputboxes so could be like

$ap = inputbox("blah"," enter your tax rate: ")

now it will display user input instead of me automateing it by ID'S

ControlSend("Calculator", "", "[CLASS:Button]", "" & $Ap)

Thanks for youlls help thoe

Share this post


Link to post
Share on other sites

Posted

The problem with it before was, i was gonna have another input box pop up after it hits all the numbers.

and ask for the price to multiply it by to find the tax and stuff.

but useing the controlclick wouldnt have worked the way i needed it to. So i saw the controlsend in the

Help file and figured out how to get it to read the user input and send it, With the click it wouldnt do that.

But half of youll or more know that.

Share this post


Link to post
Share on other sites

Posted

no, send can have almost identical result on it

$fftax = '6.5*5' ;florida
$fTax = Inputbox("Tax Rate","Whats your states tax","6.5")
If Not WinExists("[CLASS:SciCalc]") Then Run("calc")
WinWait("[CLASS:SciCalc]")
SendKeepActive("[CLASS:SciCalc]")
Send($fftax,1)
Send('{ENTER}')

Share this post


Link to post
Share on other sites

Posted

Is there a reason why you do not just do the calculations in your code with operators.

Share this post


Link to post
Share on other sites

Posted

Here i just finished this is what i was trying to do. a simple tax calculation.

run("calc")
$Ap = Inputbox("Sale Price","Whats the Sales Price?: ","")
ControlSend("Calculator", "", "[CLASS:Button]", "" & $Ap)
ControlClick("Calculator","","[ID:92]")
$Bp = InputBox("Tax Rate","Enter the Tax Rate?: ","6.5")
ControlSend("Calculator", "", "[CLASS:Button]", "" & $Bp)
ControlClick("Calculator","","[ID:118]")
ControlClick("Calculator","","[ID:121]")
ControlClick("Calculator","","[ID:93]")
ControlSend("Calculator", "", "[CLASS:Button]", "" & $Ap)
ControlClick("Calculator","","[ID:121]")

Share this post


Link to post
Share on other sites

Posted

Is there a reason why you do not just do the calculations in your code with operators.

I wanted to automate it to do it, instead of using the + - x etc in code

Share this post


Link to post
Share on other sites

Posted

Here i just finished this is what i was trying to do. a simple tax calculation.

run("calc")
$Ap = Inputbox("Sale Price","Whats the Sales Price?: ","")
ControlSend("Calculator", "", "[CLASS:Button]", "" & $Ap)
ControlClick("Calculator","","[ID:92]")
$Bp = InputBox("Tax Rate","Enter the Tax Rate?: ","6.5")
ControlSend("Calculator", "", "[CLASS:Button]", "" & $Bp)
ControlClick("Calculator","","[ID:118]")
ControlClick("Calculator","","[ID:121]")
ControlClick("Calculator","","[ID:93]")
ControlSend("Calculator", "", "[CLASS:Button]", "" & $Ap)
ControlClick("Calculator","","[ID:121]")

Works with low calculations but higher ones nope.

it does what i want it to thoe, but when it goes to do the calculations it adds everything.

for example

5.99 x 6.5% you get 2.33 tax + 5.99 you get 8.32.....

but sense im automating the calculator its adding 2.3322065 (with on low calculation it works if you did 5.99 6.5 % youll get the right answer

but youll see it liek 8.3222065 But you still get the $8.32. Which brings me to a question

is there a way i can cut out the rest of tha bs numbers. example 2.3322065 keep (2.33) and discard the 22065.

Share this post


Link to post
Share on other sites

Posted

no, send can have almost identical result on it

$fftax = '6.5*5' ;florida
$fTax = Inputbox("Tax Rate","Whats your states tax","6.5")
If Not WinExists("[CLASS:SciCalc]") Then Run("calc")
WinWait("[CLASS:SciCalc]")
SendKeepActive("[CLASS:SciCalc]")
Send($fftax,1)
Send('{ENTER}')

Thanks for ay help i didn't see yours untell now.

Share this post


Link to post
Share on other sites

Posted

but youll see it liek 8.3222065 But you still get the $8.32. Which brings me to a question

is there a way i can cut out the rest of tha bs numbers. example 2.3322065 keep (2.33) and discard the 22065.

Yes, don't automate the calculator, and do the calculations in a script. Now that you know how to automate the calculator, actually using it to perform calculations is silly when the language does it so much easier.

Share this post


Link to post
Share on other sites

Posted

is there a way i can cut out the rest of tha bs numbers. example 2.3322065 keep (2.33) and discard the 22065.

and look at Round() and related funcs in help file

Share this post


Link to post
Share on other sites

Posted

i can do it in regular code, just seem like it woulda been funner to do it as a automation

Share this post


Link to post
Share on other sites

Posted

and look at Round() and related funcs in help file

Thank you again very helpfull

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0