Jump to content

[ Solved ]Need some help with Gui


Borje
 Share

Recommended Posts

Hi everybody

I need some help I cant get the ok button to work, what I want is when I start a script this gui is displayed until I press the OK button

after Ok button is pressed I want the script to continue.

What I needed to do?

$GUI = GuiCreate("Button test" &" When OK is pressed I want continue the script " ,565,170,-1,-1,0x7)

GUISetState (@SW_SHOW)

GUICtrlCreateLabel(" Button test when press OK ",1,17,560)

$font="Verdana"

GUICtrlSetFont (-1,11,500,3,$Font)

guiCtrlSetColor(-1, 0x0000ff)

GUICtrlCreateButton("OK", 200, 60, 100, 20)

Sleep(5000)

Edited by Borje
Link to comment
Share on other sites

Something like this but you will have to play with it. Actually you NEED to read the help file.

;
$font="Verdana"
$GUI = GuiCreate("Button test" &" When OK is pressed I want continue the script " ,565,170,-1,-1,0x7)
GUICtrlCreateLabel(" Button test when press OK ",1,17,560)
GUICtrlSetFont (-1,11,500,3,$Font)
guiCtrlSetColor(-1, 0x0000ff)
$Btn_Go = GUICtrlCreateButton("OK", 200, 60, 100, 20)
GUISetState (@SW_SHOW);;  Preferably after the controls are created
 Do
    Sleep(50)
Until GUIGetMsg() = $Btn_Go
GUIDelete($Gui)
;

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

#include <GUIConstantsEx.au3>
$GUI = GuiCreate("Button test" &" When OK is pressed I want continue the script " ,565,170,-1,-1,0x7)
GUICtrlCreateLabel(" Button test when press OK ",1,17,560)
$font="Verdana"
GUICtrlSetFont (-1,11,500,3,$Font)
guiCtrlSetColor(-1, 0x0000ff)
$ok = GUICtrlCreateButton("OK", 200, 60, 100, 20)
GUISetState (@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit ; close app on Esc
        Case $ok
            ExitLoop ; close form and execute desired code at the end
 EndSwitch
WEnd
GUIDelete($GUI)

; here place your code to be executed after OK
MsgBox(0,'Info','Test')

Link to comment
Share on other sites

Zedna gave you a good example but you still NEED to read the help file.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Hi everybody

I need some help I cant get the ok button to work, what I want is when I start a script this gui is displayed until I press the OK button

after Ok button is pressed I want the script to continue.

What I needed to do?

$GUI = GuiCreate("Button test" &" When OK is pressed I want continue the script " ,565,170,-1,-1,0x7)

GUISetState (@SW_SHOW)

GUICtrlCreateLabel(" Button test when press OK ",1,17,560)

$font="Verdana"

GUICtrlSetFont (-1,11,500,3,$Font)

guiCtrlSetColor(-1, 0x0000ff)

GUICtrlCreateButton("OK", 200, 60, 100, 20)

Sleep(5000)

Just read the GUICtrlCreateButton doc example and do the same. at least try to understand how to get info from a gui :P
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...