Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Hi I need some help


  • Please log in to reply
13 replies to this topic

#1 bufust

bufust

    Seeker

  • Active Members
  • 20 posts

Posted 13 November 2011 - 07:09 PM

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?







#2 Zedna

Zedna

    AutoIt rulez!

  • MVPs
  • 8,717 posts

Posted 13 November 2011 - 09:56 PM

Try Send('6.5')
Next time use better topic title!

#3 bufust

bufust

    Seeker

  • Active Members
  • 20 posts

Posted 13 November 2011 - 10:16 PM

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

#4 bufust

bufust

    Seeker

  • Active Members
  • 20 posts

Posted 13 November 2011 - 10:22 PM

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.

#5 bogQ

bogQ

    For me, it’s simple - it’s a way of life.

  • Active Members
  • PipPipPipPipPipPip
  • 1,846 posts

Posted 13 November 2011 - 10:31 PM

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}')

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project

Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)

460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 


#6 JohnOne

JohnOne

    John

  • Active Members
  • PipPipPipPipPipPip
  • 12,585 posts

Posted 13 November 2011 - 10:33 PM

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

AutoIt Absolute Beginners Require a serial
 
 
OMG! Women are the cows of people.


#7 bufust

bufust

    Seeker

  • Active Members
  • 20 posts

Posted 13 November 2011 - 10:49 PM

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]")


#8 bufust

bufust

    Seeker

  • Active Members
  • 20 posts

Posted 13 November 2011 - 10:52 PM

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

#9 bufust

bufust

    Seeker

  • Active Members
  • 20 posts

Posted 13 November 2011 - 11:14 PM

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.

#10 bufust

bufust

    Seeker

  • Active Members
  • 20 posts

Posted 13 November 2011 - 11:32 PM

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.

#11 BrewManNH

BrewManNH

    באָבקעס מיט קודוצ׳ה

  • MVPs
  • 10,301 posts

Posted 14 November 2011 - 12:03 AM

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.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to an XP machine, and I'm not going to.

 

Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude

 

How to ask questions the smart way!

 

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.
Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.
_FileGetProperty - Retrieve the properties of a file SciTE Toolbar - A toolbar demo for use with the SciTE editorGUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.
GUIToolTip UDF Demo - Demo script to show how to use the GUIToolTip UDF to create and use customized tooltips. Latin Square password generator

 

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.


#12 bogQ

bogQ

    For me, it’s simple - it’s a way of life.

  • Active Members
  • PipPipPipPipPipPip
  • 1,846 posts

Posted 14 November 2011 - 12:15 AM

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

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project

Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)

460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 


#13 bufust

bufust

    Seeker

  • Active Members
  • 20 posts

Posted 14 November 2011 - 01:28 AM

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

#14 bufust

bufust

    Seeker

  • Active Members
  • 20 posts

Posted 14 November 2011 - 01:31 AM

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


Thank you again very helpfull




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users