Jump to content

Recommended Posts

I have a windows 10 pc and Im trying to create an automatic solving in calculator with a simple worded question (example: What is 45 x 53 ?). thou I cant make the select...Case...EndSelect statement work, here is my code

#include <AutoItConstants.au3>


HotKeySet("{F4}", "ExitProg")

Func ExitProg()
   Exit 0
EndFunc

MouseClick($MOUSE_CLICK_LEFT, 417, 659, 2, 1)
Send("^c")

Func valData()
   $Chek = "What "
   If ClipGet() == $Chek Then
      Check()
      Else
      Do
         MouseClick($MOUSE_CLICK_LEFT, 417, 659, 2, 3)
         Send("^c")
         Sleep(500)
      Until ClipGet() == $Chek

   EndIf
EndFunc

Func Check()
   $Chek2 = "?"
   c1()
   c2()
   c3()
   c4()
   c5()
   c6()
   c7()

   Select
      Case c1() = $Chek2
      ;two
         MouseClick($MOUSE_CLICK_LEFT, 453, 645, 2, 1)
         Send("^c")
         Sleep(150)
         MouseClick($MOUSE_CLICK_LEFT, 1347, 197, 1, 1)
         Send("^v")
         Sleep(150)
         MouseClick($MOUSE_CLICK_LEFT, 474, 645, 2, 1)
         Send("^c")
         Sleep(150)
         MouseClick($MOUSE_CLICK_LEFT, 1347, 197, 1, 1)
         Send("*")
         Send("^v")
         Send("{NUMPADENTER}")
      Case c2() = $Chek2
      ;three
         MouseClick($MOUSE_CLICK_LEFT, 453, 645, 2, 1)
         Send("^c")
         Sleep(150)
         MouseClick($MOUSE_CLICK_LEFT, 1347, 197, 1, 1)
         Send("^v")
         Sleep(150)
         MouseClick($MOUSE_CLICK_LEFT, 482, 645, 2, 1)
         Send("^c")
         Sleep(150)
         MouseClick($MOUSE_CLICK_LEFT, 1347, 197, 1, 1)
         Send("*")
         Send("^v")
         Send("{NUMPADENTER}")
      Case c3() = $Chek2
      ;four
         MouseClick($MOUSE_CLICK_LEFT, 453, 645, 2, 1)
         Send("^c")
         Sleep(150)
         MouseClick($MOUSE_CLICK_LEFT, 1347, 197, 1, 1)
         Send("^v")
         Sleep(150)
         MouseClick($MOUSE_CLICK_LEFT, 487, 645, 2, 1)
         Send("^c")
         Sleep(150)
         MouseClick($MOUSE_CLICK_LEFT, 1347, 197, 1, 1)
         Send("*")
         Send("^v")
         Send("{NUMPADENTER}")
      Case c4() = $Chek2
      ;five
         MouseClick($MOUSE_CLICK_LEFT, 453, 645, 2, 1)
         Send("^c")
         Sleep(150)
         MouseClick($MOUSE_CLICK_LEFT, 1347, 197, 1, 1)
         Send("^v")
         Sleep(150)
         MouseClick($MOUSE_CLICK_LEFT, 495, 645, 2, 1)
         Send("^c")
         Sleep(150)
         MouseClick($MOUSE_CLICK_LEFT, 1347, 197, 1, 1)
         Send("*")
         Send("^v")
         Send("{NUMPADENTER}")
      Case c5() = $Chek2
      ;six
         MouseClick($MOUSE_CLICK_LEFT, 453, 645, 2, 1)
         Send("^c")
         Sleep(150)
         MouseClick($MOUSE_CLICK_LEFT, 1347, 197, 1, 1)
         Send("^v")
         Sleep(150)
         MouseClick($MOUSE_CLICK_LEFT, 495, 645, 2, 1)
         Send("^c")
         Sleep(150)
         MouseClick($MOUSE_CLICK_LEFT, 1347, 197, 1, 1)
         Send("*")
         Send("^v")
         Send("{NUMPADENTER}")
      Case c6() = $Chek2
      ;seven
         MouseClick($MOUSE_CLICK_LEFT, 453, 645, 2, 1)
         Send("^c")
         Sleep(150)
         MouseClick($MOUSE_CLICK_LEFT, 1347, 197, 1, 1)
         Send("^v")
         Sleep(150)
         MouseClick($MOUSE_CLICK_LEFT, 509, 645, 2, 1)
         Send("^c")
         Sleep(150)
         MouseClick($MOUSE_CLICK_LEFT, 1347, 197, 1, 1)
         Send("*")
         Send("^v")
         Send("{NUMPADENTER}")
      Case c7() = $Chek2
      ;eight
         MouseClick($MOUSE_CLICK_LEFT, 453, 645, 2, 1)
         Send("^c")
         Sleep(150)
         MouseClick($MOUSE_CLICK_LEFT, 1347, 197, 1, 1)
         Send("^v")
         Sleep(150)
         MouseClick($MOUSE_CLICK_LEFT, 509, 645, 2, 1)
         Send("^c")
         Sleep(150)
         MouseClick($MOUSE_CLICK_LEFT, 1347, 197, 1, 1)
         Send("*")
         Send("^v")
         Send("{NUMPADENTER}")
      Case Else
         Exit
   EndSelect
EndFunc

Func c1()
   MouseClick($MOUSE_CLICK_LEFT, 485, 643, 2, 1)
   Send("^c")
EndFunc

Func c2()
   MouseClick($MOUSE_CLICK_LEFT, 493, 644, 2, 1)
   Send("^c")
EndFunc

Func c3()
   MouseClick($MOUSE_CLICK_LEFT, 498, 645, 2, 1)
   Send("^c")
EndFunc

Func c4()
   MouseClick($MOUSE_CLICK_LEFT, 508, 647, 2, 1)
   Send("^c")
EndFunc

Func c5()
   MouseClick($MOUSE_CLICK_LEFT, 514, 645, 2, 1)
   Send("^c")
EndFunc

Func c6()
    MouseClick($MOUSE_CLICK_LEFT, 523, 645, 2, 1)
    Send("^c")
EndFunc

Func c7()
   MouseClick($MOUSE_CLICK_LEFT, 530, 645, 2, 1)
   Send("^c")
EndFunc

valData()
MouseClick($MOUSE_CLICK_LEFT, 1349, 196, 1, 1) ;clicking the answer in calc
Send("^c")
Send("{DEL}")
MouseClick($MOUSE_CLICK_LEFT, 499, 706, 1, 1)
Send("^v")
Exit

 

Edited by Melba23
Added code tags
Link to post
Share on other sites

None of your functions have a return value, so none of your Select cases are valid. Working as intended, use some type of Return value from the functions and see if it works then.

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 Gude
How 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 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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Zaoka
      HI,
      for couple of years I'm using  Jos script for sending reports, email with excel attachment. But from last week i'm getting this error when sending excel or word attachment
      message has lines too long for transport jpeg, pdf works with no problems, any sugestion ?
    • By diepfeile
      I'm using the following:
      Autoit 3.3.14.5
      newly installed Beta 3.3.15.5
      SQlite version 3380000 aka 3.38.0
      I put sqlite3.dll and sqlite3_x64.dll in C:\Windows\System32 since many scripts depend on them.


      I extended the output of _SQLite_Startup()
      with:
      ConsoleWrite("@AutoItX64 " & @AutoItX64 & @CRLF) ConsoleWrite("$sDll_Filename " & $sDll_Filename & @CRLF) ConsoleWrite("_SQLite_LibVersion=" & _SQLite_LibVersion() & @CRLF)

      Also using the script from https://www.autoitscript.com/autoit3/docs/libfunctions/_SQLite_Startup.htm for testing.

       
      >Running:(3.3.14.5):C:\Program Files (x86)\AutoIt3\autoit3.exe "R:\Download\aasdf.au3" @AutoItX64 0 $sDll_Filename sqlite3.dll _SQLite_LibVersion=0 >Running:(3.3.14.5):C:\Program Files (x86)\AutoIt3\autoit3_x64.exe "R:\Download\aasdf.au3" @AutoItX64 1 $sDll_Filename sqlite3_x64.dll _SQLite_LibVersion=3.38.0 >Running:(3.3.15.5):C:\Program Files (x86)\AutoIt3\Beta\autoit3.exe "R:\Download\aasdf.au3" @AutoItX64 0 $sDll_Filename sqlite3.dll _SQLite_LibVersion=0 >Running:(3.3.15.5):C:\Program Files (x86)\AutoIt3\Beta\autoit3_x64.exe "R:\Download\aasdf.au3" @AutoItX64 1 $sDll_Filename sqlite3_x64.dll _SQLite_LibVersion=3.38.0


      Why doesn't it work in 32bit, despite me having the 32bit sqlite.dll? Autoit urges running scripts in 32bit mode and Scite starts scripts just in 32bit mode without the flag?
      With #AutoIt3Wrapper_UseX64=Y it just works, both normal Autoit and beta!
      sqlite3.dll sqlite3_x64.dll
    • By Iraj
      Hello Team, Greetings!
      Is there any way to run any 3rd party application silently in background without the GUI getting in the front ?
      I was implementing angry-ip scanner with autoit & wanted the angry-ip application to run in background quietly as I am copying its output to other file on completion. is there any way to achieve my query?
      Below is code I tried: 
      $range = "192.168.0.1 192.168.0.255" ShellExecuteWait("C:\Windows\DDM\ipscan.exe","-f:range "&$iprange&" -q -o C:\temp\ScanResults.csv","","open",@SW_HIDE) Thanks!
    • By PeterVerbeek
      This topic give you access to an AutoIt functions library I maintain which is called PAL, Peter's AutoIt Library. The latest version 1.26 contains 214 functions divided into these topics:
      window, desktop and monitor GUI, mouse and color GUI controls including graphical buttons (jpg, png) logics and mathematics include constants string, xml string and file string dialogues and progress bars data lists: lists, stacks, shift registers and key maps (a.ka. dictionaries) miscellaneous: logging/debugging, process and system info Change log and files section  on the PAL website (SourceForge).
      A lot of these functions were created in the development of Peace, Peter's Equalizer APO Configuration Extension, which is a user interface for the system-wide audio driver called Equalizer APO.
    • By mLipok
      Usually when I collect data from DataBase I need to give EndUser a possibility to select rows which should be taken in the processing loop.
      I was searching on the forum and I'm not able to find any UDF or even example of how to select data from array.
      I have my own solutions but I think they are not worth posting on the forum as it is very old code and I am looking for a better solution.

      Could anybody point me to some examples/solutions ?

      Thank you in advance.
      @mLipok
×
×
  • Create New...