Jump to content

VERY basic questions


kw_rock
 Share

Recommended Posts

My GUI starts like this

$path = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\dfdf", "Path")
$win = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\dfdf", "Window")
$dfdfRelog = GUICreate("dfdf", 301, 402, 480, 198)
$PathLoc = GUICtrlCreateInput($path, 8, 208, 193, 21)
$WindowName = GUICtrlCreateInput($win, 8, 280, 193, 21)

MY GOAL is to create buttons at the bottom. One will say "Start" and one will say "Exit"

Exit will obviously close the program.

When they click "Start", I want to save the values that are currently typed into the input boxes, AND THEN run the main function.

For some reason, though..... I cannot figure it out. Does anyone want to help? :)

Thanks

Edited by kw_rock
Link to comment
Share on other sites

You need a message loop, or something similar to get notified when the button was clicked:

#include <GUIConstantsEx.au3>

; ...
$BtnStart = GUICtrlCreateButton("&Start", 50, 70, 70, 24) ; for example
$BtnClose = GUICtrlCreateButton("&Exit", 50, 110, 70, 24)

While 1
    Switch GUIGetMsg()
       Case $GUI_EVENT_CLOSE, $BtnClose
              GUIDelete()
              Exit

       Case $BtnStart
              Local $sPath = GUICtrlRead($PathLoc)
              Local $sWindowName = GUICtrlRead($WindowName)

              ; Work with data using FileOpen(), FileWrite() or some other destination stream.
              ; Run main function.
    EndSwitch
WEnd
Edited by Authenticity
Link to comment
Share on other sites

Awesome, it's saving values and everything!

When I hit Exit, it closes.

When I hit Start, it saves the new values but DOESN'T run the main function, and doesn't close the dialog box.

When i hit Exit AFTER hitting start, it doesn't do anything.

Edited by kw_rock
Link to comment
Share on other sites

Awesome, it's saving values and everything!

When I hit Exit, it closes.

When I hit Start, it saves the new values but DOESN'T run the main function, and doesn't close the dialog box.

When i hit Exit AFTER hitting start, it doesn't do anything.

That's funny; it looks to me like it should work fine.
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...