Stormgrade

@GUI_CTRLID mess with my switch

6 posts in this topic

Hello,

I need some help with my gui, when I click on button 2 it call a MsgBox 2, but when I click on button 1 then button 2 it call a MsgBox 1.

I tear appart my code to minimal function then the error occur again ...

Here the script :

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseX64=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#cs ----------------------------------------------------------------------------

 AutoIt Version : 3.3.14.0
 Auteur:

 Fonction du Script :
    Modèle de Script AutoIt.

#ce ----------------------------------------------------------------------------

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>


Opt("GUIOnEventMode", 1);important pour gérer les fonctions et les gui

Global $GUI1
Global $GUI1_Label1, $GUI1_Label2
Global $GUI1_Input1, $GUI1_Input2
Global $GUI1_Bouton1, $GUI1_Bouton2, $GUI1_Bouton3

Global $GUI2 = 9999
Global $GUI2_Label1 = 9999, $GUI2_Label2 = 9999, $GUI2_Label3 = 9999
Global $GUI2_Input1 = 9999, $GUI2_Input2 = 9999, $GUI2_Input3 = 9999
Global $GUI2_Bouton1 = 9999
Global $GUI2_Checkbox1 = 9999

Global $GUI3 = 9998, $GUI3_Input1 = 9998, $GUI3_Label1 = 9998, $GUI3_Bouton1 = 9998

Global $GUI4 = 9997
Global $GUI4_List1 = 9997
Global $GUI4_Bouton1 = 9997, $GUI4_Bouton2 = 9997, $GUI4_Bouton3 = 9997, $GUI4_Bouton4 = 9997, $GUI4_Bouton5 = 9997, $GUI4_Bouton6 = 9997, $GUI4_Bouton7 = 9997

Global $GUI9 = 5689
Global $GUI9_Input1 = 5689, $GUI9_Input2 = 5689, $GUI9_Input3 = 5689, $GUI9_Input4 = 5689
Global $GUI9_Label1 = 5689, $GUI9_Label2 = 5689, $GUI9_Label3 = 5689, $GUI9_Label4 = 5689
Global $GUI9_Bouton1 = 5689

Global $GUI6 = 9995
Global $GUI6_Label1 = 9995, $GUI6_Label2 = 9995, $GUI6_Label3 = 9995
Global $GUI6_Input1 = 9995, $GUI6_Input2 = 9995, $GUI6_Input3 = 9995
Global $GUI6_Bouton1 = 9995
Global $GUI6_Checkbox1 = 9995

Global $GUI7 = 9994
Global $GUI7_Label1 = 9994, $GUI7_Label2 = 9994, $GUI7_Label3 = 9994
Global $GUI7_Input1 = 9994, $GUI7_Input2 = 9994, $GUI7_Input3 = 9994
Global $GUI7_Bouton1 = 9994, $GUI7_Bouton2 = 9994, $GUI7_Bouton3 = 9994
Global $GUI7_Checkbox1 = 9994


Global $MyQuery, $MyQueryRow
Global $TempDataEncryptage, $TempDataDecryptage
Global $Input1_Read, $Input2_Read, $Input3_Read, $Input4_Read
Global $aSQLResult, $iRows, $iColumns, $iRval
Global $GUI4_List1_Indice, $GUI4_List1_Item


GUI1_Principal()

Func GUI1_Principal();fenêtre principale
    $GUI1 = GUICreate("Password Manager", 266, 120, 786, 412)
    GUISetOnEvent($GUI_EVENT_CLOSE, "On_Close")

    $GUI1_Label1 = GUICtrlCreateLabel("Login", 24, 12, 30, 18)
    $GUI1_Label2 = GUICtrlCreateLabel("Password", 8, 44, 50, 18)

    $GUI1_Bouton1 = GUICtrlCreateButton("OUVRIR", 192, 8, 58, 58)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    GUICtrlSetOnEvent(-1, "On_Button")
    $GUI1_Bouton2 = GUICtrlCreateButton("Change Password", 144, 72, 114, 34)
    GUICtrlSetOnEvent(-1, "On_Button")
    $GUI1_Bouton3 = GUICtrlCreateButton("Change Login", 8, 72, 114, 34)
    GUICtrlSetOnEvent(-1, "On_Button")

    $GUI1_Input1 = GUICtrlCreateInput("", 64, 8, 114, 22)
    $GUI1_Input2 = GUICtrlCreateInput("", 64, 40, 114, 22)

    GUISetState()

    While 1
        Sleep(10)
    WEnd
EndFunc   ;==>GUI1_Principal

Func GUI2_change_password();changer mot de passe
    $GUI2 = GUICreate("Change Password", 284, 152, 721, 395)
    GUISetOnEvent($GUI_EVENT_CLOSE, "On_Close")

    $GUI2_Label1 = GUICtrlCreateLabel("Last Password", 8, 12, 74, 18)
    $GUI2_Label2 = GUICtrlCreateLabel("New Password", 8, 44, 76, 18)
    $GUI2_Label3 = GUICtrlCreateLabel("Check Password", 8, 76, 84, 18)

    $GUI2_Input1 = GUICtrlCreateInput("", 120, 8, 154, 22)
    $GUI2_Input2 = GUICtrlCreateInput("", 120, 40, 154, 22)
    $GUI2_Input3 = GUICtrlCreateInput("", 120, 72, 154, 22)

    $GUI2_Bouton1 = GUICtrlCreateButton("VALIDATE", 136, 104, 114, 34)
    GUICtrlSetOnEvent(-1, "On_Button")

    $GUI2_Checkbox1 = GUICtrlCreateCheckbox("Display Password", 8, 112, 114, 18)
    GUICtrlSetOnEvent(-1, "On_Checkbox")

    GUISetState()
EndFunc ;=>GUI2_change_password

Func GUI3_change_login();changer login
    $GUI3 = GUICreate("Change Login", 240, 102, 674, 392)
    GUISetOnEvent($GUI_EVENT_CLOSE, "On_Close")

    $GUI3_Input1 = GUICtrlCreateInput("", 88, 16, 114, 22)

    $GUI3_Label1 = GUICtrlCreateLabel("New Login", 16, 20, 56, 18)

    $GUI3_Bouton1 = GUICtrlCreateButton("VALIDATE", 88, 48, 114, 34)
    GUICtrlSetOnEvent(-1, "On_Button")

    GUISetState()
EndFunc ;=>GUI3_change_login

Func GUI4_Manager();manager
    $GUI4 = GUICreate("Password Manager", 528, 282, 690, 294)
    GUISetOnEvent($GUI_EVENT_CLOSE, "On_Close")


    $GUI4_List1 = GUICtrlCreateListView("", 16, 16, 426, 188)

    $GUI4_Bouton1 = GUICtrlCreateButton("Add Entry", 16, 216, 98, 50)
    GUICtrlSetOnEvent(-1, "On_Button")
    $GUI4_Bouton2 = GUICtrlCreateButton("Modify Entry", 120, 216, 98, 50)
    GUICtrlSetOnEvent(-1, "On_Button")
    $GUI4_Bouton3 = GUICtrlCreateButton("Delete Entry", 232, 216, 98, 50)
    GUICtrlSetOnEvent(-1, "On_Button")
    $GUI4_Bouton4 = GUICtrlCreateButton("View", 344, 216, 98, 50)
    GUICtrlSetOnEvent(-1, "On_Button")
    $GUI4_Bouton5 = GUICtrlCreateButton("Trie A/z", 464, 16, 50, 50)
    GUICtrlSetOnEvent(-1, "On_Button")
    $GUI4_Bouton6 = GUICtrlCreateButton("Trie Z/a", 464, 152, 50, 50)
    GUICtrlSetOnEvent(-1, "On_Button")
    $GUI4_Bouton7 = GUICtrlCreateButton("PG", 464, 84, 49, 49)
    GUICtrlSetOnEvent(-1, "On_Button")

    GUISetState()
EndFunc ;=>GUI4_Manager

Func GUI5_Add();add entry
    $GUI9 = GUICreate("Add an entry", 304, 192, 666, 358)
    GUISetOnEvent($GUI_EVENT_CLOSE, "On_Close")

    $GUI9_Input1 = GUICtrlCreateInput("", 112, 16, 178, 22)
    $GUI9_Input2 = GUICtrlCreateInput("", 112, 48, 178, 22)
    $GUI9_Input3 = GUICtrlCreateInput("", 112, 80, 178, 22)
    $GUI9_Input4 = GUICtrlCreateInput("", 112, 112, 178, 22)

    $GUI9_Label1 = GUICtrlCreateLabel("Name", 8, 20, 32, 18)
    $GUI9_Label2 = GUICtrlCreateLabel("Login", 8, 52, 30, 18)
    $GUI9_Label3 = GUICtrlCreateLabel("Password", 8, 84, 50, 18)
    $GUI9_Label4 = GUICtrlCreateLabel("Retape Password", 8, 116, 88, 18)

    $GUI9_Bouton1 = GUICtrlCreateButton("Validate", 112, 144, 114, 34); <================== problem
    GUICtrlSetOnEvent($GUI9_Bouton1, "On_Button")

    GUISetState()
EndFunc ;=>GUI5_Add

Func GUI6_MOD();mod entry
    $GUI6 = GUICreate("Modify Entry", 288, 166, 572, 306)
    GUISetOnEvent($GUI_EVENT_CLOSE, "On_Close")

    $GUI6_Label1 = GUICtrlCreateLabel("Name", 8, 20, 32, 18)
    $GUI6_Label2 = GUICtrlCreateLabel("Login", 8, 52, 30, 18)
    $GUI6_Label3 = GUICtrlCreateLabel("Password", 8, 84, 50, 18)

    $GUI6_Input1 = GUICtrlCreateInput("", 80, 16, 194, 22)
    $GUI6_Input2 = GUICtrlCreateInput("", 80, 48, 194, 22)
    $GUI6_Input3 = GUICtrlCreateInput("", 80, 80, 194, 22)

    $GUI6_Bouton1 = GUICtrlCreateButton("Modify", 160, 120, 114, 34)
    GUICtrlSetOnEvent(-1, "On_Button")

    $GUI6_Checkbox1 = GUICtrlCreateCheckbox("Show Password", 40, 128, 100, 18)
    GUICtrlSetOnEvent(-1, "On_Checkbox")

    GUISetState()
EndFunc ;=>GUI6_MOD

Func GUI7_VIEW();view entry
    $GUI7 = GUICreate("View", 398, 112, 590, 298)
    GUISetOnEvent($GUI_EVENT_CLOSE, "On_Close")

    $GUI7_Label1 = GUICtrlCreateLabel("Name", 8, 12, 32, 18)
    $GUI7_Label2 = GUICtrlCreateLabel("Login", 8, 44, 30, 18)
    $GUI7_Label3 = GUICtrlCreateLabel("Password", 8, 76, 50, 17)

    $GUI7_Input1 = GUICtrlCreateInput("", 80, 8, 218, 22)
    $GUI7_Input2 = GUICtrlCreateInput("", 80, 40, 218, 22)
    $GUI7_Input3 = GUICtrlCreateInput("", 80, 72, 218, 22)

    $GUI7_Bouton1 = GUICtrlCreateButton("Copy", 312, 40, 66, 26)
    GUICtrlSetOnEvent(-1, "On_Button")
    $GUI7_Bouton2 = GUICtrlCreateButton("Copy", 312, 72, 66, 26)
    GUICtrlSetOnEvent(-1, "On_Button")
    $GUI7_Bouton3 = GUICtrlCreateButton("GO", 312, 6, 34, 26)
    GUICtrlSetOnEvent(-1, "On_Button")

    $GUI7_Checkbox1 = GUICtrlCreateCheckbox("", 360, 12, 16, 16)
    GUICtrlSetOnEvent(-1, "On_Checkbox")

    GUISetState()
EndFunc ;=>GUI7_VIEW

Func On_Button();gestion de tout les boutons
    Switch @GUI_CTRLID

        ;### Navigation ###
        Case $GUI1_Bouton1
            GUI4_Manager()


        Case $GUI1_Bouton2
            GUI2_change_password()
        Case $GUI1_Bouton3
            GUI3_change_login()
        Case $GUI4_Bouton1
            GUI5_Add()
        Case $GUI4_Bouton2
            GUI6_MOD()
        Case $GUI4_Bouton4

                GUI7_VIEW()


        ;#################

        Case $GUI2_Bouton1

        Case $GUI3_Bouton1


        Case $GUI9_Bouton1; <================== problem

                MsgBox(64,"Erreur de sécurité 5","Les mots de passe ================================= sont différents.",5)


        Case $GUI7_Bouton1
            ;_ClipBoard_SetData($Input2_Read,$CF_TEXT)
        Case $GUI7_Bouton2
            ;_ClipBoard_SetData($Input3_Read,$CF_TEXT)
        Case $GUI7_Bouton3
            If _IsValidURL($Input1_Read) = 1 Then
                ShellExecute($Input1_Read)
            Else
                MsgBox(64,"Erreur lien","L'URL ne semble pas valide.")
            EndIf

    EndSwitch
EndFunc ;=>On_Button

Func On_Checkbox();gestion des checkbox



EndFunc ;=>On_Checkbox

Func On_Close();gestion fermeture des fenêtres
    Switch @GUI_WINHANDLE
        Case $GUI1

            Exit
        Case $GUI2
            GUIDelete($GUI2)
        Case $GUI3
            GUIDelete($GUI3)
        Case $GUI4
            GUIDelete($GUI4)
        Case $GUI9
            GUIDelete($GUI9)
        Case $GUI6
            GUIDelete($GUI6)
        Case $GUI7
            GUIDelete($GUI7)
    EndSwitch
EndFunc ;=>On_Close


Func _IsValidURL($url)
    Local $IsValid = StringRegExp($url,"^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$")
    Return ($IsValid)
EndFunc ;=>_IsValidURL

 

 The error :

Run my script, click on "OUVRIR" then click on "View" and click on "GO" you get a message : "L'URL ne semble pas valide."

Now close the view menu, click on "Add entry" , close this menu , click on "View" and click on "GO" you get another message : "Les mots de passe ================================= sont différents."

This message must only appear when you click on "Validate" in the "Add entry" menu ....

I had the same problem on another PC with AutoIT 3.3.14.0

I've changed my variable, add another button , etc... The problem occur only with this two menus and this button.

Can you test it ? If you don't have this error perhaps my AutoIT package (installer form AutoIT fr) have a problem.

Thank you.

Share this post


Link to post
Share on other sites

Stormgrade,

The problem occurs because you are constantly creating and deleting GUIs and their controls. When you delete a control (such as by deleting the GUI that holds it) you leave an empty entry in the internal array that AutoIt uses to track the controls it creates - the index of a control in this array is the ControlID that is returned by the GUICtrlCreate* function.

So when you create one of your subsidiary GUIs the controls within it use the first available open entries in this array - and these indicies will be returned as ControlIDs. When you delete the GUI these entries are cleared, when you create the next GUI the controls will also use those entries and so have those ControlIDs - but the variables holding the ControlIDs of the now-deleted controls will still hold the same value, even though the control itself has been deleted. Then when you run your Switch, the first variable to match will fire - and in this  case it is one which refers to a deleted control.

The solution? Create all the GUIs just once at the beginning of the script and hide/show as required - or set all the variables used to store ControlIDs back to their placeholder values (as you do at the beginning of the script) when you delete a GUI. I know which is the simpler solution.

Please ask if anything is still unclear.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Thank you !!!!!!!!!!!

I set all the variables used to store ControlID in the "On_close" function like this :

Func On_Close();gestion fermeture des fenêtres
    Switch @GUI_WINHANDLE
        Case $GUI1
            Exit
        Case $GUI2
            GUIDelete($GUI2)
            $GUI2 = 9999
            $GUI2_Label1 = 9999
            $GUI2_Label2 = 9999
            $GUI2_Label3 = 9999
            $GUI2_Input1 = 9999
            $GUI2_Input2 = 9999
            $GUI2_Input3 = 9999
            $GUI2_Bouton1 = 9999
            $GUI2_Checkbox1 = 9999
        Case $GUI3
            GUIDelete($GUI3)
            $GUI3 = 9998
            $GUI3_Input1 = 9998
            $GUI3_Label1 = 9998
            $GUI3_Bouton1 = 9998
        Case $GUI4
            GUIDelete($GUI4)
            $GUI4 = 9997
            $GUI4_List1 = 9997
            $GUI4_Bouton1 = 9997
            $GUI4_Bouton2 = 9997
            $GUI4_Bouton3 = 9997
            $GUI4_Bouton4 = 9997
            $GUI4_Bouton5 = 9997
            $GUI4_Bouton6 = 9997
            $GUI4_Bouton7 = 9997

        Case $GUI9
            GUIDelete($GUI9)
            $GUI9 = 5689
            $GUI9_Input1 = 5689
            $GUI9_Input2 = 5689
            $GUI9_Input3 = 5689
            $GUI9_Input4 = 5689
            $GUI9_Label1 = 5689
            $GUI9_Label2 = 5689
            $GUI9_Label3 = 5689
             $GUI9_Label4 = 5689
            $GUI9_Bouton1 = 5689
        Case $GUI6
            GUIDelete($GUI6)
            $GUI6 = 9995
            $GUI6_Label1 = 9995
            $GUI6_Label2 = 9995
            $GUI6_Label3 = 9995
            $GUI6_Input1 = 9995
            $GUI6_Input2 = 9995
            $GUI6_Input3 = 9995
            $GUI6_Bouton1 = 9995
            $GUI6_Checkbox1 = 9995
        Case $GUI7
            GUIDelete($GUI7)
            $GUI7 = 9994
             $GUI7_Label1 = 9994
             $GUI7_Label2 = 9994
            $GUI7_Label3 = 9994
            $GUI7_Input1 = 9994
            $GUI7_Input2 = 9994
            $GUI7_Input3 = 9994
            $GUI7_Bouton1 = 9994
            $GUI7_Bouton2 = 9994
            $GUI7_Bouton3 = 9994
            $GUI7_Checkbox1 = 9994
    EndSwitch
EndFunc ;=>On_Close

 

 Do you think I just need to do that ? It make me crazy to try to find the error but it seem to work like a charm now :)

Share this post


Link to post
Share on other sites

Stormgrade,

That should work - but I would suggest that the other method I mentioned (creating all the GUIs and then hiding/showing them as required) would be much easier.

Or you could use my GUIExtender UDF to place all the sections within the same GUI and expand/retract the correct section when needed - let me know if you would like some help getting that idea to work.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Thank you for your advice, I've used the AutoIt wiki to manage multiple GUI, If I use :

GUISetState(@SW_HIDE, $GUI5)

 GUISetState(@SW_SHOW, $GUI5)

I must "rethink" all I'had done with the GUis.

I've already used your UDF for a protoype, it's very useful for hiding showing GUI inside a GUI but I don't intend to make a password manager inside one GUI.

Share this post


Link to post
Share on other sites

Stormgrade,

That sounds like you have got the measure of the problem - glad I could help you get there.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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

  • Similar Content

    • Robdog1955
      By Robdog1955
      I'm trying to click a button on a web page. I have added a couple of MsgBox lines to allow me to watch what happens on the page. As you can see the first half of my script enters data into text boxes on the page. I have no problem there. I just cannot click on the region buttons. The "set focus" line causes an outline to appear around the EU button and the "click button" line causes the "Pick a Region" text to disappear. Here is the code I have so far.
      #include <IE.au3> Local $oIE = _IECreate("http://questchecker.com/") Local $iQuestID = "123456" Local $sCharacterName = "CharacterName" Local $colForms = _IEFormGetCollection($oIE) $iCount = 0 For $oForm In $colForms $oFormElements = _IEFormElementGetCollection($oForm) For $oFormElement In $oFormElements $iCount = $iCount + 1 Local $sTagName = StringLower($oFormElement.tagName) Local $sElementType = $oFormElement.type Local $sElementName = $oFormElement.name Switch $iCount Case 6 _IEFormElementSetValue($oFormElement, "MyRealm", 0) ; realm Case 7 _IEFormElementSetValue($oFormElement, $sCharacterName, 0) Case 8 _IEFormElementSetValue($oFormElement, $iQuestID, 0) EndSwitch Next Next Local $oButtons = _IEGetObjByName($oIE, "questForm") For $oButton In $oButtons If _IEFormElementGetValue($oButton) = "US" Then MsgBox(0, "", "Click Okay to set focus") _IEAction($oButton, "focus") MsgBox(0, "", "Click Okay to click button") _IEAction($oButton, "click") ExitLoop EndIf Next MsgBox(0, "", "Click Okay to quit") _IEQuit($oIE) Exit  
    • computergroove
      By computergroove
      I've made a form in Koda where I make a list of 3 user definable elements that I want to be able to replicate with a button press so a user can add data that can be used as part of the program. 
      #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=D:\Carbonite Important\0 - Programing\Scite and Autoit\Koda 1.7.3.0\Forms\Mileage Estimator.kxf $Form1 = GUICreate("Save Project", 614, 1126, 298, 141) $Location = GUICtrlCreateInput("Location", 40, 112, 345, 21) $Distance = GUICtrlCreateInput("Distance", 400, 112, 89, 21) $AddLocation = GUICtrlCreateButton("AddLocation", 288, 80, 97, 25) $Label1 = GUICtrlCreateLabel("Location", 40, 88, 45, 17) $Label2 = GUICtrlCreateLabel("Distance", 400, 88, 46, 17) $HomeBase = GUICtrlCreateInput("HomeBase", 312, 32, 121, 21) $LeapYear = GUICtrlCreateCheckbox("LeapYear", 464, 32, 17, 17) $Label3 = GUICtrlCreateLabel("Leap Year?", 488, 32, 59, 17) $Variance = GUICtrlCreateInput("Variance", 504, 112, 81, 21) $Label4 = GUICtrlCreateLabel("Variance", 504, 88, 46, 17) $Label5 = GUICtrlCreateLabel("Home Base", 312, 8, 59, 17) $Button1 = GUICtrlCreateButton("Button1", 144, 56, 1, 57) $Save = GUICtrlCreateButton("Save Project", 40, 16, 121, 25) $Load = GUICtrlCreateButton("Load Project", 176, 16, 121, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Form1 Case $AddLocation EndSwitch WEnd I want to press the "add location" button and have the fields {Location, Distance and variance} create a new blank record located under the existing 3 input boxes. Since the fields can number over 30 locations in some examples I am thinking about having these items in a scrolling window. What is the best way to do this and can auto it add a variable while running by pressing a button?
    • XaelloNegative
      By XaelloNegative
      Hi,
      I made a small blunder with my code. I created the GUI under 1920x1080 resolution however, my user is configured to ONLY 1080x720 and cannot go any further than that.
      What do you guys think is the best way to correct this one? Resolution mathematics is something that came to mind however I do not have access to his PC to check  from time to time if  my estimation is correct and the resolution on my PC doesn't go down to 1080x720.
      Please help.
      ~XN~
    • davidacrozier
      By davidacrozier
      Hello all ~
      I am running an autoit script on Windows 10 inside VMware Workstation 12 Pro version 12.5.2.  Technically I am remoting into ESXi which has a Domain Controller (DC), WebServer, FilServer, Windows 10, etc.  Using the GUI (i.e. running explorer.exe) I am able to open several different folders successfully.  The desktop, documents, USB external all open without issue.  The network share opening gives me issues.  Whenever I attempt to open \\filserver\users\user\sharedfolder I get the documents folder instead.  I understand that the documents folder is the default for explorer.  I have also attempted to use the letter drive mapped to the network share (Z:) and receive the same result.  When I run this script on Windows 10 alone without  the VM or the ESXi I am able to open the network share without problems.  I have tried to use the net use command to designate a letter M: to the network share folder prior to running the script.  This did not work for me.  
      One additional avenue I think might work is to use the systreeview321 and _GUICtrlTreeView_FindItem to step through the tree looking for the network share.  Once found,  double click on it and see if that opens the shared network folder.  I can click inside the VM with my mouse on the network share and it opens just fine.  Not sure if running up against GUI issues, or permission issues, or what?
      Thanks in advance,
      Davida Crozier
      TestNetworkShare.au3
      This script is a subset of a much larger program, but it illustrates what I am dealing with.

    • superflq
      By superflq
      Hi everyone,
      GUICtrlSetState Function example ,i found $GUI_DROPACCEPTED isn't working in windows10 x64(windows_10_enterprise_2016_ltsb_x64).
      if the example put to windows10 x86 or windows xp, the $GUI_DROPACCEPTED is effective,
      the AutoIt Edition is v3.3.14.2.
      any ideas? thanks you.
       
      #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Example() Func Example() ; Create a GUI with various controls. Local $hGUI = GUICreate("Example", 420, 200, -1, -1, -1, $WS_EX_ACCEPTFILES) ; Create a label and set the state as drop accepted. Local $idLabel = GUICtrlCreateLabel("Drop a file on this label.", 10, 10, 400, 40, $WS_BORDER) GUICtrlSetState($idLabel, $GUI_DROPACCEPTED) ; Create an input and set the state as drop accepted. Local $idInput = GUICtrlCreateInput("", 10, 60, 400, 22) GUICtrlSetState($idInput, $GUI_DROPACCEPTED) Local $idOK = GUICtrlCreateButton("OK", 310, 170, 85, 25) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idOK ExitLoop Case $GUI_EVENT_DROPPED ; If the value of @GUI_DropId is $idLabel, then set the label of the dragged file. If @GUI_DropId = $idLabel Then GUICtrlSetData($idLabel, @GUI_DragFile) EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc ;==>Example