Sign in to follow this  
Followers 0
mdwerne

Creating a ComboBox with values for schtasks /ST

5 posts in this topic

#1 ·  Posted (edited)

So I apologize in advance for the horrible mess you see below. While there may be many issues with my code, I only need help with one part. This GUI is an interface for customers to install software pushed via SCCM. While I have Continue and Abort buttons working just fine, I'm trying to implement a scheduler that will allow the customer to defer the install for later in the day up until 11:30pm.

I'd like to have the combobox display the current time (12 hour format) and then all hours (both top and bottom of the hour) until 11:30pm. So if they check the "Defer" box, select a time from the dropdown (such as 8:30pm) and click "Go"...the time chosen will be sent to my 'unfinished' Scheduler function which will then create a task to be executed at the specified time. I hope that all makes some sense.

So again, the only thing I would like some help with is how to correctly create the combobox with the possible values based on the current local time. I should be able to figure out the rest.

Thanks for any suggestions,

-Mike

Edit:...Oops, if the moderator would like to move this post to the "Graphical User Interface (GUI) Help and Support", I wasn't thinking when I hit submit...sorry.

#include "_XMLDomWrapper.au3"
#include <Constants.au3>
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Date.au3>

;Global $sFile = (@ScriptDir & "\Config.xml")
Global $hGUI, $FormTitle, $RTFName, $ProgramName, $TrayTip, $ShutdownTimer, $ParamName, $AbortAllowed, $AbortButtonName, $ContinueButtonName, $GoButton, $Scheduler
Global $hRichEdit, $ExitCode, $Width, $Height, $sHours

If @DesktopWidth > 1024 Then
    $Width = 1024
Else
    $Width = @DesktopWidth
EndIf

If @DesktopHeight > 768 Then
    $Height = 768
Else
    $Height = @DesktopHeight
EndIf

;_XMLFileOpen($sFile)

$FormTitle = _XMLGetAttrib("/MessageInfo/Title", "FormTitle")
$RTFName = _XMLGetAttrib("/MessageInfo/Display", "RTFName")
$ProgramName = _XMLGetAttrib("/MessageInfo/Program", "ProgramName")
$TrayTip = _XMLGetAttrib("/MessageInfo/TrayTip", "TrayTip")
$ShutdownTimer = _XMLGetAttrib("/MessageInfo/ShutdownTimer", "ShutdownTimer")
$ParamName = _XMLGetAttrib("/MessageInfo/Param", "ParamName")
$AbortAllowed = _XMLGetAttrib("/MessageInfo/Abort", "AbortAllowed")
$AbortButtonName = _XMLGetAttrib("/MessageInfo/ABN", "AbortButtonName")
$ContinueButtonName = _XMLGetAttrib("/MessageInfo/CBN", "ContinueButtonName")
$Scheduler = _XMLGetAttrib("/MessageInfo/Sched", "Scheduler")

_Main()

; Functions
Func _Main()
    Local $msg, $AbortButton, $ContinueButton, $ScheduleBox
    $hGUI = GUICreate($FormTitle, $Width - 20, $Height - 100, -1, 10, -1)
    $hRichEdit = _GUICtrlRichEdit_Create($hGUI, "", 10, 10, $Width - 40, $Height - 150, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
    ;GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
    _GUICtrlRichEdit_SetEventMask($hRichEdit, $ENM_LINK)
    _GUICtrlRichEdit_AutoDetectURL($hRichEdit, True)
    $ContinueButton = GUICtrlCreateButton($ContinueButtonName, $Width - 500, $Height - 133, 100, 25)
    GUICtrlSetFont($ContinueButton, 10, 800, 0, "Tahoma")
    $AbortButton = GUICtrlCreateButton($AbortButtonName, $Width - 390, $Height - 133, 100, 25)
    GUICtrlSetFont($AbortButton, 10, 800, 0, "Tahoma")
    $ScheduleBox = GUICtrlCreateCheckbox("Defer", $Width - 280, $Height - 133, 75, 25)
    GUICtrlSetFont($ScheduleBox, 10, 800, 0, "Tahoma")

    Global $hCombo = GUICtrlCreateCombo("", $Width - 200, $Height - 132, 90, 25)
    GUICtrlSetData(-1, @HOUR + 1 & "|" & @HOUR + 2 & "|" & @HOUR + 3 & "|" & @HOUR + 4 & "|" & @HOUR + 5 & "|" & @HOUR + 6 & "|" & @HOUR + 7 & "|" & @HOUR + 8)

    $GoButton = GUICtrlCreateButton("Go", $Width - 75, $Height - 133, 50, 25)
    GUICtrlSetFont($GoButton, 10, 800, 0, "Tahoma")

    GUISetState()
    _GUICtrlRichEdit_StreamFromFile($hRichEdit, $RTFName)
    _GUICtrlRichEdit_SetReadOnly($hRichEdit)
    _GUICtrlRichEdit_GotoCharPos($hRichEdit, 0)
    MouseClick("main", @DesktopWidth / 2, @DesktopHeight / 2, 0)
    Sleep(1000)
    ;GUISetState(@SW_MINIMIZE)
    GUISetState(@SW_SHOW)

    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $ContinueButton
                Opt("TrayIconHide", 1)
                GUISetState(@SW_HIDE)
                $ExitCode = RunWait(@ScriptDir & "\" & $ProgramName)
                _GUICtrlRichEdit_Destroy($hRichEdit)
                ;MsgBox(0, "Program Exit Code", $ExitCode)
                Exit $ExitCode
            Case $msg = $GoButton
                Opt("TrayIconHide", 1)
                GUISetState(@SW_HIDE)
                ;Scheduler()
                _GUICtrlRichEdit_Destroy($hRichEdit)
                Exit
            Case $msg = $GUI_EVENT_CLOSE Or $msg = $AbortButton
                _GUICtrlRichEdit_Destroy($hRichEdit)
                Exit -1
        EndSelect
    WEnd
EndFunc   ;==>_Main

;~ Func Scheduler()
;~  Local $sXtra_Parms
;~  Local $sDateTime = _DateAdd('h', $sHours, _NowCalc())
;~  Local $sStartDate = StringMid($sDateTime, 6, 3) & StringMid($sDateTime, 9, 2) & "/" & StringLeft($sDateTime, 4)
;~  $sStartTime = StringRight($sDateTime, 8)

;~  If @OSVersion = "WIN_VISTA" Or @OSVersion = "WIN_7" Or @OSVersion = "WIN_8" Then $sXtra_Parms = " /Z /V1"

;~  Local $QueryTask = Run("SCHTASKS /QUERY /TN " & $FormTitle, "", @SW_HIDE, $STDOUT_CHILD)

;~  Local $line = ""

;~  While 1
;~      $line &= StdoutRead($QueryTask)
;~      If @error Then ExitLoop
;~  WEnd

;~  If $line = "" Then
;~      $sCmd = 'SCHTASKS /CREATE /SC ONCE /TN ' & $FormTitle & ' /TR ' & $ProgramName & ' /SD ' & $sStartDate & ' /ST ' & $sStartTime & ' /RU SYSTEM' & $sXtra_Parms
;~      Run($sCmd, "", @SW_HIDE)
;~      ;MsgBox(0, "", $sCmd) ; for testing
;~  Else
;~      $sCmd = 'SCHTASKS /CHANGE /TN ' & $FormTitle & ' /SD ' & $sStartDate & ' /ST ' & $sStartTime
;~      Run($sCmd, "", @SW_HIDE)
;~      ;MsgBox(0, "", $sCmd) ; for testing
;~  EndIf
;~ EndFunc   ;==>Scheduler

Here is the Config.xml file if you're interested.

<?xml version="1.0"?>
<MessageInfo>
    <Title FormTitle="EMET 4.1"/>
    <Display RTFName="RichText.rtf"/>
    <Program ProgramName="Emet installer.exe /sccm"/>
    <TrayTip TrayTip="EMET 4.1 Available"/>
    <ShutdownTimer ShutdownTimer="300000"/>
    <Param ParamName=""/>
    <Abort AbortAllowed="Y" />
    <ABN AbortButtonName="Not Now"/>
    <CBN ContinueButtonName="Continue"/>
    <Sched Scheduler="0"/>
</MessageInfo>
Edited by mdwerne

Share this post


Link to post
Share on other sites



Anyone have any suggestions on this, I've been poking at this for a couple days and not really making any progress.

If the mess above is too confusing, I can simplify and restate.

Thanks for taking a look,

-Mike

Share this post


Link to post
Share on other sites

Okay...I was left to my own devices long enough and actually came up with something, not pretty, but it seems to work.

(?) My question now is, where is the "0" coming from at the end of my ComboBox, and do I remove the "0". (?)

#include <GuiComboBox.au3>
#include <GUIConstantsEx.au3>
#include <Date.au3>

Global $CurrentTime, $i, $AMPM

If @HOUR > 12 Then
    $AMPM = "PM"
ElseIf @HOUR = 0 Then
    $AMPM = "AM"
Else
    $AMPM = "AM"
EndIf

GUICreate("ComboTest", 200, 40)
Global $hCombo = GUICtrlCreateCombo("New install time:", 10, 10, 180, 25)
GUICtrlSetData(-1, GetTimes())
GUISetState()
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd

Func GetTimes()
    Local $CurrentHour = StringTrimRight(_NowTime(), 9)
    For $i = $CurrentHour To 11 Step +1
        _GUICtrlComboBox_BeginUpdate($hCombo)
        _GUICtrlComboBox_InsertString($hCombo, $i & ":00 " & $AMPM, -1)
        _GUICtrlComboBox_InsertString($hCombo, $i & ":30 " & $AMPM, -1)
        _GUICtrlComboBox_EndUpdate($hCombo)
    Next
EndFunc   ;==>GetTimes

Thanks for your time,

-Mike

Share this post


Link to post
Share on other sites

GetTimes() returns 0 so do not use GUICtrlSetData to add the return value of 0 to the combo.

Updated code

#include <GuiComboBox.au3>
#include <GUIConstantsEx.au3>
#include <Date.au3>

Global $CurrentTime, $i, $AMPM

If @HOUR > 12 Then
    $AMPM = "PM"
ElseIf @HOUR = 0 Then
    $AMPM = "AM"
Else
    $AMPM = "AM"
EndIf

GUICreate("ComboTest", 200, 40)
Global $hCombo = GUICtrlCreateCombo("New install time:", 10, 10, 180, 25)
; function returns value of 0
GetTimes()
GUISetState()
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd

Func GetTimes()
    Local $CurrentHour = StringTrimRight(_NowTime(), 9)
    _GUICtrlComboBox_BeginUpdate($hCombo)
    For $i = $CurrentHour To 11
        _GUICtrlComboBox_InsertString($hCombo, $i & ":00 " & $AMPM, -1)
        _GUICtrlComboBox_InsertString($hCombo, $i & ":30 " & $AMPM, -1)
    Next
    _GUICtrlComboBox_EndUpdate($hCombo)
EndFunc   ;==>GetTimes
1 person likes this

Share this post


Link to post
Share on other sites

Thanks MHz, your correction and code clean up helped me learn a bit more.

All the best!

-Mike

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

  • Similar Content

    • You
      By You
      Please help create a GUI! Any ideas or guides are welcome!

      Create drag-and-drop GUIs:
      - GUI Min or Explan Main GUI Menu with top button! (Also the button to move drag and drop move)
      - Main GUI Menu: Stay in the center of the screen AND Always on the left or right side of the screen!
      - When you click on one of the menus, you will create or create a GUI: always on the left or right side of the main menu!


       
      SRC:
      #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <ColorConstantS.au3> Opt("MustDeclareVars", 1) ;0=no, 1=require pre-declaration Opt("TrayMenuMode", 1) ;0=append, 1=no default menu, 2=no automatic check, 4=menuitemID not return Opt("TrayAutoPause", 0) ;0=no pause, 1=Pause Opt("GUIOnEventMode", 1) ;0=disabled, 1=OnEvent mode enabled Opt("GUIResizeMode", 0) ;0=no resizing, <1024 special resizing #Region ### START Koda GUI section ### Form= Global $Form1 = GUICreate("MAIN_MENU", 117, 481, @DesktopWidth - 117, -1, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_WINDOWEDGE)) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") GUISetBkColor($COLOR_BLUE) ; will change background color Global $Label1 = GUICtrlCreateLabel("<-!->", 0, 0, 116, 25, BitOR($SS_CENTER, $SS_CENTERIMAGE, $SS_RIGHTJUST), $GUI_WS_EX_PARENTDRAG) Global $Button0 = GUICtrlCreateButton("Button0", 1, 32, 115, 41, BitOR($BS_CENTER, $BS_VCENTER, $BS_FLAT)) GUICtrlSetOnEvent(-1, "_Button0") Global $Button1 = GUICtrlCreateButton("Button1", 1, 73, 115, 41, BitOR($BS_CENTER, $BS_VCENTER, $BS_FLAT)) GUICtrlSetOnEvent(-1, "_Button1") Global $Button2 = GUICtrlCreateButton("Button2", 1, 119, 115, 41, BitOR($BS_CENTER, $BS_VCENTER, $BS_FLAT)) GUICtrlSetOnEvent(-1, "_Button2") Global $Button3 = GUICtrlCreateButton("Button3", 1, 167, 115, 41, BitOR($BS_CENTER, $BS_VCENTER, $BS_FLAT)) GUICtrlSetOnEvent(-1, "_Button3") Global $Button4 = GUICtrlCreateButton("Button4", 1, 216, 115, 41, BitOR($BS_CENTER, $BS_VCENTER, $BS_FLAT)) GUICtrlSetOnEvent(-1, "_Button4") Global $Button5 = GUICtrlCreateButton("Button5", 1, 259, 115, 41, BitOR($BS_CENTER, $BS_VCENTER, $BS_FLAT)) GUICtrlSetOnEvent(-1, "_Button5") Global $Button6 = GUICtrlCreateButton("Button6", 1, 305, 115, 41, BitOR($BS_CENTER, $BS_VCENTER, $BS_FLAT)) GUICtrlSetOnEvent(-1, "_Button6") Global $Button7 = GUICtrlCreateButton("Button7", 1, 347, 115, 41, BitOR($BS_CENTER, $BS_VCENTER, $BS_FLAT)) GUICtrlSetOnEvent(-1, "_Button7") Global $Button8 = GUICtrlCreateButton("Button8", 1, 396, 115, 41, BitOR($BS_CENTER, $BS_VCENTER, $BS_FLAT)) GUICtrlSetOnEvent(-1, "_Button8") Global $Button9 = GUICtrlCreateButton("Exit", 1, 437, 115, 41, BitOR($BS_CENTER, $BS_VCENTER, $BS_FLAT)) GUICtrlSetOnEvent(-1, "_Button9") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 Sleep(50) WEnd Func _Exit() Exit EndFunc ;==>_Exit Func _CloseGUI() GUIDelete() EndFunc ;==>_CloseGUI Func _Button0() #Region ### START SUB GUI section ### Form= Global $Form2 = GUICreate("SUB_GUI_0", 310, 712, @DesktopWidth - 310 - 150, -1, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_TOPMOST, $WS_EX_WINDOWEDGE)) GUISetBkColor($COLOR_RED) ; will change background color Global $Label1 = GUICtrlCreateLabel("SUB GUI MENU 0", 0, 0, 234, 508, BitOR($SS_CENTER, $SS_CENTERIMAGE, $SS_RIGHTJUST), $GUI_WS_EX_PARENTDRAG) GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif") Global $Button1 = GUICtrlCreateButton("Exit", 240, 456, 67, 49, BitOR($BS_CENTER, $BS_VCENTER)) GUICtrlSetOnEvent(-1, "_CloseGUI") GUISetState(@SW_SHOW) #EndRegion ### START SUB GUI section ### Form= EndFunc ;==>_Button0 Func _Button1() #Region ### START SUB GUI section ### Form= Global $Form2 = GUICreate("SUB_GUI_1", 310, 712, @DesktopWidth - 310 - 150, -1, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_TOPMOST, $WS_EX_WINDOWEDGE)) GUISetBkColor($COLOR_RED) ; will change background color Global $Label1 = GUICtrlCreateLabel("SUB GUI MENU 1", 0, 0, 234, 508, BitOR($SS_CENTER, $SS_CENTERIMAGE, $SS_RIGHTJUST), $GUI_WS_EX_PARENTDRAG) GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif") Global $Button1 = GUICtrlCreateButton("Exit", 240, 456, 67, 49, BitOR($BS_CENTER, $BS_VCENTER)) GUICtrlSetOnEvent(-1, "_CloseGUI") GUISetState(@SW_SHOW) #EndRegion ### START SUB GUI section ### Form= EndFunc ;==>_Button1 Func _Button2() #Region ### START SUB GUI section ### Form= Global $Form2 = GUICreate("SUB_GUI_2", 310, 712, @DesktopWidth - 310 - 150, -1, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_TOPMOST, $WS_EX_WINDOWEDGE)) GUISetBkColor($COLOR_RED) ; will change background color Global $Label1 = GUICtrlCreateLabel("SUB GUI MENU 2", 0, 0, 234, 508, BitOR($SS_CENTER, $SS_CENTERIMAGE, $SS_RIGHTJUST), $GUI_WS_EX_PARENTDRAG) GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif") Global $Button1 = GUICtrlCreateButton("Exit", 240, 456, 67, 49, BitOR($BS_CENTER, $BS_VCENTER)) GUICtrlSetOnEvent(-1, "_CloseGUI") GUISetState(@SW_SHOW) #EndRegion ### START SUB GUI section ### Form= EndFunc ;==>_Button2 Func _Button3() #Region ### START SUB GUI section ### Form= Global $Form2 = GUICreate("SUB_GUI_3", 310, 712, @DesktopWidth - 310 - 150, -1, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_TOPMOST, $WS_EX_WINDOWEDGE)) GUISetBkColor($COLOR_RED) ; will change background color Global $Label1 = GUICtrlCreateLabel("SUB GUI MENU 3", 0, 0, 234, 508, BitOR($SS_CENTER, $SS_CENTERIMAGE, $SS_RIGHTJUST), $GUI_WS_EX_PARENTDRAG) GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif") Global $Button1 = GUICtrlCreateButton("Exit", 240, 456, 67, 49, BitOR($BS_CENTER, $BS_VCENTER)) GUICtrlSetOnEvent(-1, "_CloseGUI") GUISetState(@SW_SHOW) #EndRegion ### START SUB GUI section ### Form= EndFunc ;==>_Button3 Func _Button4() #Region ### START SUB GUI section ### Form= Global $Form2 = GUICreate("SUB_GUI_4", 310, 712, @DesktopWidth - 310 - 150, -1, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_TOPMOST, $WS_EX_WINDOWEDGE)) GUISetBkColor($COLOR_RED) ; will change background color Global $Label1 = GUICtrlCreateLabel("SUB GUI MENU 4", 0, 0, 234, 508, BitOR($SS_CENTER, $SS_CENTERIMAGE, $SS_RIGHTJUST), $GUI_WS_EX_PARENTDRAG) GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif") Global $Button1 = GUICtrlCreateButton("Exit", 240, 456, 67, 49, BitOR($BS_CENTER, $BS_VCENTER)) GUICtrlSetOnEvent(-1, "_CloseGUI") GUISetState(@SW_SHOW) #EndRegion ### START SUB GUI section ### Form= EndFunc ;==>_Button4 Func _Button5() #Region ### START SUB GUI section ### Form= Global $Form2 = GUICreate("SUB_GUI_5", 310, 712, @DesktopWidth - 310 - 150, -1, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_TOPMOST, $WS_EX_WINDOWEDGE)) GUISetBkColor($COLOR_RED) ; will change background color Global $Label1 = GUICtrlCreateLabel("SUB GUI MENU 5", 0, 0, 234, 508, BitOR($SS_CENTER, $SS_CENTERIMAGE, $SS_RIGHTJUST), $GUI_WS_EX_PARENTDRAG) GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif") Global $Button1 = GUICtrlCreateButton("Exit", 240, 456, 67, 49, BitOR($BS_CENTER, $BS_VCENTER)) GUICtrlSetOnEvent(-1, "_CloseGUI") GUISetState(@SW_SHOW) #EndRegion ### START SUB GUI section ### Form= EndFunc ;==>_Button5 Func _Button6() #Region ### START SUB GUI section ### Form= Global $Form2 = GUICreate("SUB_GUI_6", 310, 712, @DesktopWidth - 310 - 150, -1, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_TOPMOST, $WS_EX_WINDOWEDGE)) GUISetBkColor($COLOR_RED) ; will change background color Global $Label1 = GUICtrlCreateLabel("SUB GUI MENU 6", 0, 0, 234, 508, BitOR($SS_CENTER, $SS_CENTERIMAGE, $SS_RIGHTJUST), $GUI_WS_EX_PARENTDRAG) GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif") Global $Button1 = GUICtrlCreateButton("Exit", 240, 456, 67, 49, BitOR($BS_CENTER, $BS_VCENTER)) GUICtrlSetOnEvent(-1, "_CloseGUI") GUISetState(@SW_SHOW) #EndRegion ### START SUB GUI section ### Form= EndFunc ;==>_Button6 Func _Button7() #Region ### START SUB GUI section ### Form= Global $Form2 = GUICreate("SUB_GUI_7", 310, 712, @DesktopWidth - 310 - 150, -1, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_TOPMOST, $WS_EX_WINDOWEDGE)) GUISetBkColor($COLOR_RED) ; will change background color Global $Label1 = GUICtrlCreateLabel("SUB GUI MENU 7", 0, 0, 234, 508, BitOR($SS_CENTER, $SS_CENTERIMAGE, $SS_RIGHTJUST), $GUI_WS_EX_PARENTDRAG) GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif") Global $Button1 = GUICtrlCreateButton("Exit", 240, 456, 67, 49, BitOR($BS_CENTER, $BS_VCENTER)) GUICtrlSetOnEvent(-1, "_CloseGUI") GUISetState(@SW_SHOW) #EndRegion ### START SUB GUI section ### Form= EndFunc ;==>_Button7 Func _Button8() #Region ### START SUB GUI section ### Form= Global $Form2 = GUICreate("SUB_GUI_8", 310, 712, @DesktopWidth - 310 - 150, -1, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_TOPMOST, $WS_EX_WINDOWEDGE)) GUISetBkColor($COLOR_RED) ; will change background color Global $Label1 = GUICtrlCreateLabel("SUB GUI MENU 8", 0, 0, 234, 508, BitOR($SS_CENTER, $SS_CENTERIMAGE, $SS_RIGHTJUST), $GUI_WS_EX_PARENTDRAG) GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif") Global $Button1 = GUICtrlCreateButton("Exit", 240, 456, 67, 49, BitOR($BS_CENTER, $BS_VCENTER)) GUICtrlSetOnEvent(-1, "_CloseGUI") GUISetState(@SW_SHOW) #EndRegion ### START SUB GUI section ### Form= EndFunc ;==>_Button8 Func _Button9() _Exit() ;~ #Region ### START SUB GUI section ### Form= ;~ Global $Form2 = GUICreate("SUB_GUI_9", 310, 712, @DesktopWidth - 310 - 150, -1, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_TOPMOST, $WS_EX_WINDOWEDGE)) ; GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") ;~ Global $Label1 = GUICtrlCreateLabel("SUB GUI MENU 9", 0, 0, 234, 508, BitOR($SS_CENTER, $SS_CENTERIMAGE, $SS_RIGHTJUST), $GUI_WS_EX_PARENTDRAG) ;~ GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif") ;~ Global $Button1 = GUICtrlCreateButton("Exit", 240, 456, 67, 49, BitOR($BS_CENTER, $BS_VCENTER)) ;~ GUICtrlSetOnEvent(-1, "_CloseGUI") ;~ GUISetState(@SW_SHOW) ;~ #EndRegion ### START SUB GUI section ### Form= EndFunc ;==>_Button9  
    • Nareshm
      By Nareshm
      How to repeat my script when my control class does not match ?
       
      My Script : winActivate ( " PS :: Version - 2.2.0.0  - [PS Bill]")                   ControlClick ( "PS :: Version - 2.2.0.0  - [PS Bill]", "", "[NAME:btnSavebyFP]")                   ControlSend(" PS :: Version - 2.2.0.0  - [PS Bill]", "", "[NAME:btnSavebyFP]", "{enter}")                   WinActive ("Verification Number Entry ::")                   ControlClick("Next >", "","[NAME:btnNext]") ;if   >>>> Control <<<<  does not match repeat my script, ;if match exit script  

      Class:    WindowsForm734a
      Instance:    15
      ClassnameNN:    WindowsForm34a15
      Name:    BillPrint
      Advanced (Class):    [NAME:BillPrint]
      ID:    7875
      Text:    
      Position:    39, 310
      Size:    1221, 306
      ControlClick Coords:    745, 20
      Style:    0x56010000
      ExStyle:    0x00000000
      Handle:    0x00000000000C0468
    • Skyrimfus
      By Skyrimfus
      How can i determine wich button was pressed when I use more than one button, without delcaring the button in a variable.
      Example:
      #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 600, 600, 192, 124) GUISetState(@SW_SHOW) For $i=0 to 5 GUICtrlCreateButton("Button"&$i,0,$i*50,60,30) Next #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case 3 to 8 MsgBox(0,0,"You pressed button:") EndSwitch WEnd  
    • Skyrimfus
      By Skyrimfus
      Is it possible for the graphic to be on top?
      #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### $Form1_1_1 = GUICreate("Form1", 804, 604, 192, 124) $Pic1 = GUICtrlCreatePic("car2.jpg", 656, 4, 118, 237) $Graphic1 = GUICtrlCreateGraphic(592, 4, 118, 237) GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x000000, 0xFF0000) GUICtrlSetGraphic(-1, $GUI_GR_RECT, 2, 12, 34, 38) GUICtrlSetGraphic(-1, $GUI_GR_RECT, 54, 12, 34, 38) GUICtrlSetGraphic(-1, $GUI_GR_RECT, 17, 77, 34, 38) GUICtrlSetGraphic(-1, $GUI_GR_RECT, 72, 70, 34, 38) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Now the car is on top of the squares, I can't get the squares to get on top of the car.
    • krasnoshtan
      By krasnoshtan
      Hello all! Recently I wanted to create settings window for my app, but if i want to close only child window, еhen all windows are closed. 
      #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("fisrt", 385, 248, 192, 114) $Button1 = GUICtrlCreateButton("settings", 40, 8, 97, 33) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 sett() EndSwitch WEnd Func sett() $settings_window = GUICreate("settings", 380, 100, 100, 114) $exit_button = GUICtrlCreateButton("close", 34, 80, 9, 33) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE MsgBox (0, "exit", "exit") Case $exit_button Exit EndSwitch WEnd EndFunc Help please!