Jump to content

Search the Community

Showing results for tags 'gui onevent for-loop'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. Is there a way to create a GUI in a for-loop? As in: I have a program which asks the user for passwords if the email is unknown. For each account that is not known, I want a GUI to be created that prompts the user for the password. After user clicks the 'OK' button on the GUI, the password is written to a file, and program continues with the next account. Something like this (I AM aware that code below doesn't work): #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> Opt("GUIOnEventMode", 1) Opt("MustDeclareVars", 1) Global $accounts_file = "accountz.ini" Global $gui_pw, $label_pw, $input_pw, $button_pw_enter Func _GUIAskPasswordButtonClick() Local $password = GUICtrlRead($input_pw) Switch @GUI_CtrlId Case $button_pw_enter If ($password <> "") Then IniWrite($accounts_file, GUICtrlRead($label_pw), "Password", $password) GUIDelete($gui_pw) Else MsgBox(16, "Error", "Please type password:") GUICtrlSetData($input_pw, "") GUICtrlSetState($input_pw, $GUI_FOCUS) EndIf EndSwitch EndFunc Func _Exit() Exit EndFunc Func GUIAskPassword($login) $gui_pw = GUICreate("Account unknown", 395, 180) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") GUICtrlCreateGroup("", 70, 50, 300, 80) GUICtrlCreateLabel("Login:", 85, 70, 75, 20) $label_pw = GUICtrlCreateLabel($login, 170, 70, 175, 20) GUICtrlCreateLabel("Password:", 85, 95, 75, 20) $input_pw = GUICtrlCreateInput("", 170, 95, 175, 20, $ES_PASSWORD) GUICtrlSetState(-1, $GUI_FOCUS) $button_pw_enter = GUICtrlCreateButton("&OK", 163, 145, 75, 25, $BS_DEFPUSHBUTTON) GUICtrlSetOnEvent(-1, "_GUIAskPasswordButtonClick") GUISetState(@SW_SHOW, $gui_pw) EndFunc Dim $accounts[3] = ["first@email.com", "second@email.com", "third@email.com"] For $i = 0 To Ubound($accounts) - 1 GUIAskPassword($accounts[$i]) Next While 1 Sleep(10) WEnd This piece of code is simplified. In my program this GUI is a child window and the number of accounts can vary. ONEVEnt mode is obligatory My script doesn't work because it puts all 3 GUI's in the same variable $gui_pw, so things are messed up big time: the first GUIs can't be closed. How do I wait until the user has clicked the OK button before creating the next GUI? Is there an easier and better way to do this? The only thing I came up with now, is to switch to messageloop mode and back to onevent mode after completing my function...but that is soooo ugly Any ideas?
×
×
  • Create New...