kkelley Posted June 18, 2014 Share Posted June 18, 2014 Here in my code, the program is opening an .exe entering a username, password, taking a screen shot, processing that screenshot through MODI, finding the word "Study" and clicking it. In my GUI interface I have three items in the combo box; Study|Practice|Certify. If study is selected I would like it to take a screen shot then process it through MODI and click on the word "Study", that goes the same for either "Practice" or "Certify". I cannot get my If statement to work on line 57, I am not sure if this is the best way to express it. I am new to Autoit so any information would be great. Thanks for your time!! expandcollapse popup#include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include "utils.au3" $consoleGUI = GUICreate("Console Launcher", 418, 251, 433, 177) GUISetBkColor(0xFF0000) $userLabel = GUICtrlCreateLabel("User Name", 56, 23, 100, 22) GUICtrlSetFont(-1, 12, 800, 0, "Algerian") $passwordLabel = GUICtrlCreateLabel("Password", 56, 71, 94, 22) GUICtrlSetFont(-1, 12, 800, 0, "Algerian") $activityLabel = GUICtrlCreateLabel("Select Activity", 56, 119, 148, 22) GUICtrlSetFont(-1, 12, 800, 0, "Algerian") $userInput = GUICtrlCreateInput("", 56, 47, 313, 21) $passwordInput = GUICtrlCreateInput("", 56, 95, 313, 21) $activitySelect = GUICtrlCreateCombo("", 56, 143, 313, 25) GUICtrlSetData(-1, "Study|Practice|Certify", "Study") $continueButton = GUICtrlCreateButton("Continue", 56, 184, 99, 25, $WS_GROUP) GUICtrlSetFont(-1, 12, 800, 0, "Algerian") GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetBkColor(-1, 0x000000) $exitButton = GUICtrlCreateButton("Exit", 296, 184, 75, 25, $WS_GROUP) GUICtrlSetFont(-1, 12, 800, 0, "Algerian") GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetBkColor(-1, 0x000000) GUISetState(@SW_SHOW) Global $count While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $continueButton ;Converting the input boxes so they can be used. $user=GUICtrlRead($userInput) $pwd=GUICtrlRead($passwordInput) $activity=GUICtrlRead($activitySelect) ShellExecute("C:\Certiport\iQsystem\CertiportConsole.exe") Sleep(5000) Send($user) Send("{TAB}") Sleep(1000) Send($pwd) Send("{ENTER}") Sleep(5000) ;Clicking Study/Practice/Certify _ScreenCapture_Capture("C:\TEMP\real(" & $count & ").tif", 0, 0, -1, -1, False) _LoadImage("C:\TEMP\real(" & $count & ").tif") $xyStudy=_FindText("Study", True) Sleep(5000) If $activity == "Practice" Then _ScreenCapture_Capture("C:\TEMP\real(" & $count & ").tif", 0, 0, -1, -1, False) _LoadImage("C:\TEMP\real(" & $count & ").tif") $xyStudy=_FindText("Practice", True) Sleep(5000) EndIf Case $GUI_EVENT_CLOSE, $exitButton Exit EndSwitch WEnd Link to comment Share on other sites More sharing options...
Solution kkelley Posted June 18, 2014 Author Solution Share Posted June 18, 2014 I have figured it out! here is the code expandcollapse popup#include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include "utils.au3" $consoleGUI = GUICreate("Console Launcher", 418, 251, 433, 177) GUISetBkColor(0xFF0000) $userLabel = GUICtrlCreateLabel("User Name", 56, 23, 100, 22) GUICtrlSetFont(-1, 12, 800, 0, "Algerian") $passwordLabel = GUICtrlCreateLabel("Password", 56, 71, 94, 22) GUICtrlSetFont(-1, 12, 800, 0, "Algerian") $activityLabel = GUICtrlCreateLabel("Select Activity", 56, 119, 148, 22) GUICtrlSetFont(-1, 12, 800, 0, "Algerian") $userInput = GUICtrlCreateInput("", 56, 47, 313, 21) $passwordInput = GUICtrlCreateInput("", 56, 95, 313, 21) $activitySelect = GUICtrlCreateCombo("", 56, 143, 313, 25) GUICtrlSetData(-1, "Study|Practice|Certify", "Study") $continueButton = GUICtrlCreateButton("Continue", 56, 184, 99, 25, $WS_GROUP) GUICtrlSetFont(-1, 12, 800, 0, "Algerian") GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetBkColor(-1, 0x000000) $exitButton = GUICtrlCreateButton("Exit", 296, 184, 75, 25, $WS_GROUP) GUICtrlSetFont(-1, 12, 800, 0, "Algerian") GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetBkColor(-1, 0x000000) GUISetState(@SW_SHOW) Global $count While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $continueButton ;Converting the input boxes so they can be used. $user=GUICtrlRead($userInput) $pwd=GUICtrlRead($passwordInput) $activity=GUICtrlRead($activitySelect) ExitLoop Case $GUI_EVENT_CLOSE, $exitButton Exit EndSwitch WEnd ShellExecute("C:\Certiport\iQsystem\CertiportConsole.exe") Sleep(5000) Send($user) Send("{TAB}") Sleep(1000) Send($pwd) Send("{ENTER}") Sleep(5000) ;Clicking Study/Practice/Certify _ScreenCapture_Capture("C:\TEMP\real(1).tif", 0, 0, -1, -1, False) _LoadImage("C:\TEMP\real(1).tif") $xyStudy=_FindText("Study", True) Sleep(5000) If $activity = "Study" Then _ScreenCapture_Capture("C:\TEMP\real(2).tif", 0, 0, -1, -1, False) _LoadImage("C:\TEMP\real(2).tif") $xyStudy=_FindText("Study", True) Sleep(5000) EndIf If $activity = "Practice" Then _ScreenCapture_Capture("C:\TEMP\real(2).tif", 0, 0, -1, -1, False) _LoadImage("C:\TEMP\real(2).tif") $xyPractice=_FindText("Practice", True) Sleep(5000) EndIf If $activity = "Certify" Then _ScreenCapture_Capture("C:\TEMP\real(2).tif", 0, 0, -1, -1, False) _LoadImage("C:\TEMP\real(2).tif") $xyCertify=_FindText("Certify", True) Sleep(5000) EndIf Link to comment Share on other sites More sharing options...
kkelley Posted June 18, 2014 Author Share Posted June 18, 2014 If you have any suggestions on any better methods or anything, please let me know! 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