Jump to content

notsacc

Members
  • Posts

    1
  • Joined

  • Last visited

notsacc's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Hi, I'm new to AutoIt and I've been trying to write a simple script but I'm an idiot when it comes to this as I've never written any code before and have no background. At work, I have to interface with this piece of crap program and want to automate text entries and button clicks using a simple GUI. I need to be able to hit a series of hotkeys (or click the GUI buttons) and, when I'm ready, hit a button or final hotkey which will execute the clicks and text sends. The number of buttons I click varies, sometimes 2, sometimes 10. What I had envisioned was to hotkey each button, and each hotkey was linked to a simple function that would move the mouse around and enter the text I need to enter. What happens now is that once the GUI launches, as soon as I hit the button or hotkey, it executes. I need it to queue up several buttons then execute them sequentially in the order I have pressed them but I'm far too stupid to figure out how to do this without some help. Once you've seen the really basic, redundant, (probably broken?) code I've written below you'll understand what you're dealing with, but thanks in advance for the help. #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> Opt("GUIOnEventMode", 1) Local $hGUI = GUICreate("Window", 600, 500, -1, -1) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEButton") Local $hButton1 = GUICtrlCreateButton("Chicken", 150, 50, 114, 92) GUICtrlSetOnEvent($hButton1, "_Chick") Local $hButton2 = GUICtrlCreateButton("Toast", 270, 50, 114, 92) GUICtrlSetOnEvent($hButton2, "_Toast") Local $hButton3 = GUICtrlCreateButton("Ice", 150, 150, 114, 92) GUICtrlSetOnEvent($hButton3, "_Ice") Local $hButton4 = GUICtrlCreateButton("Moon", 270, 150, 114, 92) GUICtrlSetOnEvent($hButton4, "_Moon") Local $hButton5 = GUICtrlCreateButton("Blue", 150, 250, 114, 92) GUICtrlSetOnEvent($hButton5, "_Blue") Local $hButton6 = GUICtrlCreateButton("Write", 390, 350, 114, 92) GUICtrlSetOnEvent($hButton6, "_Write") Local $aAccelKeys[6][6] = [["{F1}", $hButton1],["{F2}", $hButton2],["{F3}", $hButton3],["{F4}", $hButton4],["{F5}", $hButton5]] GUISetAccelerators($aAccelKeys) GUISetState(@SW_SHOW, $hGUI) While 1 Sleep(100) WEnd ;Need code that records the buttons clicks from above, in the order that they are pressed, then after the user hits the Write button, executes the Functions(mouseclicks and text sends) corresponding to those buttons. ;the user may not hit all the buttons every time, just maybe 2, then clicks write, 4 then clicks write Func _Exit() Sleep(100) Exit EndFunc Func _Chick() MouseClick("left",60,87,1) MouseClick("left",380,157,1) Send("asdfad") MouseClick("left",315,56,1) MouseClick("left",380,156,1) Send("asdfad") MouseClick("left",380,156,1) EndFunc Func _Toast() MouseClick("left",60,87,1) MouseClick("left",380,157,1) Send("toasttoast") EndFunc Func _Ice() MouseClick("left",60,87,1) MouseClick("left",380,157,1) Send("iceice") EndFunc Func _Moon() MouseClick("left",60,87,1) MouseClick("left",380,157,1) Send("moonmoon") EndFunc Func _Blue() MouseClick("left",60,87,1) MouseClick("left",380,157,1) Send("blueblue") EndFunc Func _Write() ; EndFunc
×
×
  • Create New...