bufust Posted November 13, 2011 Share Posted November 13, 2011 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? Link to comment Share on other sites More sharing options...
Zedna Posted November 13, 2011 Share Posted November 13, 2011 Try Send('6.5') Next time use better topic title! Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
bufust Posted November 13, 2011 Author Share Posted November 13, 2011 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 Link to comment Share on other sites More sharing options...
bufust Posted November 13, 2011 Author Share Posted November 13, 2011 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. Link to comment Share on other sites More sharing options...
bogQ Posted November 13, 2011 Share Posted November 13, 2011 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 connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) 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. Link to comment Share on other sites More sharing options...
JohnOne Posted November 13, 2011 Share Posted November 13, 2011 Is there a reason why you do not just do the calculations in your code with operators. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
bufust Posted November 13, 2011 Author Share Posted November 13, 2011 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]") Link to comment Share on other sites More sharing options...
bufust Posted November 13, 2011 Author Share Posted November 13, 2011 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 Link to comment Share on other sites More sharing options...
bufust Posted November 13, 2011 Author Share Posted November 13, 2011 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. Link to comment Share on other sites More sharing options...
bufust Posted November 13, 2011 Author Share Posted November 13, 2011 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. Link to comment Share on other sites More sharing options...
BrewManNH Posted November 14, 2011 Share Posted November 14, 2011 but youll see it liek 8.3222065 But you still get the $8.32. Which brings me to a questionis 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 XP, 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 GudeHow to ask questions the smart way! 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. 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 editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
bogQ Posted November 14, 2011 Share Posted November 14, 2011 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 connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) 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. Link to comment Share on other sites More sharing options...
bufust Posted November 14, 2011 Author Share Posted November 14, 2011 i can do it in regular code, just seem like it woulda been funner to do it as a automation Link to comment Share on other sites More sharing options...
bufust Posted November 14, 2011 Author Share Posted November 14, 2011 and look at Round() and related funcs in help fileThank you again very helpfull 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