Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Simulate calculator clicks to add two numbers

$
0
0

...without using the "send" command.

 

Once complete-gets the result from the calculator display and show it in a message box (this wont be the difficult part).  I just need it to simulate the clicks to add two numbers, but I've hit a total mental block and I'm fairly new to AutoIT.  I just commented out the very end where I got stuck so please excuse the sloppiness lol.  At that point I was just writing in things to try and refresh any memory I have of coding. Thanks a ton in advance for any assistance..

AutoIt         
  1. ; Asks user for first number in the adding equation
  2.  
  3. Local $iNum1 = InputBox('Adding!', 'Enter your first number')
  4.  
  5. ; Validates input is a positive integer
  6. If $iNum1 < 0 Then
  7.     MsgBox(0, 'Error', 'Please enter a valid positive integer')
  8.  
  9. ; Asks user for second number in the adding equation
  10.  
  11. Local $iNum2 = InputBox('Adding!', 'Enter your second number')
  12.  
  13. ; Validates input is a positive integer
  14. If $iNum2 < 0 Then
  15.     MsgBox(0, 'Error', 'Please enter a valid positive integer')
  16.  
  17. ; Calculates the two inputs without using "send" command
  18.  
  19. Run('calc.exe', @SystemDir)
  20. WinWaitActive('Calculator')
  21.  
  22. ControlClick('Calculator', '', '130')
  23. ControlClick('Calculator', '', '131')
  24. ControlClick('Calculator', '', '132')
  25. ControlClick('Calculator', '', '133')
  26. ControlClick('Calculator', '', '134')
  27. ControlClick('Calculator', '', '135')
  28. ControlClick('Calculator', '', '136')
  29. ControlClick('Calculator', '', '137')
  30. ControlClick('Calculator', '', '138')
  31. ControlClick('Calculator', '', '139')
  32.  
  33. #cs
  34.  
  35. $x = $iNum1
  36.  
  37. $z = StringLen($x)
  38.  
  39. For $iNum1 = 0 to $z
  40.     Case 1
  41.    
  42.    

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>