Jump to content
Sign in to follow this  
picea892

Quick and Easy Launcher

Recommended Posts

picea892

Updated version of this script.

1) accelerators automatically created for all icons, hold shift to see shortcut combo. i.e. shift+1

2) My previous slickrun script is incorporated. Start typing, it will eventually automatically select the file(s) from the ini. If there is only one press enter. Otherwise, a mouse click to execute. Type g in demo. to get many results.

3) Right click an icon, files from the ini associated with that icon will be shown. In this provided example, right click the internet explorer icon to get website links.

4) hotkey update. Activated by `. Held open by ~

Run the script. If the program can't find the two ini files it will create a demo using programs like Calc, notepad, wordpad etc. and links to a few websites, since files on your computer are more transitory than the web.

Press ` to make the launcher active, not active.....

You can add files to launch by directly modifying the ini or press ~ This will be make the launcher permanently visible until ~ is pressed again. If you drag and drop a .exe on to the green titles it will add the file to the ini. If you restart the program the icon for the dropped program will be on the launcher.

to exit the script press Ctrl+shift+`

#Region
#include <GDIPlus.au3>
#include <Array.au3>
#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>
#include <Winapi.au3>
#include<Misc.au3>
#include <Process.au3>
#include <StaticConstants.au3>
#include <GuiConstants.au3>
#include <ListboxConstants.au3>
#Include <GuiListBox.au3>
#include <Constants.au3>
_Singleton("cons.au3", 0)

Global $WM_DROPFILES = 0x233
Global $gaDropFiles[1], $str = ""
Global $avChildren
Global $keeptrack,  $sCurrent_Data = ""
Opt("GUIOnEventMode", 1)
Global $dll = DllOpen("user32.dll")


Global Const $AC_SRC_ALPHA = 1
global $transcolour="0xABCDEF",$nottranscolour="0x363636",$goingdown,$goingleft, $oonoff=0,$toolbar, $keepwindowon=0
Global $iconslist, $iconslabel, $names,$labelison=0, $act="", $biglabelname, $counting=0
Global $gw=600,$gh=@DesktopHeight-60

    main()

func showhide()
  If $oonoff=0 and $keepwindowon=0 Then
    $act=WinGetTitle("[ACTIVE]")
    $oonoff=1
    GUISetState(@SW_SHOW,$toolbar)

    WinActivate("toolbar","")
    AdlibRegister("Buttonhover", 50)
;               $hWnd = WinGetHandle("toolbar","")
    ;           WinListChildren($hWnd, $avChildren)

        ;   _ArrayDisplay($avChildren)
  ElseIf $oonoff=1 and $keepwindowon=0  Then
        $oonoff=0
    GUISetState(@SW_HIDE,$toolbar)
    AdlibUnRegister()
    WinActivate($act, "")
  ElseIf not WinActive("toolbar","") and $keepwindowon=0 Then
    if $oonoff=1 then
    GUISetState(@SW_HIDE,$toolbar)
    $oonoff=0
    EndIf
    EndIf
EndFunc
func main()
;set up variables
$names = IniReadSectionNames("cons.ini")
If @error Then
    createini()
    $names = IniReadSectionNames("cons.ini")
EndIf

dim $iconslist[100][7]
dim $iconslabel[$names[0]+1]
dim $biglabelname[$names[0]+1]
$longest_row=0
;read the ini
For $j = 1 To $names[0]
    $sections = IniReadSection("cons.ini", $names[$j])
    if $sections[0][0]>$longest_row then $longest_row=$sections[0][0]
Next
;set window size, colour etc.
global $simpley=25+($names[0]-2)*65
Global $simplex=105+48*$longest_row
global $centerx=(@DesktopWidth/2)-($simplex/2)
global $centery= (@Desktopheight/2)-($simpley/2)
$toolbar=GUICreate("toolbar", $simplex, $simpley,$centerx,$centery,$WS_POPUP, BitOR($WS_EX_TOOLWINDOW, $WS_EX_ACCEPTFILES))
;GUISetStyle($WS_EX_LAYERED,$toolbar)
GUISetBkColor($nottranscolour,$toolbar)
GUISetState(@SW_HIDE,$toolbar)
WinSetOnTop($toolbar, "", 1)
GUIRegisterMsg ($WM_DROPFILES, "WM_DROPFILES_UNICODE_FUNC")
$counting=0
$goingdown=25
$size=iniread("cons.ini","setup","iconsize","32")
If @error Then
    createini2()
$size=iniread("cons.ini","setup","iconsize","32")
EndIf
$backpic=GUICtrlCreateLabel("",0,0,$simplex, $simpley)
GUIctrlSetBkColor($backpic,$nottranscolour)
GUIctrlSetState($backpic,$GUI_DISABLE)
GUICtrlSetResizing(-1, "802")
no_tab()
    Global $aAccelerator[100][3]
For $j = 1 To $names[0]
if $names[$j]<>"setup" and $names[$j]<>"hotkeys" then
    $biglabelname[$j]= GUICtrlCreateLabel($names[$j],10,$goingdown+4,100,34,$SS_left)
    GUICtrlSetState ($biglabelname[$j], $GUI_DROPACCEPTED)
    GUIctrlSetBkColor($biglabelname[$j],$nottranscolour)
    GUICtrlSetFont(-1,16, 600,2,"Verdana")
    GUICtrlSetColor(-1,"0x3D8B37")
    GUICtrlSetResizing(-1, "802")
    no_tab()
    $iconslabel[$j]=GUICtrlCreateLabel("",25,$goingdown+32,260,25)
            GUICtrlSetFont(-1,14, 550,"Arial")
            GUIctrlSetBkColor($iconslabel[$j],$nottranscolour)
            GUICtrlSetResizing(-1, "802")
            no_tab()
              $goingleft=115
    $sections = IniReadSection("cons.ini", $names[$j])
        For $i = 1 To $sections[0][0]
            $counting=$counting+1
            $iconslist[$counting][0] = $sections[$i][0]
            $iconslist[$counting][1] = GUICtrlCreateIcon("", 0, $goingleft, $goingdown,32,32)
            GUICtrlSetCursor(-1, 0)
            
            $iconslist[$counting][2] = $j
            $iconslist[$counting][3] = $i
            $iconslist[$counting][4] = $sections[$i][1]
            $iconslist[$counting][5] = 0
            SetIcon($iconslist[$counting][1], $nottranscolour, $sections[$i][1], 0, $size, $size)
            GUICtrlSetResizing(-1, "802")
            $goingleft=$goingleft+45
                        GUICtrlSetOnEvent($iconslist[$counting][1],"shortcutlinks")
                        no_tab()
                        $cou=$counting-1
                        if $cou=6 then $letter="+q"
                        if $cou=7 then $letter="+w"
                        if $cou=8 then $letter="+e"
                        if $cou=9 then $letter="+r"
                        if $cou=10 then $letter="+t"
                        if $cou=11 then $letter="+a"
                        if $cou=12 then $letter="+s"
                        if $cou=13 then $letter="+d"
                        if $cou=14 then $letter="+f"
                        if $cou=15 then $letter="+g"
                        if $cou=16 then $letter="+z"
                        if $cou=17 then $letter="+x"
                        if $cou=18 then $letter="+c"
                        if $cou=19 then $letter="+v"
                        if $cou=20 then $letter="+b"
                        if $cou<6 then $letter="+"&$counting
                        $aAccelerator[$counting-1][0] = $letter
                        $aAccelerator[$counting-1][1] = $iconslist[$counting][1]
                        $aAccelerator[$counting-1][2] = GUICtrlGetHandle($iconslist[$counting][1])
        Next

    $goingdown=$goingdown+65
EndIf
Next


redim $iconslist[$counting+1][7]
redim $aAccelerator[$counting][3]
_guisetaccelerators($aAccelerator,$toolbar)
;GUISetAccelerators($aAccelerator)
;_ArrayDisplay($aAccelerator)
;;;;;;;;;;;;;;;;;;;;;;;;
global $showlist=0
SetError(0)
Global $aInitial_Array=IniReadSection("files.ini","files")
If @error Then
    createini2()
Global $aInitial_Array=IniReadSection("files.ini","files")
EndIf
Global $sInitial_Data=""
ReDim $aInitial_Array[$aInitial_Array[0][0]+1][4]
For $i = 1 To $aInitial_Array[0][0]
global $sInitial_Data= $sInitial_Data&"|"&$aInitial_Array[$i][0]
;MsgBox(0,"",_WinAPI_FindExecutable($aInitial_Data[$i][1]))
    $aInitial_Array[$i][2]=_WinAPI_FindExecutable($aInitial_Array[$i][1])
    if $aInitial_Array[$i][2]="" and stringleft($aInitial_Array[$i][1],7)="http://" or stringleft($aInitial_Array[$i][1],8)="https://" Then
        $aInitial_Array[$i][2]="C:\Program Files\Internet Explorer\iexplore.exe"
        $aInitial_Array[$i][3]="F:\Applications\opera10\opera.exe"
    EndIf
    if $aInitial_Array[$i][2]="" and stringright($aInitial_Array[$i][1],3)="seo" Then $aInitial_Array[$i][2]="F:\Applications\SEO Note\SEO Note.exe"
    if $aInitial_Array[$i][2]="" then $aInitial_Array[$i][2]="C:\WINDOWS\system32\shell32.dll"

Next


;Global $aInitial_Array = StringSplit($sInitial_Data, "|")

global $hInput = GUICtrlCreateInput("", -20, 0, 200, 20)
GUICtrlSetResizing(-1, "802")
    GUICtrlSetState(-1, BitOR($GUI_FOCUS,$gui_hide))
    
global $hInput_Wnd = ControlGetHandle ($toolbar, "", $hInput)

global $hList = GUICtrlCreateList("", 0, $simpley, $simplex-15, 170,$LBS_NOINTEGRALHEIGHT)

GUICtrlSetResizing(-1, "802")
    GUICtrlSetData(-1, $sInitial_Data)
    GUICtrlSetFont(-1,12,500,"Arial")
        GUICtrlSetState(-1, $gui_hide)
GUICtrlSetBkColor(-1,"0X736F6E")
GUICtrlSetColor(-1,"0X250517")
no_tab()
GUISetOnEvent($GUI_EVENT_PRIMARYdown,"primarydown")
GUISetOnEvent($GUI_EVENT_SECONDARYDOWN,"rightbutton")
GUISetOnEvent($GUI_EVENT_MOUSEMOVE, "Mousemo")
Global $sCurrent_InputText = ""
Global $iChosen_State = 0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
EndFunc
$refreshing=1
;   _API_SetLayeredWindowAttributes($toolbar,$transcolour,255)
#EndRegion

HotKeySet(iniread("cons.ini","hotkeys","setontop","~"), "keepon")
HotKeySet(iniread("cons.ini","hotkeys","showhide","`"), "showhide")
HotKeySet(iniread("cons.ini","hotkeys","exit","^+`"), "Terminate")

While 1
    if not WinActive("toolbar","")and $oonoff=1 Then
                $oonoff=0
                GUISetState(@SW_HIDE,$toolbar)
                AdlibUnRegister()
    EndIf
    sleep(100)
    if _IsPressed("10",$dll) and WinActive("toolbar","")and $oonoff=1 then
        ;ToolTip("hi")
    EndIf
    _modifierpressed($aAccelerator,$toolbar)
WEnd

Func WM_DROPFILES_UNICODE_FUNC($hWnd, $msgID, $wParam, $lParam)
    Local $nSize, $pFileName
    Local $nAmt = DllCall("shell32.dll", "int", "DragQueryFileW", "hwnd", $wParam, "int", 0xFFFFFFFF, "ptr", 0, "int", 255)
    For $i = 0 To $nAmt[0] - 1
        $nSize = DllCall("shell32.dll", "int", "DragQueryFileW", "hwnd", $wParam, "int", $i, "ptr", 0, "int", 0)
        $nSize = $nSize[0] + 1
        $pFileName = DllStructCreate("wchar[" & $nSize & "]")
        DllCall("shell32.dll", "int", "DragQueryFileW", "hwnd", $wParam, "int", $i, "int", DllStructGetPtr($pFileName), "int", $nSize)
        ReDim $gaDropFiles[$i + 1]
        $gaDropFiles[$i] = DllStructGetData($pFileName, 1)
    if StringRight($gaDropFiles[$i],4)=".exe" then
            $handl=WinGetHandle("toolbar","")
            $hover=GUIGetCursorInfo($handl)
            For $j = 1 To $names[0]
                if $hover[4]=$biglabelname[$j] then 
            $result = StringInStr($gaDropFiles[$i],"\",0,-1)
            $result2 = StringLen($gaDropFiles[$i])-$result
            $result = Stringright($gaDropFiles[$i],$result2)
                IniWrite("cons.ini",$names[$j],$result,$gaDropFiles[$i])

                sleep(3000)

                ExitLoop
                EndIf
            Next
    EndIf
    Next
EndFunc  ;==>WM_DROPFILES_UNICODE_FUNC
func Buttonhover()
    inputtobox()
    $handl=WinGetHandle("toolbar","")
    $hover=GUIGetCursorInfo($handl)
    $skip=0
    For $j = 1 To $counting
        if $hover[4]=$iconslist[$j][1] Then

            if $iconslist[$j][5] = 0 then
                GUICtrlSetData($iconslabel[$iconslist[$j][2]],$iconslist[$j][0])
                $iconslist[$j][5] = 1
            EndIf
            $skip=1
        EndIf
        if $skip=0 and $iconslist[$j][5] = 1 Then
            GUICtrlSetData($iconslabel[$iconslist[$j][2]],"")
            $iconslist[$j][5] = 0
        
        EndIf
    $skip=0
    Next
    if $showlist=1 or $sCurrent_InputText = "pause" Then
        $pos = _WinAPI_GetMousePos()
        
        $listpos=_WinAPI_WindowFromPoint($pos)
        if GUICtrlGetHandle($hList)= $listpos Then
                    $ysos = _WinAPI_GetMousePosy()
                    $simpmax=Round(($ysos-($simpley+$centery))/21,0)
                ;   $simpmax=Round(($ysos-($simpley+$centery))/22,0)
                    
              if _GUICtrlListBox_getCurSel($hList)<>$simpmax then  _GUICtrlListBox_setCurSel($hList,$simpmax)
                    Return

        EndIf
    EndIf
EndFunc


#Region
func SetIcon($controlID, $iBackground, $sIcon, $iIndex, $iWidth, $iHeight)
    const $STM_SETIMAGE = 0x0172
    local $tIcon, $tID, $hDC, $hBackDC, $hBackSv, $hBitmap, $hImage, $hIcon, $hBkIcon

    $tIcon = DllStructCreate('hwnd')
    $tID = DllStructCreate('hwnd')
    $hIcon = DllCall('user32.dll', 'int', 'PrivateExtractIcons', 'str', $sIcon, 'int', $iIndex, 'int', $iWidth, 'int', $iHeight, 'ptr', DllStructGetPtr($tIcon), 'ptr', DllStructGetPtr($tID), 'int', 1, 'int', 0)
    if (@error) or ($hIcon[0] = 0) then
        return SetError(1, 0, 0)
    endif
    $hIcon = DllStructGetData($tIcon, 1)
    $tIcon = 0
    $tID = 0

    $hDC = _WinAPI_GetDC(0)
    $hBackDC = _WinAPI_CreateCompatibleDC($hDC)
    $hBitmap = _WinAPI_CreateSolidBitmap(0, $iBackground, $iWidth, $iHeight)
    $hBackSv = _WinAPI_SelectObject($hBackDC, $hBitmap)
    If $hIcon <> 0 Then _WinAPI_DrawIconEx($hBackDC, 0, 0, $hIcon, 0, 0, 0, 0, $DI_NORMAL)
    
    _GDIPlus_Startup()
    
    $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap)
    Local $hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage)
_GDIPlus_GraphicsDrawString($hGraphic,"",0,0,"arial",10)
_GDIPlus_GraphicsDispose    ($hGraphic)
    $hBkIcon = DllCall($ghGDIPDll, 'int', 'GdipCreateHICONFromBitmap', 'hWnd', $hImage, 'int*', 0)
    _GDIPlus_ImageDispose($hImage)
    
    GUICtrlSendMsg($controlID, $STM_SETIMAGE, $IMAGE_ICON, $hBkIcon[2])
   ;_WinAPI_RedrawWindow(GUICtrlGetHandle($controlID))
    
    _GDIPlus_Shutdown()
   ;_GDIPlus_GraphicsDispose($hGraphic)
    _WinAPI_SelectObject($hBackDC, $hBackSv)
    _WinAPI_DeleteDC($hBackDC)
    _WinAPI_ReleaseDC(0, $hDC)
    _WinAPI_DeleteObject($hBitmap)
    _WinAPI_DeleteObject($hIcon)

    return SetError(0, 0, 1)
endfunc; SetIcon

func createini()
iniwrite("cons.ini", "Internet", "Internet Explorer", "C:\Program Files\Internet Explorer\iexplore.exe")
IniWrite("cons.ini", "Editors", "Wordpad", "C:\Windows\System32\write.exe")
IniWrite("cons.ini", "Editors", "Notepad", "C:\Windows\System32\notepad.exe")
IniWrite("cons.ini", "Tools", "Calculator", "C:\Windows\System32\calc.exe")
IniWrite("cons.ini", "Tools", "Paint", "C:\Windows\System32\mspaint.exe")
iniwrite("cons.ini", "Tools", "Windows Explorer", "C:\Windows\explorer.exe")
IniWrite("cons.ini", "Media","MediaPlayer","C:\Program Files\Windows Media Player\wmplayer.exe")
iniwrite("cons.ini","hotkeys","setontop","~")
iniwrite("cons.ini","hotkeys","showhide","`")
iniwrite("cons.ini","hotkeys","exit","^+`")
IniWrite("cons.ini","setup","iconsize","32")
EndFunc

func createini2()
IniWrite("files.ini","files","Google","http://www.google.ca/")
IniWrite("files.ini","files","Giveaway of day","http://www.giveawayoftheday.com/")
IniWrite("files.ini","files","Autoit Examples","http://www.autoitscript.com/forum/index.php?showforum=9")
IniWrite("files.ini","files","Weather","http://www.weatheroffice.gc.ca/city/pages/on-127_metric_e.html")
IniWrite("files.ini","files","Globe and Mail","http://www.theglobeandmail.com/")


EndFunc
func terminate()
    _GDIPlus_Shutdown()
    ProcessClose("mway.exe")
    exit 0
EndFunc

Func keepon()
if $keepwindowon=0 Then
    WinSetOnTop("toolbar","",1)
    $keepwindowon=1
    GUISetState(@SW_SHOW,$toolbar)
Else
    WinSetOnTop("toolbar","",0)
    $keepwindowon=0
    GUISetState(@SW_HIDE, $toolbar)
EndIf

EndFunc
#EndRegion


;===============================================================================
;
; Function Name:   _API_SetLayeredWindowAttributes
; Description::    Sets Layered Window Attributes:) See MSDN for more informaion
; Parameter(s):   
;                  $hwnd - Handle of GUI to work on
;                  $i_transcolor - Transparent color
;                  $Transparency - Set Transparancy of GUI
;                  $isColorRef - If True, $i_transcolor is a COLORREF-Strucure, else an RGB-Color
; Requirement(s):  Layered Windows
; Return Value(s): Success: 1
;                  Error: 0
;                   @error: 1 to 3 - Error from DllCall
;                   @error: 4 - Function did not succeed - use
;                               _WinAPI_GetLastErrorMessage or _WinAPI_GetLastError to get more information
; Author(s):       Prog@ndy
;
;===============================================================================
;
Func _API_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = $trans, $isColorRef = False)
   
Local Const $AC_SRC_ALPHA = 1
Local Const $ULW_ALPHA = 2
Local Const $LWA_ALPHA = 0x2
Local Const $LWA_COLORKEY = 0x1
    If Not $isColorRef Then
        $i_transcolor = Hex(String($i_transcolor), 6)
        $i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2))
    EndIf
    Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hwnd, "long", $i_transcolor, "byte", $Transparency, "long", $LWA_COLORKEY + $LWA_ALPHA)
    Select
        Case @error
            Return SetError(@error,0,0)
        Case $ret[0] = 0
            Return SetError(4,0,0)
        Case Else
            Return 1
    EndSelect
EndFunc;==>_API_SetLayeredWindowAttributes

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Func Mousemo()
    If winactive("toolbar","") and GUICtrlRead($hInput)<>"" Then
    ;   GUICtrlSetData($hInput, "")
    ;   WinMove("toolbar","",$centerx,$centery,$simplex,$simpley)
    EndIf

EndFunc

func inputtobox()
        If _IsPressed("08", $dll) or _IsPressed("1B", $dll) Then
            resetinput()
            $sCurrent_InputText = ""
        elseif _IsPressed("0D", $dll) then
            if $keeptrack=1 Then
                $tempcurrentdata=StringRight($sCurrent_Data,stringlen($sCurrent_Data)-1)
                For $i = 1 To $aInitial_Array[0][0]
                    if $aInitial_Array[$i][0]=$tempcurrentdata Then
                        ShellExecute($aInitial_Array[$i][1])
                        Return
                    EndIf
                Next
            EndIf
        EndIf
if GUICtrlRead($hInput) = "" and $showlist=1 Then
    GUICtrlSetState($hList, $gui_hide)
    $showlist=0
Elseif $showlist=0 and not GUICtrlRead($hInput) = "" Then
    GUICtrlSetState($hList, $gui_show)
    $showlist=1
EndIf
    If GUICtrlRead($hList) = "" Then
        
        $sActual_InputText = GUICtrlRead($hInput)
        If $sActual_InputText <> $sCurrent_InputText and $sCurrent_InputText<>"pause" Then
            $iChosen_State = 0
            $sCurrent_Data = ""
            $keeptrack=0
            For $i = 1 To $aInitial_Array[0][0]
               ; If StringInStr($aInitial_Array[$i][0], $sActual_InputText) Then
                If $sActual_InputText=Stringleft($aInitial_Array[$i][0],StringLen($sActual_InputText)) Then
                    $sCurrent_Data &= "|" & $aInitial_Array[$i][0]
                    $keeptrack=$keeptrack+1
                EndIf
            Next
            if $keeptrack=0 then
                resetinput()
                Return
            EndIf
        ;   if $keeptrack=1 then $keeptrack=1.1
            
            if $showlist=1 then
                WinMove("toolbar","",$centerx,$centery,$simplex,$simpley+($keeptrack*22))
                GUICtrlSetPos($hList,0, $simpley, $simplex+2,$keeptrack*24)
            EndIf
            If $sCurrent_Data = "" Then $sCurrent_Data = "|" & $sInitial_Data
                GUICtrlSetData($hList, $sCurrent_Data)
                $sCurrent_InputText = $sActual_InputText
        EndIf
        If winactive("toolbar","") and _WinAPI_GetFocus() <> $hInput_Wnd and _WinAPI_GetFocus() <> GUICtrlGetHandle($hList) Then
            resetinput()
        EndIf
    Else

       
    EndIf
EndFunc
Func resetinput()
                    GUICtrlSetData($hInput, "")
                    GUICtrlSetData($hList, "")
                    GUICtrlSetPos($hList,0, $simpley, $simplex,0)
                WinMove("toolbar","",$centerx,$centery,$simplex,$simpley)
                $showlist=0
EndFunc

func primarydown()
    $pos = _WinAPI_GetMousePos()
    $hWnd = WinGetHandle("toolbar","")
    if GUICtrlGetHandle($hList)= _WinAPI_WindowFromPoint($pos) Then
        $templist=StringSplit($sCurrent_Data,"|",0)
            For $i = 1 To $aInitial_Array[0][0]
               If $aInitial_Array[$i][0]=$templist[_GUICtrlListBox_getCurSel($hList)+2] Then
                resetinput()
                ShellExecute($aInitial_Array[$i][1])
                    Return
                EndIf
            Next
        EndIf
    $sCurrent_InputText = ""
EndFunc

func no_tab()
    _WinAPI_SetWindowLong(GUICtrlGetHandle(-1), $GWL_STYLE, _
    BitAND(_WinAPI_GetWindowLong(GUICtrlGetHandle(-1), $GWL_STYLE), BitNOT($WS_TABSTOP)))
EndFunc

func shortcutlinks()
    ;MsgBox(0,"","sdfsdf")
    For $j = 1 To $counting
        if @GUI_CTRLID=$iconslist[$j][1] Then
                ShellExecute($iconslist[$j][4])
                showhide()
                Return
        EndIf
    Next

EndFunc

func rightbutton()
    
    For $j = 1 To $counting
           $handl=WinGetHandle("toolbar","")
    $hover=GUIGetCursorInfo($handl)
        if $hover[4]=$iconslist[$j][1] Then
                $iChosen_State = 0
                $sCurrent_Data = ""
                $keeptrack=0
                For $i = 1 To $aInitial_Array[0][0]
                    If $iconslist[$j][4]=$aInitial_Array[$i][2] or $iconslist[$j][4]=$aInitial_Array[$i][3] Then
                        $sCurrent_Data &= "|" & $aInitial_Array[$i][0]
                        $keeptrack=$keeptrack+1
                    EndIf
                Next
                WinMove("toolbar","",$centerx,$centery,$simplex,$simpley+($keeptrack*22))
                GUICtrlSetPos($hList,0, $simpley, $simplex+2,$keeptrack*24)

                GUICtrlSetData($hList, $sCurrent_Data)
                $sCurrent_InputText = "pause"
                ;$sActual_InputText="pause"
                $showlist=0
                GUICtrlSetState($hList, $gui_show)
                Return
                Sleep(4000)
            EndIf
                        
    Next
EndFunc

func _guisetaccelerators($accelerate,$winname)
    ReDim $accelerate[UBound($accelerate)][2]
    GUISetAccelerators($accelerate,$winname)
    Global $avChildren
    $hWnd = WinGetHandle($winname)
    WinListChildren($hWnd, $avChildren)
EndFunc

;Created by Authenticity
;modified by Picea892
Func WinListChildren($hWnd, ByRef $avArr)
    If UBound($avArr, 0) <> 2 Then
        Local $avTmp[10][5] = [[0]]
        $avArr = $avTmp
    EndIf
    
    Local $hChild = _WinAPI_GetWindow($hWnd, $GW_CHILD)
    
    While $hChild
        If $avArr[0][0]+1 > UBound($avArr, 1)-1 Then ReDim $avArr[$avArr[0][0]+10][5]
        $avArr[$avArr[0][0]+1][0] = $hChild
        $avArr[$avArr[0][0]+1][1] = _WinAPI_GetWindowText($hChild)
        $control_loc=ControlGetPos($hWnd,"",$hChild)

        $avArr[$avArr[0][0]+1][2] = $control_loc[0]
        $avArr[$avArr[0][0]+1][3] = $control_loc[1]
        $avArr[0][0] += 1
        WinListChildren($hChild, $avArr)
        $hChild = _WinAPI_GetWindow($hChild, $GW_HWNDNEXT)
    WEnd
    
    ReDim $avArr[$avArr[0][0]+1][6]
EndFunc
func _modifierpressed($cceler,$guiname)
    local $dll32 = DllOpen("user32.dll")
    if WinActive($guiname,"") and not WinExists("accelerators","") then
        
        if _IsPressed("10",$dll32) then ;shift
            createoverlay("+",$guiname)
        elseif _IsPressed("11",$dll32) then ;ctrl
            createoverlay("^",$guiname)
        elseif _IsPressed("12",$dll32) then ;alt
            createoverlay("!",$guiname)
        EndIf
    ElseIf  not _IsPressed("10",$dll32) and not _IsPressed("11",$dll32) and not _IsPressed("12",$dll32) and WinExists("accelerators","") then
        GUIDelete($accelgui)
        Return
    EndIf

EndFunc

func createoverlay($modifier,$guinam)
    local $transcolour="0xABCDEF"
    local $WS_EX_NOACTIVATE = 0x08000000
    local $winactive=WinGetHandle("","")
    Local $winlocation=WinGetPos($guinam)
    Global $accelgui = GUICreate("accelerators", $winlocation[2], $winlocation[3],$winlocation[0],$winlocation[1],$WS_POPUP, BitOR($WS_EX_LAYERED,$WS_EX_NOACTIVATE))
    WinSetOnTop($accelgui,"",1)
    GUISetBkColor($transcolour,$accelgui)

    for $i=1 to $avChildren[0][0]
        ;Global $cont=ControlGetPos($main_Gui,"",GUICtrlGetHandle($but[$i]))
            ;       ToolTip($avChildren[$i][0])
            ;Sleep(1000)
    
        for $a= 0 to UBound($aAccelerator)-1

            if $aAccelerator[$a][2]=$avChildren[$i][0] and StringLeft($aAccelerator[$a][0],1)= $modifier then
                $avChildren[$i][4]=GUICtrlCreateLabel(StringRight($aAccelerator[$a][0],StringLen($aAccelerator[$a][0])-1), $avChildren[$i][2]+2, $avChildren[$i][3]+2,11,13,$SS_CENTER)
                GUICtrlSetBkColor(-1,"0xFFFFFF")
            EndIf
        Next
    Next
_API_SetLayeredWindowAttributes($accelgui,$transcolour,200)
GUISetState(@SW_SHOWNOACTIVATE,$accelgui)
EndFunc

post-45064-12507344161568_thumb.jpg

Edited by picea892

Share this post


Link to post
Share on other sites
gseller

pretty neat! Might need to find a less used key but great job!

Share this post


Link to post
Share on other sites
Spiff59

It blew up on me: "_WinAPI_DrawIconEx: Invalid cursor handle"

It's tough to look at that code...

I'm assuming your copy is all pretty with indentation?

If you're not fond of the autoit tags, as many aren't, you ought to wrap the source in code tags, to preserve formatting, then wrap all that in codebox tags to put it in a scrollbox.

Edit: Win XP Pro SP3

Edit2: is $hIcon supposed to pass the IsHwnd() test? It does not for me.

Edited by Spiff59

Share this post


Link to post
Share on other sites
picea892

Thanks for the tip about the code box and tags. I'll use that from now on.

The error is from the icon extract method. It only happens rarely and I don't know why.

In another script I use it does the same.

Yashied provided me that function on this link

http://www.autoitscript.com/forum/index.php?showtopic=92176

It is a great function. 42x42 icons don't look half as nice extracted in the normal method. I just don't know what is causing that error. It's too inconsistent for me to pinpoint and I don't know GDI well enough to know.

Thanks for compliment gseller

Edited by picea892

Share this post


Link to post
Share on other sites
WideBoyDixon

I suspect that the _WinAPI_DrawIconEx() error is caused by a null handle to an icon (i.e. PrivateExtractIcons didn't work). Try changing the following line in the SetIcon function:

If $hIcon <> 0 Then _WinAPI_DrawIconEx($hBackDC, 0, 0, $hIcon, 0, 0, 0, 0, $DI_NORMAL)

It does give you a blank icon but at least you can see the rest of the script working ...

WBD

Share this post


Link to post
Share on other sites
picea892

Alright now we`re in business

The help is greatly appreciated WBD!

I made the change in the first post. I expect it will fix it. It makes sense.

Picea

Edited by picea892

Share this post


Link to post
Share on other sites
Spiff59

Works now! Cool.

I'd suggest a different method for detecting the mouse click.

Detect the mouse-down event, rather than the status of the button?

If I'm not quick-on-the-click, I get multiple processes launched.

Share this post


Link to post
Share on other sites
picea892

Works now! Cool.

I'd suggest a different method for detecting the mouse click.

Detect the mouse-down event, rather than the status of the button?

If I'm not quick-on-the-click, I get multiple processes launched.

Yes, I see how that could happen. I'll look into changing the mouse action over the next bit but I think a solution might be to add a sleep right after the shellexecute line.

I added sleep(300) to the code in the first post and it seems to stop multiple instances from happening. The sleep is barely noticeable. Let me know if that helped.

I think _ispressed would cause the same occurence and I think the guiregister method and mouse hook would require some major reworking in order to be incorporated. I'd make the change if no other option.

Share this post


Link to post
Share on other sites
picea892

4 months later and still using and updating this script. I thought it was time to share the updates. I changed the original post description, see details there.

Share this post


Link to post
Share on other sites
dantay9

Cool! Nice and compact. Everything works perfect except for the first column of icons. The name comes up when the cursor is over the icon, but it only allows me to click the icon on the upper edge and right edge. This only happens in the first column.

post-45252-12507448935911_thumb.png

Edited by dantay9

[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites
miketh2005

thats pretty need! looks like it was alot of work O.o I wanted to do something like this. i thought it would be easier than 600+ lines O.o

Share this post


Link to post
Share on other sites
picea892

Thanks for the positive feedback. I'm sure it's possible to write it with fewer lines. I think it is about as streamlined as I could write it. There are plenty of launchers in the examples forum that are under 300 lines. Of course they have fewer bells and >_<

dantay9 great observation. I completely missed that, Thank you. I had the main labels overlapping the first column of icons. I changed the label size and fixed the problem. I like it when it's a easy fix......

I should also note that if the icon size is too small that can be changed from 32 to a larger number via one of the ini files. There will come a size point where you will need to move the labels a bit to accomodate a larger icon.

Picea

Share this post


Link to post
Share on other sites
Hellooopsforgotsendcommand

I get an error message about line 38

AdlibEnable("Buttonhover", 50)

"unknown function name"

Edited by Hellooopsforgotsendcommand

Share this post


Link to post
Share on other sites
monoscout999

I get an error message about line 38

AdlibEnable("Buttonhover", 50)

"unknown function name"

are you a gravediger????? XDDDD look the post dates!!!

anyway adlibenable function isnĀ“t anymore... recplace for adlibregister()

Share this post


Link to post
Share on other sites
picea892

Hi....

I remember this script...actually looking at it again, it could be prettier but the functionality is generally there. I updated the script in the first post for adlibregister, adlibunregister.

There are some good functions in there still...ones I still use

WinListChildren

no_tab

WM_DROPFILES_UNICODE_FUNC

I also like the guiaccelerator tooltips (hold down shift when the gui is up) and the slickrun part (type g for exampe when gui is up).

If I get time....I may rework this script some time. Right now I have a different method using a modified listview that I'm quite happy with...

Anyways thanks for reminding me of it.

Picea892

Share this post


Link to post
Share on other sites
Hellooopsforgotsendcommand

Thanks Picea892 ! and yes I did think about becoming a gravedigger at one time. Hey a good script is a good script, no? :unsure:

Edited by Hellooopsforgotsendcommand

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.