Sign in to follow this  
Followers 0
zvvyt

Dynamically created GUIs with simultaneous minimize/restore but only one "shown" window

8 posts in this topic

Hello ya'll!

My problem is split in two, so I'll start with the first one:

What I'm having is my script with dynamically created GUIs with similar / identical names. I would like to have that undepending on how many windows I have open to only have one "window" down at the taskbar.

I guess all I need is the correct GUI style, but I can't find which one I need.

Which brings me to problem part 2 (which I also find to be the easy part):

Windows will open and close on random, so there's no set order in which they'll get closed. But I still need one "window" at the taskbar to work with as long as there's at least one window open.

In the action of one of these windows getting minimized/restored all of the windows will act simultaneously.

This will be solved with something similar: 

case $GUI_EVENT_MINIMIZE
         for $1 = 1 to Ubound($ActiveWindows) step +1
                WinSetState($ActiveWindows[$1], @SW_MINIMIZE)
        Next

And vice versa for restore.

So .. Mainly prob #1 that I need some help with, and a thought about the "always one window at taskbar"-issue.

Just point me in the right direction and I'll hopefully solve it myself ^__^'

Thanks, and have a great weekend!

zvvyt

Share this post


Link to post
Share on other sites



have a look:

Opt("TrayIconHide", 1) ; this will hide all
; or
TraySetState(2) ; will hide the tray icon

I'm not sure if this will leave you 1 tray icon for at least 1 window; I'm sure a guru will chime in ;)

To minimize all you can do the following:

WinMinimizeAll() ; this will minimize all windows
;or
Local $ShellObj = ObjCreate("Shell.Application")
$ShellObj.ToggleDesktop() ; will minimize all currently open windows -- if called again, it will bring up all windows minimized by ToggleDesktop()

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Share this post


Link to post
Share on other sites

zvvyt,

To hide the button on the taskbar you need to set another GUI as the "parent" in the GUICreate call. So it sounds like you could do with a "master" GUI with all the others as children. :)

Is that enough to get you going? :huh:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

 

have a look:

Opt("TrayIconHide", 1) ; this will hide all
; or
TraySetState(2) ; will hide the tray icon

I'm not sure if this will leave you 1 tray icon for at least 1 window; I'm sure a guru will chime in ;)

I'm sorry if I were unclear, but it's not in the tray where I only want one icon, but on the taskbar where only the open windows are.

To minimize all you can do the following:

WinMinimizeAll() ; this will minimize all windows
;or
Local $ShellObj = ObjCreate("Shell.Application")
$ShellObj.ToggleDesktop() ; will minimize all currently open windows -- if called again, it will bring up all windows minimized by ToggleDesktop()

I only want to minimize the windows I've made myself, which all have about the same name.

To hide the button on the taskbar you need to set another GUI as the "parent" in the GUICreate call. So it sounds like you could do with a "master" GUI with all the others as children. :)

Is that enough to get you going? :huh:

Well, both yay and nay.

I've tried with a hidden GUI as I don't want to have another window active and primary all the GUIs in this script are made dynamically, but I couldn't get that to work.

When I try to minimize child GUIs whos parent is hidden they don't have anywhere to go, so to say. See my attachment at the bottom.

Have a look at the script in it's whole. And I'm sorry if some of the texts are hard to understand as the are in swedish, but all of the relevant text should be in proper english :)

#cs
Unlimited, controllable windows

$WinArray[n][0] = GUI winhandle
$WinArray[n][1] = Rich winhandle
$WinArray[n][2] = GUI height
$WinArray[n][3] = GUI width
$WinArray[n][4] = Rich color
$WinArray[n][5] = Rich textsize

$SaveArray[0] = GUI-name minus "LAN-notes"
$SaveArray[1] =
#ce
Opt("GUIOnEventMode", 1)
Opt("TrayMenuMode", 1 + 2)
Opt("TrayOnEventMode",1)
#include <array.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
#include <TrayConstants.au3>
#include <GuiRichEdit.au3>
#include <GuiMenu.au3>
#include <GuiComboBox.au3>
#include <Color.au3>

TrayCreateItem("LAN-notes")
TrayItemSetState(-1, $TRAY_DISABLE)
TrayCreateItem("")
TrayCreateItem("Ny lapp")
TrayItemSetOnEvent(-1, "New")
TrayCreateItem("")
TrayCreateItem("Följ lapp")
TrayItemSetOnEvent(-1, "LoadList")
TrayCreateItem("")
TrayCreateItem("Stäng av")
TrayItemSetOnEvent(-1,"TrayExit")
TraySetState(1)

Global Enum $idCopy = 1000, $idPaste, $idUndo, $idSelectAll, $idFontsize, $idBkColor, $idCut, $idTest

Global $WinArray[1][6], $GUI_Size[4], $Font_hFont ,$BkColor_RedInputPrev = 0, $BkColor_GreenInputPrev = 0, $BkColor_BlueInputPrev = 0, _
    $BkColor_RedInputPrevSaved = 0, $BkColor_GreenInputPrevSaved = 0, $BkColor_BlueInputPrevSaved = 0, $ColorEventsVal = 0, $BkColor_OK, $BkColor_Cancel, $FontEventsVal = 0, _
    $Font_OK, $Font_Cancel

$hWnd = GUICreate("",0,0) ;-------------------------------------------------- Hidden parentGUI
GUISetState(@SW_HIDE,-1)

Call("New")
while 1
    Sleep(10)
    $Current_GUI = WinGetHandle("[ACTIVE]")
    If _ArraySearch($WinArray,$Current_GUI) <> -1 And WinGetState($Current_GUI) = BitOR(1,2,4,8) Then
        $GUI_Size = WinGetPos($Current_GUI)
        $Current_Rich = $WinArray[_ArraySearch($WinArray,$Current_GUI)][1]
        ;$Rich_Size = GUICtrlSetPos($Current_Rich)
        If $GUI_Size[2] <> $WinArray[_ArraySearch($WinArray,$Current_GUI)][2] Or $GUI_Size[3] <> $WinArray[_ArraySearch($WinArray,$Current_GUI)][3] Then
            _WinAPI_MoveWindow($Current_Rich,0,20,$GUI_Size[2]-20,$GUI_Size[3]-60)
            $WinArray[_ArraySearch($WinArray,$Current_GUI)][2] = $GUI_Size[2]
            $WinArray[_ArraySearch($WinArray,$Current_GUI)][3] = $GUI_Size[3]
        EndIf
    EndIf
WEnd

Func New()
ReDim $WinArray[UBound($WinArray,1)+1][6]

$WinArray[UBound($WinArray,1)-1][0] = GUICreate("LAN-notes - ",200,200,Default,Default,BitOR($ws_sizebox,$WS_MINIMIZEBOX),-1,$hWnd) ;-------------------------------------------------- Dynamical childGUIs
$WinArray[UBound($WinArray,1)-1][2] = 200
$WinArray[UBound($WinArray,1)-1][3] = 200
$WinArray[UBound($WinArray,1)-1][4] = "255,255,255"
$WinArray[UBound($WinArray,1)-1][5] = 8

GUISetOnEvent($GUI_EVENT_CLOSE, "MainEvents")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "MainEvents")
GUICtrlCreateButton("+",0,0,20,20)
    GUICtrlSetTip(-1,"Skapa ny lapp")
    GUICtrlSetFont(-1,12)
    GUICtrlSetOnEvent(-1,"New")
GUICtrlCreateButton("Spara",20,0,35,20)
    GUICtrlSetOnEvent(-1,"Save")
;GUICtrlCreateButton("Test", 50,80)
    ;GUICtrlSetOnEvent(-1,"Test")
GUICtrlCreateInput("",55,0,105,20)
    GUICtrlSetState(-1,$GUI_DISABLE)
GUICtrlCreateButton("Ändra",160,0,35,20)
    GUICtrlSetOnEvent(-1,"EditProjName")
$WinArray[UBound($WinArray,1)-1][1] = _GUICtrlRichEdit_Create($WinArray[UBound($WinArray,1)-1][0], "",0,25,180,160, BitOR($ES_AUTOVSCROLL, $WS_VSCROLL, $ES_WANTRETURN,$ES_MULTILINE))
_GUICtrlRichEdit_SetFont($WinArray[UBound($WinArray,1)-1][1], 8)

Global $hMenu = _GUICtrlMenu_CreatePopup()

_GUICtrlMenu_AddMenuItem($hMenu, "Ångra", $idUndo)
_GUICtrlMenu_AddMenuItem($hMenu, "")
_GUICtrlMenu_AddMenuItem($hMenu, "Klipp ut", $idCut)
_GUICtrlMenu_AddMenuItem($hMenu, "Kopiera", $idCopy)
_GUICtrlMenu_AddMenuItem($hMenu, "Klistra in", $idPaste)
_GUICtrlMenu_AddMenuItem($hMenu, "Markera allt", $idSelectAll)
_GUICtrlMenu_AddMenuItem($hMenu, "")
_GUICtrlMenu_AddMenuItem($hMenu, "Textstorlek", $idFontsize)
_GUICtrlMenu_AddMenuItem($hMenu, "Bakgrundsfärg", $idBkColor)
_GUICtrlMenu_AddMenuItem($hMenu, "")
_GUICtrlMenu_AddMenuItem($hMenu, "Test", $idTest)

Global $wProcHandle = DllCallbackRegister("_WindowProc", "ptr", "hwnd;uint;wparam;lparam")

Global $wProcOld = _WinAPI_SetWindowLong($WinArray[UBound($WinArray,1)-1][1], $GWL_WNDPROC, DllCallbackGetPtr($wProcHandle))

GUISetState()

EndFunc

Func Test($RichTest)
    If _GUICtrlRichEdit_GetTextLength($RichTest, True, True) > 0 Then
        Local $RichPrevFontSize, $RichPrevFontSizeChange, $RichStringFonts, $RichCurrentFontSize
        For $1 = 0 To _GUICtrlRichEdit_GetTextLength($RichTest, True, True) Step +1
            _GUICtrlRichEdit_SetSel($RichTest,$1,$1)
            If $1 = 0 Then
                $RichPrevFontSize = _GUICtrlRichEdit_GetFont($RichTest)
                $RichPrevFontSizeChange = $1
                $RichStringFonts = String("<" & $RichPrevFontSize[0] & ">")
            ElseIf $1 > 0 Then
                $RichCurrentFontSize = _GUICtrlRichEdit_GetFont($RichTest)
                If $RichCurrentFontSize[0] <> $RichPrevFontSize[0] Then
                    $RichCurrentFontSizeChange = $1-1
                    If $RichPrevFontSizeChange <> 0 Then $RichPrevFontSizeChange = $RichPrevFontSizeChange-1
                    $RichStringFonts = String($RichStringFonts & _GUICtrlRichEdit_GetTextInRange($RichTest,$RichPrevFontSizeChange,$RichCurrentFontSizeChange) & "<" & $RichPrevFontSize[0] & ">" & "<" & $RichCurrentFontSize[0] & ">")
                    $RichPrevFontSize[0] = $RichCurrentFontSize[0]
                    $RichPrevFontSizeChange = $1
                EndIf
            EndIf
        Next
        If $RichPrevFontSizeChange <> 0 Then $RichPrevFontSizeChange = $RichPrevFontSizeChange-1
        $RichStringFonts = String($RichStringFonts & _GUICtrlRichEdit_GetTextInRange($RichTest,$RichPrevFontSizeChange, $1) & "<" & $RichPrevFontSize[0] & ">")
        ConsoleWrite($RichStringFonts & @CRLF)
    EndIf
EndFunc

Func MainEvents()
    Select
        Case @GUI_CtrlId = $GUI_EVENT_CLOSE
            If WinExists("LAN-notes - ") Then
                If MsgBox(4,"Stäng?","Är du säker på att du vill stänga lappen?") = 6 Then
                    For $1 = (_ArraySearch($WinArray,@GUI_WinHandle)) To (UBound($WinArray,1)-2) Step +1
                        $WinArray[$1][0] = $WinArray[$1+1][0]
                        $WinArray[$1][1] = $WinArray[$1+1][1]
                        $WinArray[$1][2] = $WinArray[$1+1][2]
                        $WinArray[$1][3] = $WinArray[$1+1][3]
                    Next
                    ReDim $WinArray[UBound($WinArray,1)-1][4]
                    GUIDelete(@GUI_WinHandle)
                EndIf
            EndIf
    EndSelect
EndFunc

Func EditProjName()
    ConsoleWrite("Edit projName" & @CRLF)
    If GUICtrlGetState(@GUI_CtrlId-1) = 144 Then
        GUICtrlSetState(@GUI_CtrlId-1,$GUI_ENABLE)
        GUICtrlSetData(@GUI_CtrlId,"Klar")
    Else
        WinSetTitle(@GUI_WinHandle,"","LAN-notes - " & GUICtrlRead(@GUI_CtrlId-1))
        GUICtrlSetState(@GUI_CtrlId-1,$GUI_DISABLE)
        GUICtrlSetData(@GUI_CtrlId,"Ändra")
    EndIf
EndFunc

Func Save()
    ConsoleWrite("--> Save" & @CRLF)
    ConsoleWrite(StringReplace(WinGetTitle(@GUI_WinHandle),"LAN-notes - ","") & @CRLF)
EndFunc

Func TrayExit()
    ConsoleWrite("TrayExit")
    If MsgBox(4,"Stäng?","Är du säker på att du vill stänga av?") = 6 Then
        DllCallbackFree($wProcHandle)
        Exit
    EndIf
EndFunc

Func _WindowProc($hWnd, $Msg, $wParam, $lParam)
    $GUI = WinActive("LAN-notes - ")
    If _ArraySearch($WinArray,$GUI) <> -1 Then
    Switch $hWnd
        Case $WinArray[_ArraySearch($WinArray,$GUI)][1]
            Switch $Msg
                Case $WM_RBUTTONUP
                    ConsoleWrite("-> Rightclick" & @LF)
                    _GUICtrlMenu_TrackPopupMenu($hMenu, $hWnd)
                    Return 0
                Case $WM_COMMAND
                    Switch $wParam
                        Case $idCut
                            ConsoleWrite("-> Cut" & @LF)
                            _GUICtrlRichEdit_Cut($WinArray[_ArraySearch($WinArray,$GUI)][1])
                        Case $idCopy
                            ConsoleWrite("-> Copy" & @LF)
                            _GUICtrlRichEdit_Copy($WinArray[_ArraySearch($WinArray,$GUI)][1])
                        Case $idPaste
                            ConsoleWrite("-> Paste" & @LF)
                            _GUICtrlRichEdit_Paste($WinArray[_ArraySearch($WinArray,$GUI)][1])
                        Case $idUndo
                            ConsoleWrite("-> Undo" & @LF)
                            _GUICtrlRichEdit_Undo($WinArray[_ArraySearch($WinArray,$GUI)][1])
                        Case $idSelectAll
                            ConsoleWrite("-> Select all" & @LF)
                            _GUICtrlRichEdit_SetSel($WinArray[_ArraySearch($WinArray,$GUI)][1],0,StringLen(_GUICtrlRichEdit_GetText($WinArray[_ArraySearch($WinArray,$GUI)][1])))
                        Case $idFontsize
                            ConsoleWrite("-> Size" &@LF)
                            $Return_Font = _Fontsize($GUI,$WinArray[_ArraySearch($WinArray,$GUI)][5])
                            ConsoleWrite($Return_Font&@CRLF)
                            If $Return_Font <> 0 Then
                                $Text_Selected = _GUICtrlRichEdit_GetSel($WinArray[_ArraySearch($WinArray,$GUI)][1])
                                If $Text_Selected[0] = $Text_Selected[1] Then
                                    _GUICtrlRichEdit_SetSel($WinArray[_ArraySearch($WinArray,$GUI)][1],0,_GUICtrlRichEdit_GetTextLength($WinArray[_ArraySearch($WinArray,$GUI)][1],True,True))
                                    _GUICtrlRichEdit_SetFont($WinArray[_ArraySearch($WinArray,$GUI)][1],$Return_Font)
                                    _GUICtrlRichEdit_SetSel($WinArray[_ArraySearch($WinArray,$GUI)][1],$Text_Selected[0],$Text_Selected[0])
                                Else
                                    _GUICtrlRichEdit_SetFont($WinArray[_ArraySearch($WinArray,$GUI)][1],$Return_Font)
                                EndIf
                            EndIf
                        Case $idBkColor
                            ConsoleWrite("-> BkColor" &@LF)
                            $Return_BkColor = _BkColor($GUI)
                            If $Return_BkColor <> 0 Then _GUICtrlRichEdit_SetBkColor($WinArray[_ArraySearch($WinArray,$GUI)][1],$Return_BkColor)
                        Case $idTest
                            ConsoleWrite("-> Test" &@LF)
                            Call("Test",$WinArray[_ArraySearch($WinArray,$GUI)][1])
                    EndSwitch
            EndSwitch
    EndSwitch
    endif
    Local $aRet = DllCall("user32.dll", "int", "CallWindowProc", "ptr", $wProcOld, _
                          "hwnd", $hWnd, "uint", $Msg, "wparam", $wParam, "lparam", $lParam)
    Return $aRet[0]
EndFunc

Func _BkColor($hGui)
    $PrevBkColors = StringSplit($WinArray[_ArraySearch($WinArray,$hGui)][4],",")
    $BkColor_RedInputPrevSaved = $PrevBkColors[1]
    $BkColor_GreenInputPrevSaved = $PrevBkColors[2]
    $BkColor_BlueInputPrevSaved = $PrevBkColors[3]
    $hGui_BkColor = GUICreate("Ställ bakgrundsfärg", 250,150,-1,-1,$WS_border, -1,$hGui)
    $BkColor_MainInput = GUICtrlCreateCombo("Vit", 90,15,70)
    If $BkColor_RedInputPrevSaved = 255 And $BkColor_GreenInputPrevSaved = 255 And $BkColor_BlueInputPrevSaved = 255 Then GUICtrlSetData(-1,"Röd|Grön|Blå|Svart|Egen","Vit")
    If $BkColor_RedInputPrevSaved = 255 And $BkColor_GreenInputPrevSaved = 0 And $BkColor_BlueInputPrevSaved = 0 Then GUICtrlSetData(-1,"Röd|Grön|Blå|Svart|Egen","Röd")
    If $BkColor_RedInputPrevSaved = 0 And $BkColor_GreenInputPrevSaved = 255 And $BkColor_BlueInputPrevSaved = 0 Then GUICtrlSetData(-1,"Röd|Grön|Blå|Svart|Egen","Grön")
    If $BkColor_RedInputPrevSaved = 0 And $BkColor_GreenInputPrevSaved = 0 And $BkColor_BlueInputPrevSaved = 255 Then GUICtrlSetData(-1,"Röd|Grön|Blå|Svart|Egen","Blå")
    If $BkColor_RedInputPrevSaved = 0 And $BkColor_GreenInputPrevSaved = 0 And $BkColor_BlueInputPrevSaved = 0 Then GUICtrlSetData(-1,"Röd|Grön|Blå|Svart|Egen","Svart")
    If ($BkColor_RedInputPrevSaved <> 0 And $BkColor_RedInputPrevSaved <> 255) Or ($BkColor_GreenInputPrevSaved <> 0 And $BkColor_GreenInputPrevSaved <> 255) Or _
        ($BkColor_BlueInputPrevSaved <> 0 And $BkColor_BlueInputPrevSaved <> 255) Then GUICtrlSetData(-1,"Röd|Grön|Blå|Svart|Egen","Egen")
    GUICtrlCreateLabel("Röd", 10,40,30)
    GUICtrlSetColor(-1, 0xFF0000)
    GUICtrlCreateLabel("Grön", 10,60,30)
    GUICtrlSetColor(-1, 0x00FF00)
    GUICtrlCreateLabel("Blå", 10,80,30)
    GUICtrlSetColor(-1, 0x0000FF)
    $BkColor_Red = GUICtrlCreateSlider(35,40,120,-1)
    GUICtrlSetLimit(-1,255)
    GUICtrlSetData(-1, $BkColor_RedInputPrevSaved)
    $BkColor_Green = GUICtrlCreateSlider(35,60,120,-1)
    GUICtrlSetLimit(-1,255)
    GUICtrlSetData(-1, $BkColor_GreenInputPrevSaved)
    $BkColor_Blue = GUICtrlCreateSlider(35,80,120,-1)
    GUICtrlSetLimit(-1,255)
    GUICtrlSetData(-1,$BkColor_BlueInputPrevSaved)
    $BkColor_RedInput = GUICtrlCreateInput($BkColor_RedInputPrevSaved,160,40,40,20,$ES_NUMBER)
    GUICtrlSetLimit(-1,255)
    $BkColor_GreenInput = GUICtrlCreateInput($BkColor_GreenInputPrevSaved,160,60,40,20,$ES_NUMBER)
    GUICtrlSetLimit(-1,255)
    $BkColor_BlueInput = GUICtrlCreateInput($BkColor_BlueInputPrevSaved,160,80,40,20,$ES_NUMBER)
    GUICtrlSetLimit(-1,255)
    $BkColor_OK = GUICtrlCreateButton("OK", 25,100,50,25)
    GUICtrlSetOnEvent(-1,"ColorEvents")
    $BkColor_Cancel = GUICtrlCreateButton("Avbryt", 75,100,50,25)
    GUICtrlSetOnEvent(-1,"ColorEvents")
    Local $BkColor_RedPrev = $BkColor_RedInputPrevSaved, $BkColor_GreenPrev = $BkColor_GreenInputPrevSaved, $BkColor_BluePrev = $BkColor_BlueInputPrevSaved, $BkColor_MainInputPrev
    $BkColor_Prev = $BkColor_RedInputPrevSaved*65536+$BkColor_GreenInputPrevSaved*256+$BkColor_BlueInputPrevSaved
    $BkColor_ExampleColor = GUICtrlCreateLabel("",210,40,30,60)
    GUICtrlSetColor(-1, $BkColor_Prev)
    GUISetState(@SW_DISABLE, $hGui)
    GUISetState(@SW_SHOW, $hGui_BkColor)
    While 1
        If _GUICtrlComboBox_GetDroppedState($BkColor_MainInput) = False Then
            If $ColorEventsVal = 1 Then
                GUIDelete($hGui_BkColor)
                GUISetState(@SW_ENABLE,$hGui)
                WinActivate($hGui)
                $ColorEventsVal = 0
                Return 0
                ExitLoop
            ElseIf $ColorEventsVal = 2 Then
                $WinArray[_ArraySearch($WinArray,$hGui)][4] = GUICtrlRead($BkColor_RedInput)&","&GUICtrlRead($BkColor_GreenInput)&","&GUICtrlRead($BkColor_BlueInput)
                Local $BkColor_ColorArray[3] = [GUICtrlRead($BkColor_RedInput), GUICtrlRead($BkColor_GreenInput), GUICtrlRead($BkColor_BlueInput)]
                $BkColor_Color = _ColorSetCOLORREF($BkColor_ColorArray)
                ConsoleWrite($BkColor_Color&@CRLF)
                GUIDelete($hGui_BkColor)
                GUISetState(@SW_ENABLE,$hGui)
                WinActivate($hGui)
                $ColorEventsVal = 0
                Return $BkColor_Color
                ExitLoop
            EndIf
        If GUICtrlRead($BkColor_MainInput) <> $BkColor_MainInputPrev Then
            ConsoleWrite(GUICtrlRead($BkColor_MainInput)&@CRLF)
            If GUICtrlRead($BkColor_MainInput) = "Vit" Then
                ConsoleWrite("Set to white"&@CRLF)
                GUICtrlSetData($BkColor_Red,255)
                $BkColor_RedPrev = 255
                GUICtrlSetData($BkColor_RedInput,255)
                $BkColor_RedInputPrev = 255
                GUICtrlSetData($BkColor_Green,255)
                $BkColor_GreenPrev = 255
                GUICtrlSetData($BkColor_GreenInput,255)
                $BkColor_GreenInputPrev = 255
                GUICtrlSetData($BkColor_Blue,255)
                $BkColor_BluePrev = 255
                GUICtrlSetData($BkColor_BlueInput,255)
                $BkColor_BlueInputPrev = 255
            EndIf
            If GUICtrlRead($BkColor_MainInput) =  "Röd" Then
                ConsoleWrite("Set to red"&@CRLF)
                GUICtrlSetData($BkColor_Red,255)
                $BkColor_RedPrev = 255
                GUICtrlSetData($BkColor_RedInput,255)
                $BkColor_RedInputPrev = 255
                GUICtrlSetData($BkColor_Green,0)
                $BkColor_GreenPrev = 0
                GUICtrlSetData($BkColor_GreenInput,0)
                $BkColor_GreenInputPrev = 0
                GUICtrlSetData($BkColor_Blue,0)
                $BkColor_BluePrev = 0
                GUICtrlSetData($BkColor_BlueInput,0)
                $BkColor_BlueInputPrev = 0
            EndIf
            If GUICtrlRead($BkColor_MainInput) =  "Grön" Then
                ConsoleWrite("Set to green"&@CRLF)
                GUICtrlSetData($BkColor_Red,0)
                $BkColor_RedPrev = 0
                GUICtrlSetData($BkColor_RedInput,0)
                $BkColor_RedInputPrev = 0
                GUICtrlSetData($BkColor_Green,255)
                $BkColor_GreenPrev = 255
                GUICtrlSetData($BkColor_GreenInput,255)
                $BkColor_GreenInputPrev = 255
                GUICtrlSetData($BkColor_Blue,0)
                $BkColor_BluePrev = 0
                GUICtrlSetData($BkColor_BlueInput,0)
                $BkColor_BlueInputPrev = 0
            EndIf
            If GUICtrlRead($BkColor_MainInput) =  "Blå" Then
                ConsoleWrite("Set to blue"&@CRLF)
                GUICtrlSetData($BkColor_Red,0)
                $BkColor_RedPrev = 0
                GUICtrlSetData($BkColor_RedInput,0)
                $BkColor_RedInputPrev = 0
                GUICtrlSetData($BkColor_Green,0)
                $BkColor_GreenPrev = 0
                GUICtrlSetData($BkColor_GreenInput,0)
                $BkColor_GreenInputPrev = 0
                GUICtrlSetData($BkColor_Blue,255)
                $BkColor_BluePrev = 255
                GUICtrlSetData($BkColor_BlueInput,255)
                $BkColor_BlueInputPrev = 255
            EndIf
            If GUICtrlRead($BkColor_MainInput) =  "Svart" Then
                ConsoleWrite("Set to black"&@CRLF)
                GUICtrlSetData($BkColor_Red,0)
                $BkColor_RedPrev = GUICtrlRead($BkColor_Red)
                GUICtrlSetData($BkColor_RedInput,0)
                $BkColor_RedInputPrev = GUICtrlRead($BkColor_RedInput)
                GUICtrlSetData($BkColor_Green,0)
                $BkColor_GreenPrev = GUICtrlRead($BkColor_Green)
                GUICtrlSetData($BkColor_GreenInput,0)
                $BkColor_GreenInputPrev = GUICtrlRead($BkColor_GreenInput)
                GUICtrlSetData($BkColor_Blue,0)
                $BkColor_BluePrev = GUICtrlRead($BkColor_Blue)
                GUICtrlSetData($BkColor_BlueInput,0)
                $BkColor_BlueInputPrev = GUICtrlRead($BkColor_BlueInput)
            EndIf
            $BkColor_MainInputPrev = GUICtrlRead($BkColor_MainInput)
        EndIf
        If GUICtrlRead($BkColor_RedInput) > 255 Then
            GUICtrlSetData($BkColor_Red,255)
            GUICtrlSetData($BkColor_RedInput,255)
            $BkColor_RedPrev = 255
            $BkColor_RedInputPrev = 255
        EndIf
        If GUICtrlRead($BkColor_GreenInput) > 255 Then
            GUICtrlSetData($BkColor_Green,255)
            GUICtrlSetData($BkColor_GreenInput,255)
            $BkColor_GreenPrev = 255
            $BkColor_GreenInputPrev = 255
        EndIf
        If GUICtrlRead($BkColor_BlueInput) > 255 Then
            GUICtrlSetData($BkColor_Blue,255)
            GUICtrlSetData($BkColor_BlueInput,255)
            $BkColor_BluePrev = 255
            $BkColor_BlueInputPrev = 255
        EndIf
        $BkColor_ZerocheckRed = StringSplit(GUICtrlRead($BkColor_RedInput),"")
        $BkColor_ZerocheckGreen = StringSplit(GUICtrlRead($BkColor_GreenInput),"")
        $BkColor_ZerocheckBlue = StringSplit(GUICtrlRead($BkColor_BlueInput),"")
        If $BkColor_ZerocheckRed[0] > 1 And $BkColor_ZerocheckRed[1] = "0" Then GUICtrlSetData($BkColor_RedInput,StringReplace(GUICtrlRead($BkColor_RedInput),"0","",1))
        If $BkColor_ZerocheckGreen[0] > 1 And $BkColor_ZerocheckGreen[1] = "0" Then GUICtrlSetData($BkColor_GreenInput,StringReplace(GUICtrlRead($BkColor_GreenInput),"0","",1))
        If $BkColor_ZerocheckBlue[0] > 1 And $BkColor_ZerocheckBlue[1] = "0" Then GUICtrlSetData($BkColor_BlueInput,StringReplace(GUICtrlRead($BkColor_BlueInput),"0","",1))
        $BkColor_ReadRed = GUICtrlRead($BkColor_Red)
        $BkColor_ReadGreen = GUICtrlRead($BkColor_Green)
        $BkColor_ReadBlue = GUICtrlRead($BkColor_Blue)
        $BkColor_ReadRedInput = GUICtrlRead($BkColor_RedInput)
        $BkColor_ReadGreenInput = GUICtrlRead($BkColor_GreenInput)
        $BkColor_ReadBlueInput = GUICtrlRead($BkColor_BlueInput)
        If $BkColor_ReadRedInput <> $BkColor_RedPrev Or $BkColor_ReadRed <> $BkColor_RedPrev Then
            If $BkColor_ReadRedInput <> $BkColor_RedPrev Then
                GUICtrlSetData($BkColor_Red,$BkColor_ReadRedInput)
                $BkColor_RedPrev = $BkColor_ReadRedInput
            ElseIf $BkColor_ReadRed <> $BkColor_RedPrev Then
                GUICtrlSetData($BkColor_RedInput,$BkColor_ReadRed)
                $BkColor_RedInputPrev = $BkColor_ReadRed
            EndIf
        EndIf

        If $BkColor_ReadGreenInput <> $BkColor_GreenPrev Or $BkColor_ReadGreen <> $BkColor_GreenPrev Then
            If $BkColor_ReadGreenInput <> $BkColor_GreenPrev Then
                GUICtrlSetData($BkColor_Green,$BkColor_ReadGreenInput)
                $BkColor_GreenPrev = $BkColor_ReadGreenInput
            ElseIf $BkColor_ReadGreen <> $BkColor_GreenPrev Then
                GUICtrlSetData($BkColor_GreenInput,$BkColor_ReadGreen)
                $BkColor_GreenInputPrev = $BkColor_ReadGreen
            EndIf
        EndIf

        If $BkColor_ReadBlueInput <> $BkColor_BluePrev Or $BkColor_ReadBlue <> $BkColor_BluePrev Then
            If $BkColor_ReadBlueInput <> $BkColor_BluePrev Then
                GUICtrlSetData($BkColor_Blue,$BkColor_ReadBlueInput)
                $BkColor_BluePrev = $BkColor_ReadBlueInput
            ElseIf $BkColor_ReadBlue <> $BkColor_BluePrev Then
                GUICtrlSetData($BkColor_BlueInput,$BkColor_ReadBlue)
                $BkColor_BlueInputPrev = $BkColor_ReadBlue
            EndIf
        EndIf

    If $BkColor_RedPrev = 255 And $BkColor_GreenPrev = 255 And $BkColor_BluePrev = 255 And GUICtrlRead($BkColor_MainInput) <> "Vit" Then _GUICtrlComboBox_SetCurSel($BkColor_MainInput,0)
    If $BkColor_RedPrev = 255 And $BkColor_GreenPrev = 0 And $BkColor_BluePrev = 0 And GUICtrlRead($BkColor_MainInput) <> "Röd" Then _GUICtrlComboBox_SetCurSel($BkColor_MainInput,1)
    If $BkColor_RedPrev = 0 And $BkColor_GreenPrev = 255 And $BkColor_BluePrev = 0 And GUICtrlRead($BkColor_MainInput) <> "Grön" Then _GUICtrlComboBox_SetCurSel($BkColor_MainInput,2)
    If $BkColor_RedPrev = 0 And $BkColor_GreenPrev = 0 And $BkColor_BluePrev = 255 And GUICtrlRead($BkColor_MainInput) <> "Blå" Then _GUICtrlComboBox_SetCurSel($BkColor_MainInput,3)
    If $BkColor_RedPrev = 0 And $BkColor_GreenPrev = 0 And $BkColor_BluePrev = 0 And GUICtrlRead($BkColor_MainInput) <> "Svart" Then _GUICtrlComboBox_SetCurSel($BkColor_MainInput,4)
    If ($BkColor_RedPrev <> 0 And $BkColor_RedPrev <> 255 And GUICtrlRead($BkColor_MainInput) <> "Egen") Or ($BkColor_GreenPrev <> 0 And $BkColor_GreenPrev <> 255 And GUICtrlRead($BkColor_MainInput) <> "Egen") Or _
        ($BkColor_BluePrev <> 0 And $BkColor_BluePrev <> 255 And GUICtrlRead($BkColor_MainInput) <> "Egen") Then _GUICtrlComboBox_SetCurSel($BkColor_MainInput,5)
    EndIf
    $BkColor =     $BkColor_RedPrev*65536+$BkColor_GreenPrev*256+$BkColor_BluePrev
    If $BkColor <> $BkColor_Prev Then
        GUICtrlSetBkColor($BkColor_ExampleColor,$BkColor)
        $BkColor_Prev = $BkColor
    EndIf
    WEnd
EndFunc

Func ColorEvents()
    switch @GUI_CtrlId
        Case $BkColor_OK
            $ColorEventsVal = 2
        Case $BkColor_Cancel
            $ColorEventsVal = 1
    EndSwitch
EndFunc

Func _Fontsize($hGui,$Font_PrevSize)
    $hGui_fontsize = GUICreate("Ställ textstorlek", 150,150,-1,-1,$WS_border,-1,$hGui)
    $Font_Input = GUICtrlCreateInput($Font_PrevSize,50,15,50)
    GUICtrlCreateUpdown(-1)
    GUICtrlSetLimit(-1, 50,8)
    $Font_ExampleLable = GUICtrlCreateLabel("Ex",60,40,100,75)
    GUICtrlSetState(-1,$gui_disable)
    GUICtrlSetFont(-1,$Font_PrevSize)
    $Font_OK = GUICtrlCreateButton("OK", 25,100,50,25)
    GUICtrlSetOnEvent(-1, "FontEvents")
    $Font_Cancel = GUICtrlCreateButton("Avbryt", 75,100,50,25)
    GUICtrlSetOnEvent(-1, "FontEvents")
    GUISetState(@SW_DISABLE, $hGui)
    GUISetState(@SW_SHOW, $hGui_fontsize)
    While 1
        If $FontEventsVal = 1 Then
            GUIDelete($hGui_fontsize)
            GUISetState(@SW_ENABLE,$hGui)
            WinActivate($hGui)
            $FontEventsVal = 0
            Return 0
            ExitLoop
        ElseIf $FontEventsVal = 2 Then
            $WinArray[_ArraySearch($WinArray,$hGui)][5] = GUICtrlRead($Font_Input)
            GUIDelete($hGui_fontsize)
            GUISetState(@SW_ENABLE,$hGui)
            WinActivate($hGui)
            ConsoleWrite(GUICtrlRead($Font_Input)&@CRLF)
            $FontEventsVal = 0
            Return $WinArray[_ArraySearch($WinArray,$hGui)][5]
            ExitLoop
        EndIf
        $Font_CurrentSize = GUICtrlRead($Font_Input)
        If $Font_CurrentSize > 50 Then GUICtrlSetData($Font_Input,50)
        If $Font_CurrentSize < 8 Then GUICtrlSetData($Font_Input,8)
        If $Font_CurrentSize <> $Font_PrevSize Then
            GUICtrlSetFont($Font_ExampleLable,GUICtrlRead($Font_Input))
            GUICtrlSetPos($Font_ExampleLable,60-(GUICtrlRead($Font_Input)/2))
            $Font_PrevSize = $Font_CurrentSize
        EndIf
    WEnd
EndFunc

Func FontEvents()
    switch @GUI_CtrlId
        Case $Font_OK
            $FontEventsVal = 2
        Case $Font_Cancel
            $FontEventsVal = 1
    EndSwitch
EndFunc

Func LoadList()

EndFunc

DllCallbackFree($wProcHandle)

fehqfLj.png

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

zvvyt,

Firstly, you can use the hidden, but always present, AutoIt GUI as a parent:

$hWnd = WinGetHandle(AutoItWinGetTitle())
Next, I suggest preventing the default behaviour of the GUI for button events (Opt("GUIEventOptions", 1) and then adding some code to your MainEvents function to hide the GUI instead of minimizing it:

Func MainEvents()
    Select
        Case @GUI_CtrlId = $GUI_EVENT_CLOSE
            [...]
        Case @GUI_CtrlId = $GUI_EVENT_MINIMIZE
            GUISetState(@SW_HIDE, @GUI_WinHandle)
    EndSelect
EndFunc   ;==>MainEvents
You will of course have to develop a way to get the GUI visible again when required. ;)

Finally, your script nearly always crashes on exit, but I have not yet discovered why. :(>

M23

Edit:

Found the problem - you should delete all the subclassed GUIs before freeing the replacement WndProc:

Func TrayExit()
    ConsoleWrite("TrayExit")
    If MsgBox(4, "Stäng?", "Är du säker på att du vill stänga av?") = 6 Then
        For $i = 0 To UBound($WinArray, 1) - 1
            GUIDelete($WinArray[$i][0])
        Next
        DllCallbackFree($wProcHandle)
        Exit
    EndIf
EndFunc   ;==>TrayExit
Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Firstly, you can use the hidden, but always present, AutoIt GUI as a parent:

$hWnd = WinGetHandle(AutoItWinGetTitle())

Grazie! 

Next, I suggest preventing the default behaviour of the GUI for button events (Opt("GUIEventOptions", 1) and then adding some code to your MainEvents function to hide the GUI instead of minimizing it:

You will of course have to develop a way to get the GUI visible again when required. ;)

Thanks, that's the exact way of putting me on the right track I was looking for!

But then I still don't have a "window" I can use to "restore"/show the GUIs again?

I could add a hide/show-function to the tray, but that is a step off my original path..

Finally, your script nearly always crashes on exit, but I have not yet discovered why. :(>

Found the problem - you should delete all the subclassed GUIs before freeing the replacement WndProc:

That's odd, as I'm not getting a single error when I run and/or close it..

But if it was as simple and fundamental as deleting the GUIs then I'm more than happy you pointed that out :)

Share this post


Link to post
Share on other sites

"Följ lapp"

Is it bad that I laughed at that? :P

(it's a Swedish thing)

Well, now I can't keep it like that..! xD

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

    • Jibberish
      By Jibberish
      Hi,
      I am automating the testing of a video player. I search a file for ".mp4" and want to create a GUI with radio buttons to select what video to play. The number of videos can change based on the user's library so this must be created automatically.  I have searched for how to accomplish this and there are several posts out there that help a little but I can't figure out the solution. I pulled the offending code from my main script and created the file below to make this easier to read. I am sure one of our experts here can help!
      #include <MsgBoxConstants.au3> #include <StringConstants.au3> #include <array.au3> #include <File.au3> #include <GUIConstantsEx.au3> Local $sMediaFile = "D:\MediaFiles\MediaFiles.txt" Local $iStrReturn = 0 Local $aText Local $aArrayFile Local $iMax = 6 ;Default number of Videos - 1 for the array counter Local $aVideoName[$iMax] = [0] Local $sCheckBox1 Local $iT = 0, $iVideoCount = 0, $iCount Local $ix = 0 Local $iy = 0 Local $idClose1 Const $iL = 10 ; Count from Left for GUI so all buttons line up ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; ; Read a list of video file names and create a GUI with Radio Buttons to select a single video. ; Problem: We don't know how many video names will be in the text file, so we can't hard code Case Statements & their variables ; Put the Video File Names into an Array _FileReadToArray($sMediaFile, $aArrayFile) For $a = 1 To $aArrayFile[0] ; Step through the array looking for .mp4 If StringInStr($aArrayFile[$a], ".mp4") Then $iVideoCount = $iVideoCount + 1 $aText = StringSplit($aArrayFile[$a],"\\") ; This video player reads double backslashes For $a1 = 1 to $aText[0] ; Check that the array is big enough If StringInStr($aText[$a1], ".mp4") Then ;MsgBox(0,"","Video is " & $aText[$a1]) If UBound($aVideoName) = $iVideoCount Then ; Resize the array when $iCount is equal to the element count in the array to prevent subscript error ReDim $aVideoName[$aVideoName[0] + $iMax] EndIf $aVideoName[$iVideoCount] = $aText[$a1]; add data to new index element $aVideoName[0] = $a1 ; update the index count for future reference ; The idea is to create a GUI width to accommodate long video file names $it = StringLen($aVideoName[$iVideoCount]) If $iT > $ix Then $ix = $iT EndIf EndIf Next EndIf Next ; Move backwards through the array deleting blank rows For $iCount = UBound($aVideoName) - 1 To 0 Step -1 If $aVideoName[$iCount] = "" Then _ArrayDelete($aVideoName, $iCount) EndIf Next ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; ; Create the GUI - Names and Radio Button counts will vary - How do I do this? ; ;_ArrayDisplay($aVideoName) ;Local $aVarName[$aVideoName[0]] Local $iRows = UBound($aVideoName, $UBOUND_ROWS) $iRows = $iRows -1 $aVideoName[0] = $iRows ; Prep the GUI to display the FileNames with Radio Buttons - Can only select one at a time. $a = 0 $ix = $ix + 200 $iy = ($aVideoName[0] * 30) + 60 $hGUI = GUICreate("Videos", $ix, $iy) ;$iT = $iT+30 ; Create the variable names for the Case statement - Video count may change so Video Names displayed and GUICtrlCreateRadio count may change. ;~ For $a = 1 to $aVarName[0] ;~ If UBound($aVarName) = $aVarName Then ;~ ; Resize the array when $iCount is equal to the element count in the array to prevent subscript error ;~ ReDim $aVarName[$aVarName[0] + $iMax] ;~ EndIf ;~ Assign("$bVideoName" & $a, $a) ;~ Local $aVarName[$a] = Eval($bVideoName[$a]) ;~ ; $aVarName[$a] = GUICtrlCreateRadio($aVarName[$a], $iL, $iT) ;~ Next $iCount = 1 ;MsgBox(0,"","VideoName[0] is "&$aVideoName[0]) ;_ArrayDisplay($aVideoName) Local $bVideoName1 If $iCount < $aVideoName[0] Then $bVideoName1 = GUICtrlCreateRadio($aVideoName[$iCount], $iL, $iT) GUICtrlSetState($bVideoName1, $GUI_CHECKED) $iT = $iT+30 EndIf $iCount = $iCount + 1 If $iCount <= ($aVideoName[0]) Then Local $bVideoName2 = GUICtrlCreateRadio($aVideoName[$iCount],$iL,$iT) $iT = $iT+30 EndIf $iCount = $iCount + 1 If $iCount <= ($aVideoName[0]) Then Local $bVideoName3 = GUICtrlCreateRadio($aVideoName[$iCount],$iL,$iT) $iT = $iT+30 EndIf $iCount = $iCount + 1 If $iCount <= ($aVideoName[0]) Then Local $bVideoName4 = GUICtrlCreateRadio($aVideoName[$iCount],$iL,$iT) $iT = $iT+30 EndIf $iCount = $iCount + 1 If $iCount <= ($aVideoName[0] -1) Then Local $bVideoName5 = GUICtrlCreateRadio($aVideoName[$iCount],$iL,$iT) $iT = $iT+30 EndIf $iCount = $iCount + 1 If $iCount <= ($aVideoName[0] -1) Then Local $bVideoName6 = GUICtrlCreateRadio($aVideoName[$iCount],$iL,$iT) $iT = $iT+30 EndIf $iCount = $iCount + 1 If $iCount <= ($aVideoName[0] -1) Then Local $bVideoName7 = GUICtrlCreateRadio($aVideoName[$iCount],$iL,$iT) $iT = $iT+30 EndIf $iT = $iT + 30 $idClose1 = GUICtrlCreateButton("Go!", $iL, $iT) GUISetState(@SW_SHOW) ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; ; Switch Statement ; ;Local $nMsg = "" While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $bVideoName1 Case $bVideoName2 Case $bVideoName3 Case $bVideoName4 Case $bVideoName5 ;Case $bVideoName6 <- Fails because there are only 5 videos - Need variable $bVideoNames ;Case $bVideoName7 <- Fails because there are only 5 videos Case $idClose1 $bVideoName1 = GUICtrlRead($bVideoName1) $bVideoName2 = GUICtrlRead($bVideoName2) $bVideoName3 = GUICtrlRead($bVideoName3) $bVideoName4 = GUICtrlRead($bVideoName4) $bVideoName5 = GUICtrlRead($bVideoName5) ;$bVideoName6 = GUICtrlRead($bVideoName6) ;$bVideoName7 = GUICtrlRead($bVideoName7) ExitLoop EndSwitch WEnd GUIDelete($nMsg) MsgBox(0,"","Case " & $nMsg & " was selected.") ; Always returns 8. ??? This is the "MediaFiles.txt" file I am reading:
      D:\\MediaFiles\\BigBuckBunny.mp4 D:\\MediaFiles\\BigBuckBunny60fps.mp4 D:\\MediaFiles\\Sintel.mp4 D:\\MediaFiles\\sintel-2048-surround.mp4 D:\\MediaFiles\\TearsOfSteel.mp4 D:\\MediaFiles\\tearsofsteel_4K.mp4 I'm sure I have several mistakes (or poor coding methods) in my AutoIt file.
    • Skeletor
      By Skeletor
      Hi All,
      I know many newbies search for this feature.
      I decided to share this piece of code with everyone.
      Basically its a "splash screen" that has a transparent image.
      In a nutshell - Gui with a transparent gif.
      Enjoy...
      Download attachment....
       
      Splash Screen GUI.zip
    • Skeletor
      By Skeletor
      Hi Developers,
       
      While trying to find a way to actually style/skin the GUICtrlCreateTabItem, I read the help file and stated:
      My question to you guys is will this be updated? or am I hoping for something that will never come to pass?
      I've seen scripts between 2007 to 2009 allowing the tabs to be modified
      Reason for my question is I'm trying to make my GUI Tabs look more modern.
      Thanks in advance for reading my post.
       
    • Jibberish
      By Jibberish
      I am trying to get the results of a radio button selection. I have tried implementing sample scripts but to no avail.
      Can someone tell / show me what I am doing wrong?
      #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Local $bSelect1 Local $bSelect2 Local $bSelect3 SelectButton() ;The results of SelectButton is not being returned MsgBox(0,"","Select1 is "& $bSelect1 & ". Select2 is "& $bSelect2 & ". Select3 is "& $bSelect3 & ".") Func SelectButton() Local $hGUI = GUICreate("SGX4CP Tests", 300, 300) GUISetState() Local $bSelect1 = GUICtrlCreateRadio("Select 1", 10, 160) Local $bSelect2 = GUICtrlCreateRadio("Select 2", 10, 190) Local $bSelect3 = GUICtrlCreateRadio("Select 3", 10, 220) ; Set TestSelectForever as the default radio button GUICtrlSetState($bSelect1, $GUI_CHECKED) Local $idClose = GUICtrlCreateButton("Start", 120,250) Local $idMsg While 1 $idMsg = GUIGetMsg() Select Case $idMsg = $GUI_EVENT_CLOSE Or $idMsg = $idClose ExitLoop Case $idMsg = $bSelect1 And BitAND(GUICtrlRead($bSelect1), $GUI_CHECKED) = $GUI_CHECKED MsgBox(0,"","Select1") Case $idMsg = $bSelect2 And BitAND(GUICtrlRead($bSelect2), $GUI_CHECKED) = $GUI_CHECKED MsgBox(0,"","Select2") Case $idMsg = $bSelect3 And BitAND(GUICtrlRead($bSelect3), $GUI_CHECKED) = $GUI_CHECKED MsgBox(0,"","Select3") ; GUICtrlRead($hGUI) EndSelect WEnd MsgBox(0,"","Select1 is "& $bSelect1 & ". Select2 is "& $bSelect2 & ". Select3 is "& $bSelect3 & ".") ; Why is this returning numbers? EndFunc  
    • VIP
      By VIP
      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