Sign in to follow this  
Followers 0
taietel

Gui/menu/launcher

22 posts in this topic

#1 ·  Posted (edited)

I don't know how to call it, because it can be used as a start for many GUI related applications (personal opinion). Click Start to expand/retract and then click Label9.

Posted Image

#include <StaticConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
;gui/menu/launcher prototype (didn't knew how to call it)
;written by taietel
;modify to fit your needs
Global $bToggle = 0, $bEditToggle=0, $iItems=10, $iW=500, $iH=330
Global $aButtons[$iItems], $aLabels[$iItems]
$hGui = GUICreate("Form1", $iW, $iH, -1, -1, BitOR($WS_POPUP, $WS_BORDER, $WS_CLIPSIBLINGS))
GUISetBkColor(0x000000)
$hExit = GUICtrlCreateIcon("shell32.dll", -28, $iW-24, 8, 16, 16, BitOR($SS_NOTIFY,$WS_GROUP))
GUICtrlSetTip(-1, "Close me!...")
GUICtrlSetCursor(-1,0)
GUICtrlSetDefColor(0xDEDEDE)
GUICtrlCreateEdit("", 10, 10, 185, 110, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN), 0)
GUICtrlSetData(-1, "Press Start or the butterfly"&@CRLF&"to  expand/retract,  or"&@CRLF&"close... It  can  be"&@CRLF&"used     as     a"&@CRLF&"launcher   or"&@CRLF&"menu,    or"&@CRLF&"whatever"&@CRLF&".........")
GUICtrlSetBkColor(-1,0x000000)
GUICtrlSetState(-1,$GUI_DISABLE)
$hEdit = GUICtrlCreateEdit("", 320, 10, 1, 1, BitOR($ES_AUTOVSCROLL,$ES_WANTRETURN, $ES_NOHIDESEL, $WS_BORDER), 0)
GUICtrlSetData(-1, "This is an edit box shown because you clicked on Label no.9")
GUICtrlSetBkColor(-1,0x222222)
GUICtrlSetState(-1,$GUI_DISABLE+$GUI_HIDE)
For $i=1 To $iItems-1
    $aButtons[$i] = GUICtrlCreateIcon("shell32.dll", -7-$i, 8, $iH-40, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
    GUICtrlSetCursor(-1,0)
    GUICtrlSetState(-1,$GUI_HIDE)
    $aLabels[$i]=GUICtrlCreateLabel(" Label"&$i, 48, $iH-30,100,17,$SS_CENTERIMAGE)
    ;GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetBkColor(-1,0x222222);
    GUICtrlSetCursor(-1,0)
    GUICtrlSetState(-1,$GUI_HIDE)
Next
$aButtons[0] = GUICtrlCreateIcon("shell32.dll", -131, 8, $iH-40, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
GUICtrlSetCursor(-1,0)
GUICtrlSetTip(-1, "Press me!")
$aLabels[0]=GUICtrlCreateLabel("Start", 48, $iH-30)
GUICtrlSetTip(-1, "Press me!")
GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetCursor(-1,0)
GUICtrlCreatePic("", 1, 1, $iW-2, $iH-2, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS), $GUI_WS_EX_PARENTDRAG)
WinSetTrans($hGui,"",220)
GUISetState(@SW_SHOW)

While 1
    Sleep(10)
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE, $hExit
            Exit
        Case $aButtons[0], $aLabels[0]
            Switch $bToggle
                Case 0
                    For $i=1 To $iItems-1
                        ControlMove($hGui,"",$aButtons[$i], 8 + 2*$i^2, $iH-40 - $i*32)
                        GUICtrlSetState($aButtons[$i],$GUI_SHOW)
                        ControlMove($hGui,"",$aLabels[$i], 48 + 2*$i^2, $iH-30 - $i*32)
                        GUICtrlSetState($aLabels[$i],$GUI_SHOW)
                        Sleep(20)
                    Next
                    $bToggle=1
                Case 1
                    For $i=$iItems-1 To 1 Step -1
                        GUICtrlSetState($aButtons[$i],$GUI_HIDE)
                        ControlMove($hGui,"",$aButtons[$i], 8, $iH-40)
                        GUICtrlSetState($aLabels[$i],$GUI_HIDE)
                        ControlMove($hGui,"",$aLabels[$i], 48, $iH-30)
                        Sleep(20)
                    Next
                    $bToggle=0
            EndSwitch
        Case $aButtons[9],$aLabels[9]
            ;example action:
            Switch $bEditToggle
                Case 0
                    GUICtrlSetState($hEdit,$GUI_SHOW)
                    For $i=1 To 120
                        ControlMove($hGui,"",$hEdit, 320, 10, $i, 1)
                    Next
                    For $i=1 To 100
                        ControlMove($hGui,"",$hEdit, 320, 10, 120, $i)
                    Next
                    $bEditToggle=1
                Case 1
                    For $i=1 To 100
                        ControlMove($hGui,"",$hEdit, 320, 10, 120, 101-$i)
                    Next
                    For $i=1 To 120
                        ControlMove($hGui,"",$hEdit, 320, 10, 121-$i, 1)
                    Next
                    GUICtrlSetState($hEdit,$GUI_HIDE)
                    $bEditToggle=0
            EndSwitch
    EndSwitch
WEnd

[edit] and this is another example:

Posted Image

#include <StaticConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
;gui/menu/launcher prototype (didn't knew how to call it)
;written by taietel
;modify to fit your needs
Global $bToggle = 0, $iItems=10, $iW=500, $iH=330
Global $aButtons[$iItems], $aLabels[$iItems]
$hGui = GUICreate("Form1", $iW, $iH, -1, -1, BitOR($WS_POPUP, $WS_BORDER, $WS_CLIPSIBLINGS))
GUISetBkColor(0x000000)
$hExit = GUICtrlCreateIcon("shell32.dll", -28, $iW-24, 8, 16, 16, BitOR($SS_NOTIFY,$WS_GROUP))
GUICtrlSetTip(-1, "Close me!...")
GUICtrlSetCursor(-1,0)
GUICtrlSetDefColor(0xDEDEDE)
GUICtrlCreateEdit("", 10, 10, 185, 110, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN), 0)
GUICtrlSetData(-1, "Press Start or the butterfly"&@CRLF&"to expand/retract, or"&@CRLF&"close... It can be"&@CRLF&"used as a"&@CRLF&"launcher"&@CRLF&"or menu,"&@CRLF&"or whatever...")
GUICtrlSetBkColor(-1,0x000000)
GUICtrlSetState(-1,$GUI_DISABLE)
For $i=1 To $iItems-1
    $aButtons[$i] = GUICtrlCreateIcon("shell32.dll", -7-$i, $iW/2-16, $iH-40, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
    GUICtrlSetCursor(-1,0)
    GUICtrlSetState(-1,$GUI_HIDE)
    $aLabels[$i]=GUICtrlCreateLabel(" Label"&$i, $iW/2-16, $iH-30,60,17,BitOR($SS_CENTER,$SS_CENTERIMAGE))
    GUICtrlSetBkColor(-1,0x222222)
    GUICtrlSetCursor(-1,0)
    GUICtrlSetState(-1,$GUI_HIDE)
Next
$aButtons[0] = GUICtrlCreateIcon("shell32.dll", -131, $iW/2-16, $iH-40, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
GUICtrlSetCursor(-1,0)
GUICtrlSetTip(-1, "Press me!")
$aLabels[0]=GUICtrlCreateLabel("Start", $iW/2+24, $iH-30)
GUICtrlSetTip(-1, "Press me!")
GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetCursor(-1,0)
GUICtrlCreatePic("", 1, 1, $iW-2, $iH-2, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS), $GUI_WS_EX_PARENTDRAG)
WinSetTrans($hGui,"",220)
GUISetState(@SW_SHOW)

While 1
    Sleep(10)
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE, $hExit
            Exit
        Case $aButtons[0], $aLabels[0]
            Local $a=0
            Switch $bToggle
                Case 0
                    For $i=0 To 2
                        For $j=0 To 2
                            ControlMove($hGui,"",$aButtons[$j + 1 + $i*3], $iW/2-16-80*($j-1), $iH - 10 - (Mod($iItems*$i,3)+1)*70)
                            GUICtrlSetState($aButtons[$j + 1 + $i*3],$GUI_SHOW)
                            ControlMove($hGui,"",$aLabels[$j + 1 + $i*3], $iW/2-32-80*($j-1), $iH - 30 - (Mod($iItems*$i,3)+1)*70)
                            GUICtrlSetState($aLabels[$j + 1 + $i*3],$GUI_SHOW)
                        Next
                        Sleep(10)
                    Next
                    $bToggle=1
                Case 1
                    For $i=$iItems-1 To 1 Step -1
                        GUICtrlSetState($aButtons[$i],$GUI_HIDE)
                        ControlMove($hGui,"",$aButtons[$i], $iW/2-16, $iH-40)
                        GUICtrlSetState($aLabels[$i],$GUI_HIDE)
                        ControlMove($hGui,"",$aLabels[$i], $iW/2+24, $iH-30)
                        Sleep(10)
                    Next
                    $bToggle=0
            EndSwitch
    EndSwitch
WEnd
Edited by taietel

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Any way, this is the coolest GUI written in AutoIt that I have ever seen, but I have absolutely no Idea as to how I would go about making it actually do something other than just look pretty, but I guess I'm gonna have to figure out how gui's work when they're written in Autoit, and this one seem's pretty damn confusing.

Edited by System238

Things that I've done..

Icon Resource Editor: icon resource editor 

AutoIt Piano: a piano

AutoIt Unlocker: unlocks files when you want to delete them

Colorful tooltips: a wrapper for the tool tips UDF

Rouge GoogleBot: a full screen animation

ASciTE text editor: a text editor written in autoit

Warning: Posts by this user are subject to change or may disappear without notice.

Share this post


Link to post
Share on other sites

Looks very nice whereas 1st example is my favorite. :)

Good work taietel!

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

System238, here is an example of an action (look for <<<<<<<<<<<<<<<<<<). Click on Label9 or its left icon to see the message.

#include <StaticConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
;gui/menu/launcher prototype (didn't knew how to call it)
;written by taietel
;modify to fit your needs
Global $bToggle = 0, $iItems=10, $iW=500, $iH=330
Global $aButtons[$iItems], $aLabels[$iItems]
$hGui = GUICreate("Form1", $iW, $iH, -1, -1, BitOR($WS_POPUP, $WS_BORDER, $WS_CLIPSIBLINGS))
GUISetBkColor(0x000000)
$hExit = GUICtrlCreateIcon("shell32.dll", -28, $iW-24, 8, 16, 16, BitOR($SS_NOTIFY,$WS_GROUP))
GUICtrlSetTip(-1, "Close me!...")
GUICtrlSetCursor(-1,0)
GUICtrlSetDefColor(0xDEDEDE)
GUICtrlCreateEdit("", 10, 10, 185, 110, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN), 0)
GUICtrlSetData(-1, "Press Start or the butterfly"&@CRLF&"to expand/retract, or"&@CRLF&"close... It can be"&@CRLF&"used as a"&@CRLF&"launcher"&@CRLF&"or menu,"&@CRLF&"or whatever...")
GUICtrlSetBkColor(-1,0x000000)
GUICtrlSetState(-1,$GUI_DISABLE)
For $i=1 To $iItems-1
    $aButtons[$i] = GUICtrlCreateIcon("shell32.dll", -7-$i, 8, $iH-40, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
    GUICtrlSetCursor(-1,0)
    GUICtrlSetState(-1,$GUI_HIDE)
    $aLabels[$i]=GUICtrlCreateLabel(" Label"&$i, 48, $iH-30,100,17,$SS_CENTERIMAGE)
    GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
    ;GUICtrlSetBkColor(-1,0x222222)
    GUICtrlSetCursor(-1,0)
    GUICtrlSetState(-1,$GUI_HIDE)
Next
$aButtons[0] = GUICtrlCreateIcon("shell32.dll", -131, 8, $iH-40, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
GUICtrlSetCursor(-1,0)
GUICtrlSetTip(-1, "Press me!")
$aLabels[0]=GUICtrlCreateLabel("Start", 48, $iH-30)
GUICtrlSetTip(-1, "Press me!")
GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetCursor(-1,0)
GUICtrlCreatePic("", 1, 1, $iW-2, $iH-2, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS), $GUI_WS_EX_PARENTDRAG)
WinSetTrans($hGui,"",220)
GUISetState(@SW_SHOW)

While 1
    Sleep(10)
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE, $hExit
            Exit
        Case $aButtons[0], $aLabels[0]
            Switch $bToggle
                Case 0
                    For $i=1 To $iItems-1
                        ControlMove($hGui,"",$aButtons[$i], 8 + 2*$i^2, $iH-40 - $i*32)
                        GUICtrlSetState($aButtons[$i],$GUI_SHOW)
                        ControlMove($hGui,"",$aLabels[$i], 48 + 2*$i^2, $iH-30 - $i*32)
                        GUICtrlSetState($aLabels[$i],$GUI_SHOW)
                        Sleep(20)
                    Next
                    $bToggle=1
                Case 1
                    For $i=$iItems-1 To 1 Step -1
                        GUICtrlSetState($aButtons[$i],$GUI_HIDE)
                        ControlMove($hGui,"",$aButtons[$i], 8, $iH-40)
                        GUICtrlSetState($aLabels[$i],$GUI_HIDE)
                        ControlMove($hGui,"",$aLabels[$i], 48, $iH-30)
                        Sleep(20)
                    Next
                    $bToggle=0
            EndSwitch
        Case $aButtons[9],$aLabels[9] ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
            ;example action:
            MsgBox(0,"Here you go","You've pressed " & GUICtrlRead($aLabels[9]))
    EndSwitch
WEnd

UEZ, thanks!

Share this post


Link to post
Share on other sites

System238, here is an example of an action (look for <<<<<<<<<<<<<<<<<<). Click on Label9 or its left icon to see the message.

#include <StaticConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
;gui/menu/launcher prototype (didn't knew how to call it)
;written by taietel
;modify to fit your needs
Global $bToggle = 0, $iItems=10, $iW=500, $iH=330
Global $aButtons[$iItems], $aLabels[$iItems]
$hGui = GUICreate("Form1", $iW, $iH, -1, -1, BitOR($WS_POPUP, $WS_BORDER, $WS_CLIPSIBLINGS))
GUISetBkColor(0x000000)
$hExit = GUICtrlCreateIcon("shell32.dll", -28, $iW-24, 8, 16, 16, BitOR($SS_NOTIFY,$WS_GROUP))
GUICtrlSetTip(-1, "Close me!...")
GUICtrlSetCursor(-1,0)
GUICtrlSetDefColor(0xDEDEDE)
GUICtrlCreateEdit("", 10, 10, 185, 110, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN), 0)
GUICtrlSetData(-1, "Press Start or the butterfly"&@CRLF&"to expand/retract, or"&@CRLF&"close... It can be"&@CRLF&"used as a"&@CRLF&"launcher"&@CRLF&"or menu,"&@CRLF&"or whatever...")
GUICtrlSetBkColor(-1,0x000000)
GUICtrlSetState(-1,$GUI_DISABLE)
For $i=1 To $iItems-1
    $aButtons[$i] = GUICtrlCreateIcon("shell32.dll", -7-$i, 8, $iH-40, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
    GUICtrlSetCursor(-1,0)
    GUICtrlSetState(-1,$GUI_HIDE)
    $aLabels[$i]=GUICtrlCreateLabel(" Label"&$i, 48, $iH-30,100,17,$SS_CENTERIMAGE)
    GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
    ;GUICtrlSetBkColor(-1,0x222222)
    GUICtrlSetCursor(-1,0)
    GUICtrlSetState(-1,$GUI_HIDE)
Next
$aButtons[0] = GUICtrlCreateIcon("shell32.dll", -131, 8, $iH-40, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
GUICtrlSetCursor(-1,0)
GUICtrlSetTip(-1, "Press me!")
$aLabels[0]=GUICtrlCreateLabel("Start", 48, $iH-30)
GUICtrlSetTip(-1, "Press me!")
GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetCursor(-1,0)
GUICtrlCreatePic("", 1, 1, $iW-2, $iH-2, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS), $GUI_WS_EX_PARENTDRAG)
WinSetTrans($hGui,"",220)
GUISetState(@SW_SHOW)

While 1
    Sleep(10)
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE, $hExit
            Exit
        Case $aButtons[0], $aLabels[0]
            Switch $bToggle
                Case 0
                    For $i=1 To $iItems-1
                        ControlMove($hGui,"",$aButtons[$i], 8 + 2*$i^2, $iH-40 - $i*32)
                        GUICtrlSetState($aButtons[$i],$GUI_SHOW)
                        ControlMove($hGui,"",$aLabels[$i], 48 + 2*$i^2, $iH-30 - $i*32)
                        GUICtrlSetState($aLabels[$i],$GUI_SHOW)
                        Sleep(20)
                    Next
                    $bToggle=1
                Case 1
                    For $i=$iItems-1 To 1 Step -1
                        GUICtrlSetState($aButtons[$i],$GUI_HIDE)
                        ControlMove($hGui,"",$aButtons[$i], 8, $iH-40)
                        GUICtrlSetState($aLabels[$i],$GUI_HIDE)
                        ControlMove($hGui,"",$aLabels[$i], 48, $iH-30)
                        Sleep(20)
                    Next
                    $bToggle=0
            EndSwitch
        Case $aButtons[9],$aLabels[9] ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
            ;example action:
            MsgBox(0,"Here you go","You've pressed " & GUICtrlRead($aLabels[9]))
    EndSwitch
WEnd

UEZ, thanks!

Thanks, very kind of you.

At least now I know how to make use of it lol.

and now I know more or less how the script works.

#include 
#include 
#include 
#include 
;gui/menu/launcher prototype (didn't knew how to call it)
;written by taietel
;modify to fit your needs
Global $bToggle = 0, $iItems=10, $iW=500, $iH=330
Global $aButtons[$iItems], $aLabels[$iItems]
$hGui = GUICreate("Form1", $iW, $iH, -1, -1, BitOR($WS_POPUP, $WS_BORDER, $WS_CLIPSIBLINGS))
GUISetBkColor(0x000000)
$hExit = GUICtrlCreateIcon("shell32.dll", -28, $iW-24, 8, 16, 16, BitOR($SS_NOTIFY,$WS_GROUP))
GUICtrlSetTip(-1, "Close me!...")
GUICtrlSetCursor(-1,0)
GUICtrlSetDefColor(0xDEDEDE)
GUICtrlCreateEdit("", 10, 10, 185, 110, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN), 0)
GUICtrlSetData(-1, "Press Start or the butterfly"&@CRLF&"to expand/retract, or"&@CRLF&"close... It can be"&@CRLF&"used as a"&@CRLF&"launcher"&@CRLF&"or menu,"&@CRLF&"or whatever...")
GUICtrlSetBkColor(-1,0x000000)
GUICtrlSetState(-1,$GUI_DISABLE)
For $i=1 To $iItems-1
    $aButtons[$i] = GUICtrlCreateIcon("shell32.dll", -7-$i, 8, $iH-40, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
    GUICtrlSetCursor(-1,0)
    GUICtrlSetState(-1,$GUI_HIDE)
    $aLabels[$i]=GUICtrlCreateLabel(" Label"&$i, 48, $iH-30,100,17,$SS_CENTERIMAGE)
    GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
    ;GUICtrlSetBkColor(-1,0x222222)
    GUICtrlSetCursor(-1,0)
    GUICtrlSetState(-1,$GUI_HIDE)
Next
$aButtons[0] = GUICtrlCreateIcon("shell32.dll", -131, 8, $iH-40, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
GUICtrlSetCursor(-1,0)
GUICtrlSetTip(-1, "Press me!")
$aLabels[0]=GUICtrlCreateLabel("Start", 48, $iH-30)
GUICtrlSetTip(-1, "Press me!")
GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetCursor(-1,0)
GUICtrlCreatePic("", 1, 1, $iW-2, $iH-2, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS), $GUI_WS_EX_PARENTDRAG)
WinSetTrans($hGui,"",220)
GUISetState(@SW_SHOW)

While 1
    Sleep(10)
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE, $hExit
            Exit
        Case $aButtons[0], $aLabels[0]
            Switch $bToggle
                Case 0
                    For $i=1 To $iItems-1
                        ControlMove($hGui,"",$aButtons[$i], 8 + 2*$i^2, $iH-40 - $i*32)
                        GUICtrlSetState($aButtons[$i],$GUI_SHOW)
                        ControlMove($hGui,"",$aLabels[$i], 48 + 2*$i^2, $iH-30 - $i*32)
                        GUICtrlSetState($aLabels[$i],$GUI_SHOW)
                        Sleep(20)
                    Next
                    $bToggle=1
                Case 1
                    For $i=$iItems-1 To 1 Step -1
                        GUICtrlSetState($aButtons[$i],$GUI_HIDE)
                        ControlMove($hGui,"",$aButtons[$i], 8, $iH-40)
                        GUICtrlSetState($aLabels[$i],$GUI_HIDE)
                        ControlMove($hGui,"",$aLabels[$i], 48, $iH-30)
                        Sleep(20)
                    Next
                    $bToggle=0
            EndSwitch
        Case $aButtons[9],$aLabels[9] ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
            ;example action:
            Beep(1150,300)
        Case $aButtons[8],$aLabels[8]
            Beep(1000,300)
        Case $aButtons[7],$aLabels[7]
            Beep(950,300)
        Case $aButtons[6],$aLabels[6]
            Beep(800,300)
        Case $aButtons[5],$aLabels[5]
            Beep(750,300)
        Case $aButtons[4],$aLabels[4]
            Beep(600,300)
        Case $aButtons[3],$aLabels[3]
            Beep(550,300)
        Case $aButtons[2],$aLabels[2]
            Beep(400,300)
        Case $aButtons[1],$aLabels[1]
            Beep(350,300)
    EndSwitch
WEnd

Things that I've done..

Icon Resource Editor: icon resource editor 

AutoIt Piano: a piano

AutoIt Unlocker: unlocks files when you want to delete them

Colorful tooltips: a wrapper for the tool tips UDF

Rouge GoogleBot: a full screen animation

ASciTE text editor: a text editor written in autoit

Warning: Posts by this user are subject to change or may disappear without notice.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

this is a really good script, however i cannot see where the increasing +1 for the labels are.. so i can give each label there own name...

Edited by bb01

Share this post


Link to post
Share on other sites

bb01, $iItems stores the number of items. I've modified the array:

$aButtons[item][0]=handle to the button

$aButtons[item][1]=handle to the label

$aButtons[item][2]=text in the label

#include <StaticConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
;gui/menu/launcher prototype (didn't knew how to call it)
;written by taietel
;modify to fit your needs
Global $bToggle = 0, $bEditToggle=0, $iW=500, $iH=330
Global $iItems=10 ;number of items in the "menu"
Global $aButtons[$iItems][3]

$aButtons[0][2] = "Start"
$aButtons[1][2] = "First Item"
$aButtons[2][2] = "Second Item"
$aButtons[3][2] = "Third Item"
$aButtons[4][2] = "4'th Item"
$aButtons[5][2] = "5'th Item"
$aButtons[6][2] = "6'th Item"
$aButtons[7][2] = "7'th Item"
$aButtons[8][2] = "Notepad"
$aButtons[9][2] = "Press me"

$hGui = GUICreate("Sample GUI (?)", $iW, $iH, -1, -1, BitOR($WS_POPUP, $WS_BORDER, $WS_CLIPSIBLINGS))
GUISetBkColor(0x000000)
$hExit = GUICtrlCreateIcon("shell32.dll", -28, $iW-24, 8, 16, 16, BitOR($SS_NOTIFY,$WS_GROUP))
GUICtrlSetTip(-1, "Close me!...")
GUICtrlSetCursor(-1,0)
GUICtrlSetDefColor(0xDEDEDE)
GUICtrlCreateEdit("", 10, 10, 185, 110, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN), 0)
GUICtrlSetData(-1, "Press Start or the butterfly"&@CRLF&"to  expand/retract,  or"&@CRLF&"close... It  can  be"&@CRLF&"used     as     a"&@CRLF&"launcher   or"&@CRLF&"menu,    or"&@CRLF&"whatever"&@CRLF&".........")
GUICtrlSetBkColor(-1,0x000000)
GUICtrlSetState(-1,$GUI_DISABLE)
$hEdit = GUICtrlCreateEdit("", 320, 10, 1, 1, BitOR($ES_AUTOVSCROLL,$ES_WANTRETURN, $ES_NOHIDESEL, $WS_BORDER), 0)
GUICtrlSetData(-1, "This is an edit box shown because you clicked on Label no.9")
GUICtrlSetBkColor(-1,0x222222)
GUICtrlSetState(-1,$GUI_DISABLE+$GUI_HIDE)
For $i=1 To $iItems-1
    $aButtons[$i][0] = GUICtrlCreateIcon("shell32.dll", -7-$i, 8, $iH-40, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
    GUICtrlSetCursor(-1,0)
    GUICtrlSetState(-1,$GUI_HIDE)
    $aButtons[$i][1]=GUICtrlCreateLabel($aButtons[$i][2], 48, $iH-30,100,17,$SS_CENTERIMAGE)
    GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
    ;GUICtrlSetBkColor(-1,0x222222);
    GUICtrlSetCursor(-1,0)
    GUICtrlSetState(-1,$GUI_HIDE)
Next
$aButtons[0][0] = GUICtrlCreateIcon("shell32.dll", -131, 8, $iH-40, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
GUICtrlSetCursor(-1,0)
GUICtrlSetTip(-1, "Press me!")
$aButtons[0][1]=GUICtrlCreateLabel($aButtons[0][2], 48, $iH-30)
GUICtrlSetTip(-1, "Press me!")
GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetCursor(-1,0)
GUICtrlCreatePic("", 1, 1, $iW-2, $iH-2, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS), $GUI_WS_EX_PARENTDRAG)
WinSetTrans($hGui,"",220)
GUISetState(@SW_SHOW)

While 1
    Sleep(10)
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE, $hExit
            Exit
        Case $aButtons[0][0], $aButtons[0][1]
            Switch $bToggle
                Case 0
                    For $i=1 To $iItems-1
                        ControlMove($hGui,"",$aButtons[$i][0], 8 + 2*$i^2, $iH-40 - $i*32)
                        GUICtrlSetState($aButtons[$i][0],$GUI_SHOW)
                        ControlMove($hGui,"",$aButtons[$i][1], 48 + 2*$i^2, $iH-30 - $i*32)
                        GUICtrlSetState($aButtons[$i][1],$GUI_SHOW)
                        Sleep(20)
                    Next
                    $bToggle=1
                Case 1
                    For $i=$iItems-1 To 1 Step -1
                        GUICtrlSetState($aButtons[$i][0],$GUI_HIDE)
                        ControlMove($hGui,"",$aButtons[$i][0], 8, $iH-40)
                        GUICtrlSetState($aButtons[$i][1],$GUI_HIDE)
                        ControlMove($hGui,"",$aButtons[$i][1], 48, $iH-30)
                        Sleep(20)
                    Next
                    $bToggle=0
            EndSwitch
        Case $aButtons[8][0],$aButtons[8][1]
            Run("notepad.exe")
        Case $aButtons[9][0],$aButtons[9][1]
            ;example action:
            Switch $bEditToggle
                Case 0
                    GUICtrlSetState($hEdit,$GUI_SHOW)
                    For $i=1 To 120
                        ControlMove($hGui,"",$hEdit, 320, 10, $i, 1)
                    Next
                    For $i=1 To 100
                        ControlMove($hGui,"",$hEdit, 320, 10, 120, $i)
                    Next
                    $bEditToggle=1
                Case 1
                    For $i=1 To 100
                        ControlMove($hGui,"",$hEdit, 320, 10, 120, 101-$i)
                    Next
                    For $i=1 To 120
                        ControlMove($hGui,"",$hEdit, 320, 10, 121-$i, 1)
                    Next
                    GUICtrlSetState($hEdit,$GUI_HIDE)
                    $bEditToggle=0
            EndSwitch
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites

Thank you taietel, thats perfect..

Works a treat... and will now be able to make my life so much easier.. as thinking of making it into a kids desktop for my kids & then that way they cant press anything else except those buttons...

Thank you again..

Share this post


Link to post
Share on other sites

oh on a side note, is it possible to add an icon into it the same way as doing the labels..

eg

$aButtons[0][2] [icon.ico file] = "Start"

$aButtons[1][2] [icon.ico file] = "First Item"

$aButtons[2][2] [icon.ico file] = "Second Item"

$aButtons[3][2] [icon.ico file] = "Third Item"

$aButtons[4][2] [icon.ico file] = "4'th Item"

as then i can add icons to it..

& yes its perfect for the kids.. got 3 myself.. & this would stop them going into my stuff or deleting things that they not meant to do...

Can use this as a default desktop... & hide everything else... lol

Share this post


Link to post
Share on other sites

There are many possibilities for that. I prefer to put the icons into a dll or into the compiled script, then

GUICtrlCreateIcon ("path_to_the_exe_or_dll\resource.file", icon_number, ...)

Use the Resource Hacker to find the number of the icon.

Share this post


Link to post
Share on other sites

Where abouts in the script is the part for changing the length of txt for the label?

for example

$aButtons[3][2] = "The Magic Roundabout Game"

$aButtons[4][2] = "The Magic Roundabout TV Show"

$aButtons[5][2] = "The Magic Roundabout Movie"

$aButtons[6][2] = "The Magic Roundabout Coloring Pictures."

on all of them it only shows The Magic Roundabou

Share this post


Link to post
Share on other sites

never mind thank you.. but found it

$aButtons[$i][1]=GUICtrlCreateLabel($aButtons[$i][2], 48, $iH-30, ****,17,$SS_CENTERIMAGE)

Where the **** is the length of txt

Share this post


Link to post
Share on other sites

ok, looking good so far..

Got 1 more question, how can i use a persific icon for say 3 of the buttons..

as at moment i have

$aButtons[$i][0] = GUICtrlCreateIcon(@ScriptDir & "\Icons.dll", -0-$i, 21, $iH-40, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))

& have to edit Icons.dll & put the 3 icons next to each other.. , but how can i point 3 buttons for example

$aButtons[3][2] = "The Magic Roundabout Game"

$iIcon = -8

$aButtons[4][2] = "The Magic Roundabout TV Show"

$iIcon = -8

$aButtons[5][2] = "The Magic Roundabout Movie"

$iIcon = -8

$aButtons[6][2] = "The Magic Roundabout Coloring Pictures."

$iIcon = -21

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

You can use a Switch ... Case statement:

For $i=1 To $iItems
Switch $i
Case 3,4,5
$aButtons[$i][0] = GUICtrlCreateIcon(@ScriptDir & "\Icons.dll", -8, 21, $iH-40, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
Case Else
$aButtons[$i][0] = GUICtrlCreateIcon(@ScriptDir & "\Icons.dll", -$i, 21, $iH-40, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
EndSwitch

[edit] bad formating text

Edited by taietel

Share this post


Link to post
Share on other sites

Please help me

#include 
#include 
#include 
#include 
;gui/menu/launcher prototype (didn't knew how to call it)
;written by taietel
;modify to fit your needs
;===========================================
Global $bToggle = 0, $iItems=10, $iW=500, $iH=330
Global $aButtons[$iItems], $aLabels[$iItems]
;=====================================


;==========================================GUI================================================================================
$hGui = GUICreate("Form1", $iW, $iH, -1, -1, BitOR($WS_POPUP, $WS_BORDER, $WS_CLIPSIBLINGS))
GUISetBkColor(0x000000)


;====================================button=====CLOSE===============================================================
$hExit = GUICtrlCreateIcon("shell32.dll", -28, $iW-24, 8, 16, 16, BitOR($SS_NOTIFY,$WS_GROUP))
GUICtrlSetTip(-1, "Close...")
GUICtrlSetCursor(-1,0)



;========================text=========text=========text=========text===============================================
GUICtrlCreateEdit("", 10, 10, 185, 110, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN), 0)
GUICtrlSetData(-1, "Press Start or the butterfly"&@CRLF&"to expand/retract, or"&@CRLF&"close... It can be"&@CRLF&"used as a"&@CRLF&"launcher"&@CRLF&"or menu,"&@CRLF&"or whatever...")
GUICtrlSetBkColor(-1,0x000000)
GUICtrlSetState(-1,$GUI_DISABLE)
GUICtrlSetDefColor(0xDEDEDE)


;==============icons & labels======I have a problem here=========I have a problem here==========I have a problem here=====================
For $i=1 To $iItems-1
$aButtons[$i] = GUICtrlCreateIcon("shell32.dll", -7-$i, 8, $iH-40, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
GUICtrlSetCursor(-1,0)
GUICtrlSetState(-1,$GUI_HIDE)

$aLabels[$i]=GUICtrlCreateLabel(" Label"&$i, 48, $iH-30,100,17,$SS_CENTERIMAGE)
GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
;GUICtrlSetBkColor(-1,0x222222)
GUICtrlSetCursor(-1,0)
GUICtrlSetState(-1,$GUI_HIDE)
Next


;=======================================START BUTTON "TV"=================================================
$aButtons[0] = GUICtrlCreateIcon("shell32.dll", -131, 8, $iH-40, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
GUICtrlSetCursor(-1,0)
GUICtrlSetTip(-1, "Start!")
$aLabels[0]=GUICtrlCreateLabel("TV", 48, $iH-30)
GUICtrlSetTip(-1, "Start!")
GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetCursor(-1,0)
;=========================================================================================================================

;'''''''''''''''''''''''''''''''problem here''''''''START BUTTON "Radio" '''''''''''''''''''''''''''''''''''''''''''''''''''''''
$aButtons1 = GUICtrlCreateIcon("shell32.dll", -131, 100, $iH-40, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
GUICtrlSetCursor(-1,0)
GUICtrlSetTip(-1, "Start!")
$aLabels1=GUICtrlCreateLabel("Radio", 140, $iH-30)
GUICtrlSetTip(-1, "Start!")
GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetCursor(-1,0)
;'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

;================GUI================GUI=================GUI===================GUI=====================GUI=====
GUICtrlCreatePic("", 1, 1, $iW-2, $iH-2, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS), $GUI_WS_EX_PARENTDRAG)
WinSetTrans($hGui,"",220)
GUISetState(@SW_SHOW)
;==============================================================================================================================================

While 1
Sleep(10)
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE, $hExit
Exit

;============Buttons=====================Buttons==========================Buttons===========================================
Case $aButtons[0], $aLabels[0]
Switch $bToggle
Case 0
For $i=1 To $iItems-1
ControlMove($hGui,"",$aButtons[$i], 8 + 2*$i^2, $iH-40 - $i*32)
GUICtrlSetState($aButtons[$i],$GUI_SHOW)
ControlMove($hGui,"",$aLabels[$i], 48 + 2*$i^2, $iH-30 - $i*32)
GUICtrlSetState($aLabels[$i],$GUI_SHOW)
Sleep(40)
Next
$bToggle=1
Case 1
For $i=$iItems-1 To 1 Step -1
GUICtrlSetState($aButtons[$i],$GUI_HIDE)
ControlMove($hGui,"",$aButtons[$i], 8, $iH-40)
GUICtrlSetState($aLabels[$i],$GUI_HIDE)
ControlMove($hGui,"",$aLabels[$i], 48, $iH-30)
Sleep(20)
Next
$bToggle=0
EndSwitch
;===================================================================================================
Case $aButtons[9],$aLabels[9] ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;example action:
MsgBox(0,"Here you go","You've pressed " & GUICtrlRead($aLabels[9]))
Case $aButtons[8],$aLabels[8] ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
MsgBox(0,"Here you go","You've pressed " & GUICtrlRead($aLabels[8]))
Case $aButtons[7],$aLabels[7] ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
MsgBox(0,"Here you go","You've pressed " & GUICtrlRead($aLabels[7]))
EndSwitch
WEnd

Share this post


Link to post
Share on other sites

"Please help me" is not the way to ask for help with a script. If you need help, then explain what your problem is and what is supposed to happen that isn't or what is happening that isn't.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

I know this topic is over a year old but I'm lost here on customizing the icons if anybody is monitoring this topic:

False alarm. I figured it out. As taietel said, making a .dll file for the icons is the way to go.

Edited by copyleft

Share this post


Link to post
Share on other sites

not work with me ??

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