wklw2010

Combox box \ ControlGetText

3 posts in this topic

#1 ·  Posted (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...

ProjectWizard()

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 by wklw2010

Share this post


Link to post
Share on other sites



Do you mean something like this?

ControlSetText("P&ID Project Setup", "", "[CLASS:WindowsForms10.EDIT.app.0.34f5582_r26_ad1; INSTANCE:1]", "\\Networkpath\" & $sComboRead)

Share this post


Link to post
Share on other sites
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...

Share this post


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