Jump to content

FuncyButtons


lod3n
 Share

Recommended Posts

This could easily be turned into one of those program launching button bars apps, just add a config file.

#include <GUIConstants.au3>

global $FuncyFuncs
dim $FuncyFuncs[1][3]

GUICreate("FuncyButton Demo")

Opt("GUICoordMode",2)

GUISetCoord ( 10,30 ) ; set button row start position

; normal button
$button1 = GUICtrlCreateButton("Normal Button",  -1, -1, 100)

; funcy button, prepped for adding an icon
$button2 = _GUICtrlCreateFuncyButton("RunApp","notepad.exe","Run Notepad", 0,-1,40,40, $BS_ICON)
GUICtrlSetImage (-1, "notepad.exe",0)

; funcy button, prepped for adding an icon, without saving ctrl variable
_GUICtrlCreateFuncyButton("RunApp","cmd.exe","Cmd", 0,-1,40,40, $BS_ICON)
GUICtrlSetImage (-1, "cmd.exe", 0)

; funcy buttons, no icon
_GUICtrlCreateFuncyButton("RunApp","calc.exe","Calc",  0, -1)
_GUICtrlCreateFuncyButton("RunApp","mspaint.exe","Paint",  0, -1)
_GUICtrlCreateFuncyButton("RunApp","wordpad.exe","Wordpad",  0, -1)
_GUICtrlCreateFuncyButton("RunApp","control desk.cpl","Display",  0, -1)

GUISetCoord ( 10,80 ) ; new button row start position
_GUICtrlCreateFuncyButton("RunApp","explorer.exe","Explorer",  -1, -1)
_GUICtrlCreateFuncyButton("RunApp",@ProgramFilesDir & "\Internet Explorer\iexplore.exe","IE",  0, -1)
_GUICtrlCreateFuncyButton("RunApp","control inetcpl.cpl","IE Ctl",  0, -1)

GUISetState ()

While 1
    $msg = GUIGetMsg(1)
    Select
        Case $msg[0] = $GUI_EVENT_CLOSE
            exitloop
        Case $msg[0] = $button1
            msgbox(0,"Test", "Normal event handling still works")
        Case Else
            if $msg[2] <> 0 then _FuncyButtonGo($msg[2])
    EndSelect
Wend

func RunApp($appcmd)
    run($appcmd)
EndFunc

func _GUICtrlCreateFuncyButton($function,$param, $text, $left, $top, $width=-1, $height=-1, $style=-1, $exStyle=-1 )
    local $button = GUICtrlCreateButton ($text, $left, $top, $width, $height, $style, $exStyle)
    local $x = Ubound($FuncyFuncs)+1
    ReDim $FuncyFuncs[$x][3]
    $x -= 1
    $FuncyFuncs[$x][0] = GUICtrlGetHandle($button)
    $FuncyFuncs[$x][1] = $function
    $FuncyFuncs[$x][2] = $param
    return $button
EndFunc

Func _FuncyButtonGo($ctrlID)
    for $i = 1 to Ubound($FuncyFuncs) - 1
        if $FuncyFuncs[$i][0] = $ctrlID Then
            call($FuncyFuncs[$i][1],$FuncyFuncs[$i][2])
        EndIf
    Next
EndFunc
Edited by lod3n

[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

Link to comment
Share on other sites

Guest Beefteck

lol, yep and that is where i step in with K.I.O. new version comeing out soon too go to my web site to see info on the last version it started as a little tool window for me v0.5 that lead to v0.7 (not avablible for download too many problems) then that lead to the latest avalible v0.8. I am getting close to done with my new version v1.0 witch will have many, many new features. I had great ideas for it in school and made all of them come true. i think that eveyone will be impressed when my new version comes out. anyway i have been useing the fancy buttons from v0.5 accutlly. anyway great script :whistle:

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...