wklw2010 Posted January 16, 2017 Share Posted January 16, 2017 (edited) Afternoon, I am working to automate a executable that will be run on a few machines. I am trying to have a combo box start the script so the users can choose different project options. Once the option is picked, I need to gettext or readtext on the controlsettext: ControlSetText("P&ID Project Setup", "", "[CLASS:WindowsForms10.EDIT.app.0.34f5582_r26_ad1; INSTANCE:1]", "\\Networkpath\project\WWW") from the combo box choice. Can someone please help me out... expandcollapse popupProjectWizard() Func ProjectWizard() ; Create a GUI with various controls. Local $hGUI = GUICreate("P&ID ProjectWizard", 270, 100) ; Create a combobox control. Local $idComboBox = GUICtrlCreateCombo("", 10, 10, 165, 20) ; Add additional items to the combobox. GUICtrlSetData($idComboBox, "WWW|FFF|VVV|GGG", "") ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) Local $sComboRead = "" ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idClose ExitLoop Case $idComboBox $sComboRead = GUICtrlRead($idComboBox) MsgBox($MB_SYSTEMMODAL, "", "P&ID Project: " & $sComboRead, 0, $hGUI) If not FileExists ("C:\Program Files\AVEVA\P&ID 12.1.SP3\Install\Exe\AVEVA.PID.AppLaunch.exe") Then #Region --- CodeWizard generated code Start --- ;MsgBox features: Title=No, Text=Yes, Buttons=OK, Icon=None MsgBox(0,"","P&ID ProjectWizard Error") #EndRegion --- CodeWizard generated code End --- EndIf If FileExists ("C:\Program Files\AVEVA\P&ID 12.1.SP3\Install\Exe\AVEVA.PID.AppLaunch.exe") Then Run("C:\Program Files\AVEVA\P&ID 12.1.SP3\Install\Exe\AVEVA.PID.AppLaunch.exe") WinWaitActive ( "AVEVA Login" , "" ) ControlClick("AVEVA Login", "", "[CLASS:WindowsForms10.Window.8.app.0.141b42a_r26_ad1; INSTANCE:14]", "left", 1, 70, 68) ;ControlClick("AVEVA Login", "", "[CLASS:WindowsForms10.EDIT.app.0.141b42a_r26_ad1; INSTANCE:2]", "left", 1, 28, 15) WinWaitActive ( "AVEVA Login" , "" ) ControlSetText("AVEVA Login", "", "[CLASSNN:WindowsForms10.EDIT.app.0.141b42a_r26_ad11; INSTANCE:1]", "Password") ;ControlSetText("AVEVA Login", "", "[CLASS:WindowsForms10.EDIT.app.0.141b42a_r26_ad1; INSTANCE:1]", "Password") WinWaitActive ( "AVEVA Login" , "" ) ControlClick("AVEVA Login", "", "[Class:WindowsForms10.BUTTON.app.0.141b42a_r26_ad1; INSTANCE:8]", "left", 1, 15, 11) Sleep(2000) WinWaitActive ( "P&ID Project Setup" , "" ) ControlClick("P&ID Project Setup", "", "[ClassNN:WindowsForms10.BUTTON.app.0.34f5582_r26_ad12; INSTANCE:2]", "left", 1, 34, 16) WinWaitActive ( "P&ID Project Setup" , "" ) ControlSetText("P&ID Project Setup", "", "[CLASS:WindowsForms10.EDIT.app.0.34f5582_r26_ad1; INSTANCE:1]", "C:\Program Files\Autodesk\AutoCAD 2016") WinWaitActive ( "P&ID Project Setup" , "" ) ControlClick("P&ID Project Setup", "", "[Class:WindowsForms10.BUTTON.app.0.34f5582_r26_ad1; INSTANCE:6]", "left", 1, 10, 8) WinWaitActive ( "P&ID Project Setup" , "" ) ControlClick("P&ID Project Setup", "", "[Class:WindowsForms10.BUTTON.app.0.34f5582_r26_ad1; INSTANCE:2]", "left", 1, 36, 14) WinWaitActive ( "P&ID Project Setup" , "" ) ControlClick("P&ID Project Setup", "", "[Class:WindowsForms10.BUTTON.app.0.34f5582_r26_ad1; INSTANCE:6]", "left", 1, 33, 10) WinWaitActive ( "P&ID Project Setup" , "" ) ControlClick("P&ID Project Setup", "", "[Class:WindowsForms10.BUTTON.app.0.34f5582_r26_ad1; INSTANCE:2]", "left", 1, 33, 18) WinWaitActive ( "P&ID Project Setup" , "" ) ControlSetText("P&ID Project Setup", "", "[CLASS:WindowsForms10.EDIT.app.0.34f5582_r26_ad1; INSTANCE:3]", "avevasql") WinWaitActive ( "P&ID Project Setup" , "" ) ControlClick("P&ID Project Setup", "", "[Class:WindowsForms10.BUTTON.app.0.34f5582_r26_ad1; INSTANCE:2]", "left", 1, 35, 16) WinWaitActive ( "P&ID Project Setup" , "" ) ControlClick("P&ID Project Setup", "", "[Class:WindowsForms10.BUTTON.app.0.34f5582_r26_ad1; INSTANCE:2]", "left", 1, 38, 15) I need his controlSettext to read the combo choice and set the network path.... WinWaitActive ( "P&ID Project Setup" , "" ) ControlSetText("P&ID Project Setup", "", "[CLASS:WindowsForms10.EDIT.app.0.34f5582_r26_ad1; INSTANCE:1]", "\\Networkpath\") WinWaitActive ( "P&ID Project Setup" , "" ) ControlClick("P&ID Project Setup", "", "[Class:WindowsForms10.BUTTON.app.0.34f5582_r26_ad1; INSTANCE:2]", "left", 1, 39, 15) WinWaitActive ( "P&ID Project Setup" , "" ) ControlClick("P&ID Project Setup", "", "[Class:WindowsForms10.BUTTON.app.0.34f5582_r26_ad1; INSTANCE:2]", "left", 1, 34, 17) WinWaitActive ( "P&ID Project Setup" , "" ) ControlClick("P&ID Project Setup", "", "[Class:WindowsForms10.BUTTON.app.0.34f5582_r26_ad1; INSTANCE:2]", "left", 1, 37, 16) Sleep(500) #Region --- CodeWizard generated code Start --- ;MsgBox features: Title=No, Text=Yes, Buttons=OK, Icon=None MsgBox(0,"","P&ID ProjectWizard Completed") #EndRegion --- CodeWizard generated code End --- EndIf EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc Edited January 16, 2017 by wklw2010 Link to comment Share on other sites More sharing options...
Subz Posted January 17, 2017 Share Posted January 17, 2017 Do you mean something like this? ControlSetText("P&ID Project Setup", "", "[CLASS:WindowsForms10.EDIT.app.0.34f5582_r26_ad1; INSTANCE:1]", "\\Networkpath\" & $sComboRead) Link to comment Share on other sites More sharing options...
wklw2010 Posted January 17, 2017 Author Share Posted January 17, 2017 11 hours ago, Subz said: Do you mean something like this? ControlSetText("P&ID Project Setup", "", "[CLASS:WindowsForms10.EDIT.app.0.34f5582_r26_ad1; INSTANCE:1]", "\\Networkpath\" & $sComboRead) Thanks for the help. that's what I was thinking... 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