Rhazz

How to configure a GUI Progress Bar by a double "for" loop

8 posts in this topic

#1 ·  Posted (edited)

Hello again, my second post in 24 hs! :P

It's my first GUI... and my first progress bar also! Sorry if I make a newbie mistake.

I want to configure a GUI Progress Bar by a double "for" loop.

Here is my code with a specific annotation with what I want to do:

Edit: new problem, I have no idea how can I continue with the next $a as if the current $a, I do not skip it because the line is an element less (I need help with both problems):

#include <GUIConstantsEx.au3>
#include <EditConstants.au3>
#include <WinAPI.au3>
#include <File.au3>
#include <String.au3>
#include <Array.au3>


Local $idGUI = GUICreate("ProgressBar", 220, 130, 100, 200)
Opt("GUIOnEventMode", 1)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEButton")
Local $idInput = GUICtrlCreateInput("",80,20,60,20,$ES_NUMBER)
Local $idProgressBar = GUICtrlCreateProgress(10, 60, 200, 20)
Local $idButton1 = GUICtrlCreateButton("Start",85,100,50)
GUICtrlSetOnEvent($idButton1, "StartProgressBar")
Local $aFileOpen = _WinAPI_GetOpenFileName("Open a text file", "Text Files (*.txt)")
Local $idCountLines = _FileCountLines($aFileOpen[2])
Local $idInputValue, $idSomething, $aFileResult, $idStringBetween

GUISetState(@SW_SHOW, $idGUI)
While 1
    Sleep(20000)
WEnd

Func StartProgressBar()
    If StringInStr($aFileOpen[2], ".txt") = True Then
        $idInputValue = Int(GUICtrlRead($idInput))
        If IsFloat($idCountLines/$idInputValue) = 1 Then
            $idStringBetween = _StringBetween(String($idCountLines/$idInputValue),"", ".")
            $idSomething = Number($idStringBetween[0]) + 1
        Else
            $idSomething = $idCountLines/$idInputValue
        EndIf
        For $i = 1 To $idSomething
            $aFileResult = @ScriptDir & "\result-" & $i & ".txt"
            _FileCreate($aFileResult)
            FileOpen($aFileResult,2)
            For $a = ( ( ( $i - 1 ) * $idInputValue ) + 1 ) To ( $i * $idInputValue )
                If FileReadLine($aFileOpen[2], $a) = "" Then
                    ; Here I have no idea how can I continue with the next $a as if the current $a, I do not skip it because the line is an element less
                EndIf
                FileWrite($aFileResult,FileReadLine($aFileOpen[2], $a) & " - ")
                ;Here I want to set the progress bar value = current percentage (line that it is currently reading) of the 100% (total of lines in the file opened)
            Next
            FileClose($aFileResult)
        Next
        MsgBox(0,"Done","Done")
        GUICtrlSetData($idProgressBar,0)
    Else
        MsgBox(0,"Hello :)","Please open a file :D")
    EndIf
EndFunc

Func CLOSEButton()
    Exit
EndFunc

 

Thanks in advance.

 

Edited by Rhazz
New problem added

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

First you need to get the percentage based on the multiplication of loop ($i*$a) real loops.  then divide  progressbar size by that multiplication.

100/($i*$a) that will result that number of necessary movement that you will use on loop. Finally you will get something like this.

#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 374, 115, 192, 124)
$Progress1 = GUICtrlCreateProgress(16, 24, 345, 49)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Local $i=300-100
Local $a=200
Local $imove=100/($i*$a)
Local $itemp=0


For $i= 100 to 300
    For $a=1 to 200
        $itemp+=$imove
        GUICtrlSetData($Progress1,$itemp)
        ;for continue with the next $a just use ContinueLoop
    Next
    $itemp+=$imove
    GUICtrlSetData($Progress1,$itemp)

Next

ConsoleWrite($itemp & @CRLF)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd
 

Saludos

Edited by Danyfirex

Share this post


Link to post
Share on other sites

First you need to get the percentage based on the multiplication of loop ($i*$a) real loops.  then divide  progressbar size by that multiplication.

100/($i*$a) that will result that number of necessary movement that you will use on loop. Finally you will get something like this.

#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 374, 115, 192, 124)
$Progress1 = GUICtrlCreateProgress(16, 24, 345, 49)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Local $i=300-100
Local $a=200
Local $imove=100/($i*$a)
Local $itemp=0


For $i= 100 to 300
    For $a=1 to 200
        $itemp+=$imove
        GUICtrlSetData($Progress1,$itemp)
        ;for continue with the next $a just use ContinueLoop
    Next
    $itemp+=$imove
    GUICtrlSetData($Progress1,$itemp)

Next

ConsoleWrite($itemp & @CRLF)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd
 

Saludos

Spanish: Veo que hablás español, así que hola! "ContinueLoop" salta la linea del primer archivo y no la agrega a la linea del segundo archivo, ejemplo:

  • Línea 1 - Línea 2 - Línea 3 -
  • Línea 5 - Línea 6 - Línea 7- Línea 8 -

Si te fijas, saltó la línea 4 (suponiendo que está vacía). Igualmente tengo que mirarlo con detenimiento para ver qué puedo hacer, pero no he tenido tiempo.

 

English: Hi, with ContinueLoop the script skips the empty line (of the first file) and therefore there is an element less in the line of the second file (the empty line of the first file becomes into empty space in the second file). e.g. the user wants four lines (of the 1st file) per line (of the 2nd file) and the fourth line (of the 1st file) is empty:

  • Line 1 - Line 2 - Line 3 -
  • Line 5 - Line 6 - Line 7 - Line 8

In the first line there is an element less.Whatever, I have to try it again, these days I didn't have much time.

Share this post


Link to post
Share on other sites

Si fijate en la ayuda y notaras un ejemplo que continueloop esquiva un determinado loop.

Yes look into help file and you will notice an example that continuwloop avoid a determined loop.

 

Saludos

Share this post


Link to post
Share on other sites

Si fijate en la ayuda y notaras un ejemplo que continueloop esquiva un determinado loop.

Yes look into help file and you will notice an example that continuwloop avoid a determined loop.

 

Saludos

I said that ContinueLoop doesn't work, I want to skip a line, not skip a loop. Sorry if I didn't explain me well. Here are another example with the code:

#include <GUIConstantsEx.au3>
#include <EditConstants.au3>
#include <WinAPI.au3>
#include <File.au3>
#include <String.au3>
#include <Array.au3>


Local $idGUI = GUICreate("ProgressBar", 220, 130, 100, 200)
Opt("GUIOnEventMode", 1)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEButton")
Local $idInput = GUICtrlCreateInput("",80,20,60,20,$ES_NUMBER)
Local $idProgressBar = GUICtrlCreateProgress(10, 60, 200, 20)
Local $idButton1 = GUICtrlCreateButton("Start",85,100,50)
GUICtrlSetOnEvent($idButton1, "StartProgressBar")
Local $aFileOpen = _WinAPI_GetOpenFileName("Open a text file", "Text Files (*.txt)")
Local $idCountLines = _FileCountLines($aFileOpen[2])
Local $idInputValue, $idSomething, $aFileResult, $idStringBetween

GUISetState(@SW_SHOW, $idGUI)
While 1
    Sleep(20000)
WEnd

Func StartProgressBar()
    If StringInStr($aFileOpen[2], ".txt") = True Then
        $idInputValue = Int(GUICtrlRead($idInput))
        If IsFloat($idCountLines/$idInputValue) = 1 Then
            $idStringBetween = _StringBetween(String($idCountLines/$idInputValue),"", ".")
            $idSomething = Number($idStringBetween[0]) + 1
        Else
            $idSomething = $idCountLines/$idInputValue
        EndIf
        For $i = 1 To $idSomething
            $aFileResult = @ScriptDir & "\result-" & $i & ".txt"
            _FileCreate($aFileResult)
            FileOpen($aFileResult,2)
            For $a = ( ( ( $i - 1 ) * $idInputValue ) + 1 ) To ( $i * $idInputValue )
                If FileReadLine($aFileOpen[2], $a) = "" Then
                    ; ContinueLoop
                    ; Here I have no idea how can I continue with the next $a as if the current $a, I do not skip it because the line is an element less
                EndIf
                GUICtrlSetData($idProgressBar, (100/($i*$a)))
                MsgBox(0,"",(100/($i*$a)))
                FileWrite($aFileResult,FileReadLine($aFileOpen[2], $a) & " - ")
                ; Here I want to set the progress bar value = current percentage (line that it is currently reading) of the 100% (total of lines in the file opened)
            Next
            FileClose($aFileResult)
        Next
        MsgBox(0,"Done","Done")
        Sleep(5000)
        GUICtrlSetData($idProgressBar,0)
    Else
        MsgBox(0,"Hello :)","Please open a file :D")
    EndIf
EndFunc

Func CLOSEButton()
    Exit
EndFunc

With a first text file that contains:

Line1
Line2
Line3
Line4

Line6
Line7
Line8
Line9
Line10
Line11
Line12

And if the user introduces "6" the result is:

  • result-1.txt --> Line1 - Line2 - Line3 - Line4 - Line6 - (five lines, the user wants six)
  • result-2.txt --> Line7 - Line8 - Line9 - Line10 - Line11 - Line12 - (six lines, great)

I have been reading the Help File and I think that there are two options that might work:

  1. Read the text file and create a temporary file without blank lines, and use it to create the final text file.
  2. Try to use _FileReadToArray

What do you think about it? What is most effectively? Are there a better option?

And with that code, the progress bar works wrong :s I didn't find the correct operation, I think that might it works with _FileReadToArray (the total of it would be 100% and the current row/position would be the current percentage).

PS: I also think maybe using _FileReadToArray might be too much work for big text files... I'm wrong?

Share this post


Link to post
Share on other sites

Simply check for a not empty line. also create a variable counter to plus one every time that is not emply line instead using $i.

 

Saludos

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Simply check for a not empty line. also create a variable counter to plus one every time that is not emply line instead using $i.

 

Saludos

That doesn't work because I need to exclude the empty lines, but what you say will return the numbers of non-empty lines and the script will read that numbers of lines but without skip the blank lines.

A good news: Finally I could set the progress bar! It works now! I used "Total Of Lines" / ("Current Line" * 100)

Finally I got the solution!!!!

I created another variable to set what line have to read the script. Here is my full code, I hope be helpful for somebody :)

#include <GUIConstantsEx.au3>
#include <EditConstants.au3>
#include <WinAPI.au3>
#include <File.au3>
#include <String.au3>
#include <Array.au3>


Local $idGUI = GUICreate("ProgressBar", 220, 130, 100, 200)
Opt("GUIOnEventMode", 1)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEButton")
Local $idInput = GUICtrlCreateInput("",80,20,60,20,$ES_NUMBER)
Local $idProgressBar = GUICtrlCreateProgress(10, 60, 200, 20)
Local $idButton1 = GUICtrlCreateButton("Start",85,100,50)
GUICtrlSetOnEvent($idButton1, "StartProgressBar")
Local $aFileOpen = _WinAPI_GetOpenFileName("Open a text file", "Text Files (*.txt)")
Local $idCountLines = _FileCountLines($aFileOpen[2])
Local $idInputValue, $idSomething, $aFileResult, $idStringBetween, $LineToRead, $totalNonEmptyLines
For $y = 1 To $idCountLines
    If FileReadLine($aFileOpen[2],$y) <> "" Then $totalNonEmptyLines += 1
Next


GUISetState(@SW_SHOW, $idGUI)
While 1
    Sleep(20000)
WEnd

Func StartProgressBar()
    If StringInStr($aFileOpen[2], ".txt") = True Then
        $idInputValue = Int(GUICtrlRead($idInput))
        If IsFloat($totalNonEmptyLines/$idInputValue) = 1 Then
            $idStringBetween = _StringBetween(String($totalNonEmptyLines/$idInputValue),"", ".")
            $idSomething = Number($idStringBetween[0]) + 1
        Else
            $idSomething = $totalNonEmptyLines/$idInputValue
        EndIf
        For $i = 1 To $idSomething
            $aFileResult = @ScriptDir & "\result-" & $i & ".txt"
            _FileCreate($aFileResult)
            FileOpen($aFileResult,2)
            For $a = ( ( ( $i - 1 ) * $idInputValue ) + 1 ) To ( $i * $idInputValue )
                $LineToRead += 1
                While FileReadLine($aFileOpen[2], $LineToRead) = ""
                    $LineToRead += 1
                    If $a = $idCountLines Then ExitLoop
                WEnd
                GUICtrlSetData($idProgressBar, (($LineToRead*100)/$totalNonEmptyLines))
                FileWrite($aFileResult,FileReadLine($aFileOpen[2], $LineToRead) & " - ")
            Next
            FileClose($aFileResult)
        Next
        MsgBox(0,"Done","Done")
        GUICtrlSetData($idProgressBar,0)
    Else
        MsgBox(0,"Hello :)","Please open a file :D")
    EndIf
EndFunc

Func CLOSEButton()
    Exit
EndFunc

 

Edited by Rhazz
Finally solved!

Share this post


Link to post
Share on other sites

This is an Old post but anyways here an Advise:

Why you dont use Round(), you will avoid unnecessary call to _StringBetween?
Your Code:

If IsFloat($totalNonEmptyLines/$idInputValue) = 1 Then
            $idStringBetween = _StringBetween(String($totalNonEmptyLines/$idInputValue),"", ".")
            $idSomething = Number($idStringBetween[0]) + 1

What I would probably do:
 

If IsFloat($totalNonEmptyLines/$idInputValue) = 1 Then
            $id = Round($totalNonEmptyLines/$idInputValue),0)
            $idnum = Number($id + 1)

This is just an Idea but I think is more efficient.

Kind Regards
Alien
 

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

  • Similar Content

    • mpower
      By mpower
      Hi guys,
      So I am facing an issue with my Listview control flickering like crazy when using the Modern GUI UDF.
      I understand that the reson is because Listviews do not play nice with the $WS_EX_COMPOSITED extended style which is necessary to prevent the rest of the GUI components flickering on resizing.
      I am looking for suggestions on how I can overcome the flickering issue without having to remove the Listview header (as I need the header to allow column resizing and sorting).
      The reproducer is here and the lightly modified Modern GUI UDF is attached as a zip (I added $WS_CLIPCHILDREN and $WS_EX_COMPOSITED to the _Metro_CreateGUI() function in order to stop flickering of other controls like buttons/labels/toggles etc).
      ;!Highly recommended for improved overall performance and responsiveness of the GUI effects etc.! (after compiling): #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/so /rm /pe ;Required if you want High DPI scaling enabled. (Also requries _Metro_EnableHighDPIScaling()) #AutoIt3Wrapper_Res_HiDpi=y #include-once #NoTrayIcon #include "MetroGUI-UDF\MetroGUI_UDF.au3" #include <GuiListView.au3> $gui = _Metro_CreateGUI("example", 800, 600, -1, -1, True) ;Add/create control buttons to the GUI $Control_Buttons = _Metro_AddControlButtons(True, True, True, True, False) ;CloseBtn = True, MaximizeBtn = True, MinimizeBtn = True, FullscreenBtn = True, MenuBtn = True ;Set variables for the handles of the GUI-Control buttons. (Above function always returns an array this size and in this order, no matter which buttons are selected. $GUI_CLOSE_BUTTON = $Control_Buttons[0] $GUI_MAXIMIZE_BUTTON = $Control_Buttons[1] $GUI_RESTORE_BUTTON = $Control_Buttons[2] $GUI_MINIMIZE_BUTTON = $Control_Buttons[3] $GUI_FULLSCREEN_BUTTON = $Control_Buttons[4] $GUI_FSRestore_BUTTON = $Control_Buttons[5] ;====================================================================================================================================================================== $Button1 = _Metro_CreateButtonEx("Add new item(s)", 20, 20, 130, 50) $Button2 = _Metro_CreateButtonEx("Edit item(s)", 170, 20, 130, 50) $ListView2 = GUICtrlCreateListView("", 0, 86, 800, 400, BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE) _GUICtrlListView_SetExtendedListViewStyle($ListView2, BitOR($LVS_EX_DOUBLEBUFFER, $LVS_EX_GRIDLINES, $LVS_EX_SUBITEMIMAGES, $LVS_EX_FLATSB)) For $i = 0 to 8 _GUICtrlListView_AddColumn($ListView2, "col " &$i) Next _GUICtrlListView_SetBkColor($ListView2, 0xF3F3F3) _GUICtrlListView_SetTextBkColor($ListView2, 0xF3F3F3) ;Set resizing options for the controls so they don't change in size or position. This can be customized to match your gui perfectly for resizing. See AutoIt Help file. GUICtrlSetResizing($Button1, 768 + 2 + 32) GUICtrlSetResizing($Button2, 768 + 2 + 32) GUICtrlSetResizing($ListView2, 102) GUISetState(@SW_SHOW) While 1 _Metro_HoverCheck_Loop($gui) ;This hover check has to be added to the main While loop, otherwise the hover effects won't work. $nMsg = GUIGetMsg() Switch $nMsg ;=========================================Control-Buttons=========================================== Case $GUI_EVENT_CLOSE, $GUI_CLOSE_BUTTON _Metro_GUIDelete($gui) ;Delete GUI/release resources, make sure you use this when working with multiple GUIs! Exit Case $GUI_MAXIMIZE_BUTTON GUISetState(@SW_MAXIMIZE) Case $GUI_RESTORE_BUTTON GUISetState(@SW_RESTORE) Case $GUI_MINIMIZE_BUTTON GUISetState(@SW_MINIMIZE) Case $GUI_FULLSCREEN_BUTTON, $GUI_FSRestore_BUTTON _Metro_FullscreenToggle($gui, $Control_Buttons) EndSwitch WEnd Any suggestions would be greately appreciated.
      Cheers!
      MetroGUI-UDF.zip
    • IamKJ
      By IamKJ
      So I have a lot of different functions in the little program I'm making.  Most of them use the Do statement, such as finding images, clicking buttons, etc.
       
      The question I have is how would I be able to both
      1) Create a hotkey to pause whatever I am doing at the moment.  If I have to put something into every function in the program, I don't mind.
      2) Create a hotkey to exit whatever I am doing and stop all loops or commands and bring back the main GUI?
    • rootx
      By rootx
      someone made a modern Gui like windows 10 style. thx
    • FrancescoDiMuro
      By FrancescoDiMuro
      Good morning community!
      I was working on a script which read the content of a .ini file to retrieve the file that has to open, and, based on the value of a second key stored in the .ini file, set the window on top, minimized or maximized...
      I did something like this, but seems to not work properly...
      Could anyone please tell me what I'm doing wrong?
      Thank you  
       
      #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile_x64=prova.exe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <AutoItConstants.au3> ;#include <WinAPIEx.au3> #include <Array.au3> Local $sFileConfigurazione = @ScriptDir & "\configurazione_exe.ini" If(FileExists($sFileConfigurazione)) Then Local $aSezioneIni = IniReadSection($sFileConfigurazione, "CONFIGURAZIONE_EXE") If @error Then MsgBox($MB_ICONERROR, "Errore!", "Errore durante l'apertura del file: " & @CRLF & $sFileConfigurazione & @CRLF & "Errore: " & @error) Else ; Lancio dell'applicativo indicato nel file di configurazione Local $iPID = ShellExecute($aSezioneIni[1][1]) Local $hWnd If($iPID <> 0) Then Local $aWinList = WinList() For $i = 1 To $aWinList[0][0] If(WinGetProcess($aWinList[$i][1] = $iPID)) Then $hWnd = $aWinList[$i][1] EndIf Next Switch($aSezioneIni[2][1]) Case $aSezioneIni[2][1] = "MIN" ToolTip("MIN", 0, 0) WinSetState($hWnd, WinGetTitle($hWnd), @SW_MINIMIZE) Case $aSezioneIni[2][1] = "MAX" ToolTip("MAX", 0, 0) WinSetState($hWnd, WinGetTitle($hWnd), @SW_MAXIMIZE) Case $aSezioneIni[2][1] = "TOP" ToolTip("TOP", 0, 0) WinSetOnTop($hWnd, WinGetTitle($hWnd), $WINDOWS_ONTOP) EndSwitch EndIf EndIf EndIf And the .ini file is like this:
       
      [CONFIGURAZIONE_EXE] PercorsoExe=Here goes the path and the .exe to execute ModalitaAperturaExe=Here goes one of the value below /* TOP Shows the windows on top */ /* MIN Shows the window minimized */ /* MAX Shows the window maximized */  
    • antonioj84
      By antonioj84
      #include <GUIConstantsEx.au3> #include "GUIExtender.au3" $hGUI = GUICreate("Move Example", 250, 230) GUICtrlCreateGroup(" Choose Orientation ", 10, 10, 230, 80) $cRadio_Horz = GUICtrlCreateRadio(" Horizontal ", 20, 30, 100, 20) GUICtrlSetState(-1, $GUI_CHECKED) $cRadio_Vert = GUICtrlCreateRadio(" Vertical ", 20, 60, 100, 20) GUICtrlCreateGroup(" Choose Move Style ", 10, 100, 230, 110) $cRadio_0 = GUICtrlCreateRadio(" Fix Left ", 20, 120, 100, 20) $cRadio_1 = GUICtrlCreateRadio(" Fix Centre ", 20, 150, 100, 20) $cRadio_2 = GUICtrlCreateRadio(" Fix Right ", 20, 180, 100, 20) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cRadio_Horz GUICtrlSetData($cRadio_0, " Fix Left ") GUICtrlSetState($cRadio_0, $GUI_UNCHECKED) GUICtrlSetState($cRadio_1, $GUI_UNCHECKED) GUICtrlSetData($cRadio_2, " Fix Right ") GUICtrlSetState($cRadio_2, $GUI_UNCHECKED) Case $cRadio_Vert GUICtrlSetData($cRadio_0, " Fix Top ") GUICtrlSetState($cRadio_0, $GUI_UNCHECKED) GUICtrlSetState($cRadio_1, $GUI_UNCHECKED) GUICtrlSetData($cRadio_2, " Fix Bottom ") GUICtrlSetState($cRadio_2, $GUI_UNCHECKED) Case $cRadio_0 _Create_GUI(0) Case $cRadio_1 _Create_GUI(1) Case $cRadio_2 _Create_GUI(2) EndSwitch WEnd Func _Create_GUI($iMove) Local $sTitle Switch $iMove Case 0 If GUICtrlRead($cRadio_Horz) = 1 Then $sTitle = "Fixed Left" Else $sTitle = "Fixed Top" EndIf Case 1 $sTitle = "Fixed Centre" Case 2 If GUICtrlRead($cRadio_Horz) = 1 Then $sTitle = "Fixed Right" Else $sTitle = "Fixed Bottom" EndIf EndSwitch GUISetState(@SW_HIDE, $hGUI) $hGUI_Ex = GUICreate($sTitle, 500, 500) If GUICtrlRead($cRadio_Horz) = 1 Then _GUIExtender_Init($hGUI_Ex, 1, $iMove) _GUIExtender_Section_Create($hGUI_Ex, 0, 250) _GUIExtender_Section_Activate($hGUI_Ex, 2, "", "", 220, 10, 20, 20) _GUIExtender_Section_Create($hGUI_Ex, 250, 250) GUICtrlCreateLabel("", 250, 0, 250, 500) GUICtrlSetBkColor(-1, 0xFFCCCC) _GUIExtender_Section_Create($hGUI_Ex, -99) Else _GUIExtender_Init($hGUI_Ex, 0, $iMove) _GUIExtender_Section_Create($hGUI_Ex, 250, 0) _GUIExtender_Section_Activate($hGUI_Ex, 2, "", "", 470, 220, 20, 20) _GUIExtender_Section_Create($hGUI_Ex, 250, 250) GUICtrlCreateLabel("", 0, 250, 500, 250) GUICtrlSetBkColor(-1, 0xFFCCCC) _GUIExtender_Section_Create($hGUI_Ex, -99) EndIf _GUIExtender_Section_Action($hGUI_Ex, 2, False) GUISetState() While 1 $aMsg = GUIGetMsg(1) Switch $aMsg[0] Case $GUI_EVENT_CLOSE GUISetState(@SW_SHOW, $hGUI) GUIDelete($hGUI_Ex) _GUIExtender_Clear($hGUI_Ex) ExitLoop EndSwitch _GUIExtender_EventMonitor($aMsg[1], $aMsg[0]) ; Check for click on Action control WEnd EndFunc I am trying to implement 2 side window toggle hide and show with 2 different menu.  can someone give me some direction  thanks