Sign in to follow this  
Followers 0
kw_rock

VERY basic questions

6 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Also look at Koda form designer for easy creating Autoit's GUIs and generating code for it.

http://www.autoitscript.com/forum/index.php?showtopic=32299

Edited by Zedna

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

NEVERMIND!

Works like a charm!

Thanks guys

Edited by kw_rock

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
Sign in to follow this  
Followers 0