Hest Posted June 14, 2009 Share Posted June 14, 2009 (edited) I have been wanting to make a toolbar for a while, because I use alot of different programs and wanted a place to launch them quickly, so I started making this new toolbar.I have only made the main gui, but maybe someone can use some of it. I'll update the code when I get further.What this does:Toolbar with preset number of buttons and rows.Shows and hides on mouse enter and leaving.Can have alot of buttons.Transparent "bar" in the top of screen.Coming: Setup screenCode updated 23/06/2009Changed it to drag & drop, so just drag files or folders to the toolbar.Delete by rightclicking a button.I have restricted filetypes atm. because they don't all have icons and that needs to be fixed first.Default icon or picking your own will come later.expandcollapse popup#Region;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Compression=4 #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_Res_Fileversion=0.1 #AutoIt3Wrapper_Add_Constants=n #EndRegion;**** Directives created by AutoIt3Wrapper_GUI **** #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <StaticConstants.au3> #include <Constants.au3> Global $Button_num = 16 Global $Button_row = 2 Global $Button_width = 68 Global $Button_height = 40 Global $Button_distx = 8 Global $Button_disty = 8 Global $Width_screen = @DesktopWidth Global $Visible_gui = 12 Global $Showwindow = 0 Global $Transparency = 150 Global $Buttons_pr_row = Ceiling($Button_num / $Button_row) Global $Total_buttons = ($Buttons_pr_row * $Button_row) Global $Button[$Total_buttons+1] Global $Buttonid[$Total_buttons*4] Global $Width_program = ($Buttons_pr_row * $Button_width) + ($Buttons_pr_row * $Button_distx) + $Button_distx Global $Height_program = ($Button_row * $Button_height) + ($Button_row * $Button_disty) + $Button_disty + $Visible_gui Global $Height_hide = -($Height_program - $Visible_gui) Global $Width_center = ($Width_screen / 2) - ($Width_program / 2) Local $Buttonmenu[$Total_buttons+1] Local $MenuFile[$Total_buttons+1] Local $MenuFolder[$Total_buttons+1] Local $MenuDelete[$Total_buttons+1] Local $Menuline[$Total_buttons+1] Local $File_error = 0 Global $Icon_folder = 4 Global $Icon_default = 4 Global $Icon_shortcut Global $Icon_link If Not FileExists(@ScriptDir & "\toolbar.ini") Then Create_ini() Global $Filelink = IniReadSection(@ScriptDir & "\toolbar.ini", "Launch") Global $total_files = $Filelink[0][0] #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("QuickTools", $Width_program, $Height_program, $Width_center, $Height_hide, $WS_POPUP + $WS_BORDER + $WS_OVERLAPPED, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW, $WS_EX_ACCEPTFILES)) WinSetTrans($Form1, "", $Transparency) Local $ii = 1 Local $Row = 1 Local $Buttondist = $Button_width + $Button_distx Local $Nextbuttonx = $Button_distx Local $Nextbuttony = $Button_disty For $i = 1 To $Total_buttons Step 1 $Button[$i] = GUICtrlCreateButton("", $Nextbuttonx, $Nextbuttony, $Button_width, $Button_height, $WS_GROUP + $BS_ICON) GUICtrlSetState($Button[$i], $GUI_DROPACCEPTED) Local $Button_i = $Button[$i] $Buttonid[$Button_i] = $i Local $File = IniRead(@ScriptDir & "\toolbar.ini", "Launch", $i, "Empty") If FileExists($File) Then Add_icon($File, $i) ElseIf $File <> "Empty" Then Delete_item($i) Local $File_error = 1 EndIf $Buttonmenu[$i] = GUICtrlCreateContextMenu($Button[$i]) $MenuDelete[$i] = GUICtrlCreateMenuItem("Delete Item", $Buttonmenu[$i]) $Nextbuttonx = $Nextbuttonx + $Buttondist $ii = $ii + 1 If $ii > $Buttons_pr_row Then $Nextbuttonx = $Button_distx $Nextbuttony = (($Button_height + $Button_disty) * $Row) + $Button_disty $row = $row + 1 $ii = 1 EndIf Next If $File_error = 1 Then MsgBox(1,"Error", "One or more files could not be found and has been removed from the toolbar") $Quicklabel = GUICtrlCreateLabel("Quicktools", ($Width_program/2)-100, $Height_program - 12, 200, $Visible_gui, $WS_GROUP + $SS_CENTER) GUICtrlSetFont(-1, 8, 800, 0, "Arial") $Exitlabel = GUICtrlCreateLabel("X", $Width_program-8, 1, 10, 10) GUICtrlSetFont(-1, 7, 400, 0, "Arial") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 Check_mouse();Checks mouse position and shows and hides the toolbar $nMsg = GUIGetMsg() Select Case $nMsg = $Exitlabel Exit Case $nMsg = $GUI_EVENT_DROPPED Add_item() EndSelect For $i = 1 to $Total_buttons Step 1 Select Case $nMsg = $Button[$i] Local $File = IniRead(@ScriptDir & "\toolbar.ini", "Launch", $i, "Empty") If FileExists ($File) Then ShellExecute($File) Else MsgBox(1,"Error", "File could not be found") EndIf EndSelect Next For $i = 1 to $Total_buttons Step 1 Select Case $nMsg = $MenuDelete[$i] Delete_item($i) EndSelect Next WEnd Func Show() If $Showwindow = 0 Then WinSetTrans($Form1, "", 250) WinMove($Form1, "", $Width_center, $Height_hide/2) sleep(15) WinMove($Form1, "", $Width_center, $Height_hide/4) sleep(15) WinMove($Form1, "", $Width_center, $Height_hide/8) sleep(15) WinMove($Form1, "", $Width_center, 0) ;~ WinSetTrans($Form1, "", 250) $Showwindow = 1 ElseIf $Showwindow = 1 Then WinMove($Form1, "", $Width_center, $Height_hide/8) sleep(15) WinMove($Form1, "", $Width_center, $Height_hide/4) sleep(15) WinMove($Form1, "", $Width_center, $Height_hide/2) sleep(15) WinMove($Form1, "", $Width_center, $Height_hide) WinSetTrans($Form1, "", $Transparency) $Showwindow = 0 EndIf EndFunc Func Check_mouse() Local $pos = MouseGetPos() If ($Showwindow = 0 AND $pos[1] < $Visible_gui AND $pos[0] > $Width_center AND $pos[0] < ($Width_center + $Width_program)) Then Show() ElseIf ($Showwindow = 1 AND $pos[1] > $Height_program+2) Then Show() EndIf EndFunc Func Create_ini() IniWrite(@ScriptDir & "\toolbar.ini", "Launch", 1, "C:\") IniWrite(@ScriptDir & "\toolbar.ini", "Launch", 2, @ProgramFilesDir & "\Internet Explorer\iexplore.exe") IniWrite(@ScriptDir & "\toolbar.ini", "Launch", 3, @ProgramFilesDir & "\Windows Media Player\wmplayer.exe") IniWrite(@ScriptDir & "\toolbar.ini", "Launch", 4, @SystemDir & "\notepad.exe") IniWrite(@ScriptDir & "\toolbar.ini", "Launch", 5, @SystemDir & "\calc.exe") IniWrite(@ScriptDir & "\toolbar.ini", "Launch", 6, @SystemDir & "\mspaint.exe") IniWrite(@ScriptDir & "\toolbar.ini", "Launch", 7, @WindowsDir & "\explorer.exe") EndFunc ;==>Create ini first time the program runs Func Delete_item($id) IniDelete (@ScriptDir & "\toolbar.ini", "Launch", $id) GUICtrlSetImage($Button[$id], "Shell32.dll", 50) GUICtrlSetTip($Button[$id], "") EndFunc Func Add_item() Local $id = $Buttonid[@GUI_DROPID] Local $File = @GUI_DRAGFILE IniWrite (@ScriptDir & "\toolbar.ini", "Launch", $id, $File ) Add_icon($File, $id) EndFunc Func Add_icon($File, $id) Local $atr = FileGetAttrib($File) Local $ext = StringLower(StringRight($File, 4)) Local $extl = StringLower(StringRight($File, 4)) Select Case $atr == "D"; Folders $Iconreg = RegRead("HKEY_CLASSES_ROOT\Directory\DefaultIcon\", "") $IconSplit = StringSplit($Iconreg, ",") If StringInStr($IconSplit[2], "-") Then $IconSplit[2] = StringTrimLeft($IconSplit[2], 1) GUICtrlSetImage($Button[$id], $IconSplit[1], 4) Case $ext = ".exe";Exe files GUICtrlSetImage($Button[$id], $File, 1) Case $ext = ".url";Web links $Iconreg = RegRead("HKEY_CLASSES_ROOT\http\DefaultIcon\", "") $IconSplit = StringSplit($Iconreg, ",") If StringInStr($IconSplit[2], "-") Then $IconSplit[2] = StringTrimLeft($IconSplit[2], 1) GUICtrlSetImage($Button[$id], $IconSplit[1], $IconSplit[2]) Case $ext = ".txt" OR $ext = ".chm" OR $ext = ".odt" OR $ext = ".doc" OR $extl = ".docx" OR $ext = ".pdf" OR $ext = ".ini";Text files $Extreg = RegRead("HKEY_CLASSES_ROOT\" & $ext, "") $Iconreg = RegRead("HKEY_CLASSES_ROOT\" & $Extreg & "\DefaultIcon\", "") $IconSplit = StringSplit($Iconreg, ",") If NOT @error Then If StringInStr($IconSplit[2], "-") Then $IconSplit[2] = StringTrimLeft($IconSplit[2], 1) GUICtrlSetImage($Button[$id], $IconSplit[1], $IconSplit[2]) EndIf Case $ext = ".jpg" OR $ext = ".bmp" OR $ext = ".avi" OR $ext = ".mpg" OR $extl = ".mpeg" OR $ext = ".flv";Movie files $Extreg = RegRead("HKEY_CLASSES_ROOT\" & $ext, "") $Iconreg = RegRead("HKEY_CLASSES_ROOT\" & $Extreg & "\DefaultIcon\", "") $IconSplit = StringSplit($Iconreg, ",") If NOT @error Then If StringInStr($IconSplit[2], "-") Then $IconSplit[2] = StringTrimLeft($IconSplit[2], 1) GUICtrlSetImage($Button[$id], $IconSplit[1], $IconSplit[2]) EndIf Case $ext = ".m3u" OR $ext = ".mp3" OR $ext = ".ogg";Music files $Extreg = RegRead("HKEY_CLASSES_ROOT\" & $ext, "") $Iconreg = RegRead("HKEY_CLASSES_ROOT\" & $Extreg & "\DefaultIcon\", "") $IconSplit = StringSplit($Iconreg, ",") If NOT @error Then If StringInStr($IconSplit[2], "-") Then $IconSplit[2] = StringTrimLeft($IconSplit[2], 1) GUICtrlSetImage($Button[$id], $IconSplit[1], $IconSplit[2]) EndIf Case Else MsgBox(1,"Error", "Filetype " & $ext & " is not supported" ) Delete_item($id) EndSelect EndFunc Edited June 23, 2009 by Hest Software:Model Train Calculator (Screen)Autoit3 beginner! Link to comment Share on other sites More sharing options...
picea892 Posted June 15, 2009 Share Posted June 15, 2009 very nice looking and something I would likely use. I tried dragging and dropping stuff on to it. Didn't work. How do you load it with stuff. Link to comment Share on other sites More sharing options...
Hest Posted June 15, 2009 Author Share Posted June 15, 2009 very nice looking and something I would likely use.I tried dragging and dropping stuff on to it. Didn't work. How do you load it with stuff.Haven't got that far yet, but I'm working on it and will update the code later. This was just a demonstration to start with Software:Model Train Calculator (Screen)Autoit3 beginner! Link to comment Share on other sites More sharing options...
Hest Posted June 15, 2009 Author Share Posted June 15, 2009 (edited) Another update of the toolbar. It's now possible to add files and folders and delete items. Let me know if I can improve the code somehow. Still alot of work to do before its done, but someone might find it usefull. btw how can I make the code window lower and with scrollbar? expandcollapse popup#include <GUIConstants.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <StaticConstants.au3> #include <Constants.au3> Global $Button_num = 16;Number of buttons. Global $Button_row = 2;Number of rows. Together with $Button_num it calculates the correct number needed Global $Button_width = 68 Global $Button_height = 40 Global $Button_distx = 8;X dist. between buttons Global $Button_disty = 8;Y dist. between buttons Global $Width_screen = @DesktopWidth Global $Visible_gui = 12;Pixels visible when hidden Global $Showwindow = 0 Global $id Global $Transparency = 150 Global $Buttons_pr_row = Ceiling($Button_num / $Button_row) Global $Total_buttons = ($Buttons_pr_row * $Button_row) Global $Button[$Total_buttons+1] Global $Width_program = ($Buttons_pr_row * $Button_width) + ($Buttons_pr_row * $Button_distx) + $Button_distx Global $Height_program = ($Button_row * $Button_height) + ($Button_row * $Button_disty) + $Button_disty + $Visible_gui Global $Height_hide = -($Height_program - $Visible_gui);How much to hide Global $Width_center = ($Width_screen / 2) - ($Width_program / 2);Centers the toolbar on the screen depending on width Local $Buttonmenu[$Total_buttons+1] Local $MenuFile[$Total_buttons+1] Local $MenuFolder[$Total_buttons+1] Local $MenuDelete[$Total_buttons+1] Local $Menuline[$Total_buttons+1] If Not FileExists(@ScriptDir & "\toolbar.ini") Then Create_ini() Global $Filelink = IniReadSection(@ScriptDir & "\toolbar.ini", "Launch") Global $total_files = $Filelink[0][0] #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("QuickTools", $Width_program, $Height_program, $Width_center, $Height_hide, $WS_POPUP + $WS_BORDER + $WS_OVERLAPPED, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW, $WS_EX_ACCEPTFILES)) WinSetTrans($Form1, "", $Transparency) Local $ii = 1 Local $Row = 1 Local $Buttondist = $Button_width + $Button_distx Local $Nextbuttonx = $Button_distx Local $Nextbuttony = $Button_disty For $i = 1 To $Total_buttons Step 1 $Button[$i] = GUICtrlCreateButton("", $Nextbuttonx, $Nextbuttony, $Button_width, $Button_height, $WS_GROUP + $BS_ICON) Local $File = IniRead(@ScriptDir & "\toolbar.ini", "Launch", $i, "Empty") If FileExists($File) AND StringRight($File, 1) = "\" Then GUICtrlSetImage(-1, "Shell32.dll", 4) ElseIf FileExists($File) Then GUICtrlSetImage(-1, $File, 1) GUICtrlSetTip(-1, $File) EndIf $Buttonmenu[$i] = GUICtrlCreateContextMenu($Button[$i]) $MenuFile[$i] = GUICtrlCreateMenuItem("Add File", $Buttonmenu[$i]) $MenuFolder[$i] = GUICtrlCreateMenuItem("Add Folder", $Buttonmenu[$i]) $Menuline[$i] = GUICtrlCreateMenuItem("", $Buttonmenu[$i]) $MenuDelete[$i] = GUICtrlCreateMenuItem("Delete Item", $Buttonmenu[$i]) $Nextbuttonx = $Nextbuttonx + $Buttondist $ii = $ii + 1 If $ii > $Buttons_pr_row Then $Nextbuttonx = $Button_distx $Nextbuttony = (($Button_height + $Button_disty) * $Row) + $Button_disty $row = $row + 1 $ii = 1 EndIf Next $Quicklabel = GUICtrlCreateLabel("Quicktools", ($Width_program/2)-100, $Height_program - 12, 200, $Visible_gui, $WS_GROUP + $SS_CENTER) GUICtrlSetFont(-1, 8, 800, 0, "Arial") $Exitlabel = GUICtrlCreateLabel("X", $Width_program-8, 1, 10, 10) GUICtrlSetFont(-1, 7, 400, 0, "Arial") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 Check_mouse();Checks mouse position and shows and hides the toolbar $nMsg = GUIGetMsg() Select Case $nMsg = $Exitlabel Exit EndSelect For $i = 1 to $total_files Step 1 Select Case $nMsg = $Button[$i] Local $File = IniRead(@ScriptDir & "\toolbar.ini", "Launch", $i, "Empty") If FileExists ($File) Then ShellExecute($File) EndIf EndSelect Next For $i = 1 to $Total_buttons Step 1 Select Case $nMsg = $MenuFile[$i] Edit_file($i) Case $nMsg = $MenuFolder[$i] Edit_folder($i) Case $nMsg = $MenuDelete[$i] Delete_item($i) EndSelect Next WEnd Func Show() If $Showwindow = 0 Then WinMove($Form1, "", $Width_center, 0) WinSetTrans($Form1, "", 250) $Showwindow = 1 ElseIf $Showwindow = 1 Then WinMove($Form1, "", $Width_center, $Height_hide) WinSetTrans($Form1, "", $Transparency) $Showwindow = 0 EndIf EndFunc Func Check_mouse() Local $pos = MouseGetPos() If ($Showwindow = 0 AND $pos[1] < $Visible_gui AND $pos[0] > $Width_center AND $pos[0] < ($Width_center + $Width_program)) Then Show() ElseIf ($Showwindow = 1 AND $pos[1] > $Height_program+2) Then Show() EndIf EndFunc Func Create_ini() IniWrite(@ScriptDir & "\toolbar.ini", "Launch", 1, "C:\") IniWrite(@ScriptDir & "\toolbar.ini", "Launch", 2, @ProgramFilesDir & "\Internet Explorer\iexplore.exe") IniWrite(@ScriptDir & "\toolbar.ini", "Launch", 3, @ProgramFilesDir & "\Windows Media Player\wmplayer.exe") IniWrite(@ScriptDir & "\toolbar.ini", "Launch", 4, @SystemDir & "\notepad.exe") IniWrite(@ScriptDir & "\toolbar.ini", "Launch", 5, @SystemDir & "\calc.exe") IniWrite(@ScriptDir & "\toolbar.ini", "Launch", 6, @SystemDir & "\mspaint.exe") IniWrite(@ScriptDir & "\toolbar.ini", "Launch", 7, @WindowsDir & "\explorer.exe") EndFunc ;==>Create ini first time the program runs Func Edit_file($id) Local $newlink = FileOpenDialog("Add Folder", @ProgramsDir, "All (*.*)|Programs (*.exe)", 3) IniWrite (@ScriptDir & "\toolbar.ini", "Launch", $id, $newlink ) GUICtrlSetImage($Button[$id], $newlink, 1) GUICtrlSetTip($Button[$id], $newlink) EndFunc Func Edit_folder($id) Local $newlink = FileSelectFolder("Add Folder", "", 4) IniWrite (@ScriptDir & "\toolbar.ini", "Launch", $id, $newlink ) GUICtrlSetImage($Button[$id], "Shell32.dll", 4) GUICtrlSetTip($Button[$id], $newlink) EndFunc Func Delete_item($id) IniDelete (@ScriptDir & "\toolbar.ini", "Launch", $id) GUICtrlSetImage($Button[$id], "Shell32.dll", 50) GUICtrlSetTip($Button[$id], "") EndFunc Edited June 15, 2009 by Hest Software:Model Train Calculator (Screen)Autoit3 beginner! Link to comment Share on other sites More sharing options...
myspacee Posted June 15, 2009 Share Posted June 15, 2009 cool. Is possible to slow down menù ? m. Link to comment Share on other sites More sharing options...
picea892 Posted June 15, 2009 Share Posted June 15, 2009 Hi Wrap in code tags and than put in a codebox....have to use both. I think using winanimate will solve myspacee's question and will make for a slicker effect. Just search the forum for "winanimate". It's extremely simple to incorporate into a script. Link to comment Share on other sites More sharing options...
TheSaint Posted June 15, 2009 Share Posted June 15, 2009 Thanks for sharing!I haven't had a chance to check yours out yet, but you might get some ideas etc from my Toolbar For Any program ... which you may not be aware of? It's rather simplistic but comprehensive I think. Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
Hest Posted June 16, 2009 Author Share Posted June 16, 2009 cool. Is possible to slow down menù ? m. Sure, thats not to hard. Chance the show() function to this Func Show() If $Showwindow = 0 Then WinMove($Form1, "", $Width_center, $Height_hide/2) sleep(10) WinMove($Form1, "", $Width_center, $Height_hide/4) sleep(10) WinMove($Form1, "", $Width_center, $Height_hide/8) sleep(10) WinMove($Form1, "", $Width_center, 0) WinSetTrans($Form1, "", 250) $Showwindow = 1 ElseIf $Showwindow = 1 Then WinMove($Form1, "", $Width_center, $Height_hide/8) sleep(10) WinMove($Form1, "", $Width_center, $Height_hide/4) sleep(10) WinMove($Form1, "", $Width_center, $Height_hide/2) sleep(10) WinMove($Form1, "", $Width_center, $Height_hide) WinSetTrans($Form1, "", $Transparency) $Showwindow = 0 EndIf EndFunc Software:Model Train Calculator (Screen)Autoit3 beginner! Link to comment Share on other sites More sharing options...
hegearon Posted June 16, 2009 Share Posted June 16, 2009 Great script! Keep up working on it! Link to comment Share on other sites More sharing options...
Hest Posted June 23, 2009 Author Share Posted June 23, 2009 Updated 23/06/2009Changed it to drag & drop, so just drag files or folders to the toolbar.Delete by rightclicking a button.I have restricted filetypes atm. because they don't all have icons and that needs to be fixed first.Default icon or picking your own will come later.expandcollapse popup#Region;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Compression=4 #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_Res_Fileversion=0.1 #AutoIt3Wrapper_Add_Constants=n #EndRegion;**** Directives created by AutoIt3Wrapper_GUI **** #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <StaticConstants.au3> #include <Constants.au3> Global $Button_num = 16 Global $Button_row = 2 Global $Button_width = 68 Global $Button_height = 40 Global $Button_distx = 8 Global $Button_disty = 8 Global $Width_screen = @DesktopWidth Global $Visible_gui = 12 Global $Showwindow = 0 Global $Transparency = 150 Global $Buttons_pr_row = Ceiling($Button_num / $Button_row) Global $Total_buttons = ($Buttons_pr_row * $Button_row) Global $Button[$Total_buttons+1] Global $Buttonid[$Total_buttons*4] Global $Width_program = ($Buttons_pr_row * $Button_width) + ($Buttons_pr_row * $Button_distx) + $Button_distx Global $Height_program = ($Button_row * $Button_height) + ($Button_row * $Button_disty) + $Button_disty + $Visible_gui Global $Height_hide = -($Height_program - $Visible_gui) Global $Width_center = ($Width_screen / 2) - ($Width_program / 2) Local $Buttonmenu[$Total_buttons+1] Local $MenuFile[$Total_buttons+1] Local $MenuFolder[$Total_buttons+1] Local $MenuDelete[$Total_buttons+1] Local $Menuline[$Total_buttons+1] Local $File_error = 0 Global $Icon_folder = 4 Global $Icon_default = 4 Global $Icon_shortcut Global $Icon_link If Not FileExists(@ScriptDir & "\toolbar.ini") Then Create_ini() Global $Filelink = IniReadSection(@ScriptDir & "\toolbar.ini", "Launch") Global $total_files = $Filelink[0][0] #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("QuickTools", $Width_program, $Height_program, $Width_center, $Height_hide, $WS_POPUP + $WS_BORDER + $WS_OVERLAPPED, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW, $WS_EX_ACCEPTFILES)) WinSetTrans($Form1, "", $Transparency) Local $ii = 1 Local $Row = 1 Local $Buttondist = $Button_width + $Button_distx Local $Nextbuttonx = $Button_distx Local $Nextbuttony = $Button_disty For $i = 1 To $Total_buttons Step 1 $Button[$i] = GUICtrlCreateButton("", $Nextbuttonx, $Nextbuttony, $Button_width, $Button_height, $WS_GROUP + $BS_ICON) GUICtrlSetState($Button[$i], $GUI_DROPACCEPTED) Local $Button_i = $Button[$i] $Buttonid[$Button_i] = $i Local $File = IniRead(@ScriptDir & "\toolbar.ini", "Launch", $i, "Empty") If FileExists($File) Then Add_icon($File, $i) ElseIf $File <> "Empty" Then Delete_item($i) Local $File_error = 1 EndIf $Buttonmenu[$i] = GUICtrlCreateContextMenu($Button[$i]) $MenuDelete[$i] = GUICtrlCreateMenuItem("Delete Item", $Buttonmenu[$i]) $Nextbuttonx = $Nextbuttonx + $Buttondist $ii = $ii + 1 If $ii > $Buttons_pr_row Then $Nextbuttonx = $Button_distx $Nextbuttony = (($Button_height + $Button_disty) * $Row) + $Button_disty $row = $row + 1 $ii = 1 EndIf Next If $File_error = 1 Then MsgBox(1,"Error", "One or more files could not be found and has been removed from the toolbar") $Quicklabel = GUICtrlCreateLabel("Quicktools", ($Width_program/2)-100, $Height_program - 12, 200, $Visible_gui, $WS_GROUP + $SS_CENTER) GUICtrlSetFont(-1, 8, 800, 0, "Arial") $Exitlabel = GUICtrlCreateLabel("X", $Width_program-8, 1, 10, 10) GUICtrlSetFont(-1, 7, 400, 0, "Arial") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 Check_mouse();Checks mouse position and shows and hides the toolbar $nMsg = GUIGetMsg() Select Case $nMsg = $Exitlabel Exit Case $nMsg = $GUI_EVENT_DROPPED Add_item() EndSelect For $i = 1 to $Total_buttons Step 1 Select Case $nMsg = $Button[$i] Local $File = IniRead(@ScriptDir & "\toolbar.ini", "Launch", $i, "Empty") If FileExists ($File) Then ShellExecute($File) Else MsgBox(1,"Error", "File could not be found") EndIf EndSelect Next For $i = 1 to $Total_buttons Step 1 Select Case $nMsg = $MenuDelete[$i] Delete_item($i) EndSelect Next WEnd Func Show() If $Showwindow = 0 Then WinSetTrans($Form1, "", 250) WinMove($Form1, "", $Width_center, $Height_hide/2) sleep(15) WinMove($Form1, "", $Width_center, $Height_hide/4) sleep(15) WinMove($Form1, "", $Width_center, $Height_hide/8) sleep(15) WinMove($Form1, "", $Width_center, 0) ;~ WinSetTrans($Form1, "", 250) $Showwindow = 1 ElseIf $Showwindow = 1 Then WinMove($Form1, "", $Width_center, $Height_hide/8) sleep(15) WinMove($Form1, "", $Width_center, $Height_hide/4) sleep(15) WinMove($Form1, "", $Width_center, $Height_hide/2) sleep(15) WinMove($Form1, "", $Width_center, $Height_hide) WinSetTrans($Form1, "", $Transparency) $Showwindow = 0 EndIf EndFunc Func Check_mouse() Local $pos = MouseGetPos() If ($Showwindow = 0 AND $pos[1] < $Visible_gui AND $pos[0] > $Width_center AND $pos[0] < ($Width_center + $Width_program)) Then Show() ElseIf ($Showwindow = 1 AND $pos[1] > $Height_program+2) Then Show() EndIf EndFunc Func Create_ini() IniWrite(@ScriptDir & "\toolbar.ini", "Launch", 1, "C:\") IniWrite(@ScriptDir & "\toolbar.ini", "Launch", 2, @ProgramFilesDir & "\Internet Explorer\iexplore.exe") IniWrite(@ScriptDir & "\toolbar.ini", "Launch", 3, @ProgramFilesDir & "\Windows Media Player\wmplayer.exe") IniWrite(@ScriptDir & "\toolbar.ini", "Launch", 4, @SystemDir & "\notepad.exe") IniWrite(@ScriptDir & "\toolbar.ini", "Launch", 5, @SystemDir & "\calc.exe") IniWrite(@ScriptDir & "\toolbar.ini", "Launch", 6, @SystemDir & "\mspaint.exe") IniWrite(@ScriptDir & "\toolbar.ini", "Launch", 7, @WindowsDir & "\explorer.exe") EndFunc ;==>Create ini first time the program runs Func Delete_item($id) IniDelete (@ScriptDir & "\toolbar.ini", "Launch", $id) GUICtrlSetImage($Button[$id], "Shell32.dll", 50) GUICtrlSetTip($Button[$id], "") EndFunc Func Add_item() Local $id = $Buttonid[@GUI_DROPID] Local $File = @GUI_DRAGFILE IniWrite (@ScriptDir & "\toolbar.ini", "Launch", $id, $File ) Add_icon($File, $id) EndFunc Func Add_icon($File, $id) Local $atr = FileGetAttrib($File) Local $ext = StringLower(StringRight($File, 4)) Local $extl = StringLower(StringRight($File, 4)) Select Case $atr == "D"; Folders $Iconreg = RegRead("HKEY_CLASSES_ROOT\Directory\DefaultIcon\", "") $IconSplit = StringSplit($Iconreg, ",") If StringInStr($IconSplit[2], "-") Then $IconSplit[2] = StringTrimLeft($IconSplit[2], 1) GUICtrlSetImage($Button[$id], $IconSplit[1], 4) Case $ext = ".exe";Exe files GUICtrlSetImage($Button[$id], $File, 1) Case $ext = ".url";Web links $Iconreg = RegRead("HKEY_CLASSES_ROOT\http\DefaultIcon\", "") $IconSplit = StringSplit($Iconreg, ",") If StringInStr($IconSplit[2], "-") Then $IconSplit[2] = StringTrimLeft($IconSplit[2], 1) GUICtrlSetImage($Button[$id], $IconSplit[1], $IconSplit[2]) Case $ext = ".txt" OR $ext = ".chm" OR $ext = ".odt" OR $ext = ".doc" OR $extl = ".docx" OR $ext = ".pdf" OR $ext = ".ini";Text files $Extreg = RegRead("HKEY_CLASSES_ROOT\" & $ext, "") $Iconreg = RegRead("HKEY_CLASSES_ROOT\" & $Extreg & "\DefaultIcon\", "") $IconSplit = StringSplit($Iconreg, ",") If NOT @error Then If StringInStr($IconSplit[2], "-") Then $IconSplit[2] = StringTrimLeft($IconSplit[2], 1) GUICtrlSetImage($Button[$id], $IconSplit[1], $IconSplit[2]) EndIf Case $ext = ".jpg" OR $ext = ".bmp" OR $ext = ".avi" OR $ext = ".mpg" OR $extl = ".mpeg" OR $ext = ".flv";Movie files $Extreg = RegRead("HKEY_CLASSES_ROOT\" & $ext, "") $Iconreg = RegRead("HKEY_CLASSES_ROOT\" & $Extreg & "\DefaultIcon\", "") $IconSplit = StringSplit($Iconreg, ",") If NOT @error Then If StringInStr($IconSplit[2], "-") Then $IconSplit[2] = StringTrimLeft($IconSplit[2], 1) GUICtrlSetImage($Button[$id], $IconSplit[1], $IconSplit[2]) EndIf Case $ext = ".m3u" OR $ext = ".mp3" OR $ext = ".ogg";Music files $Extreg = RegRead("HKEY_CLASSES_ROOT\" & $ext, "") $Iconreg = RegRead("HKEY_CLASSES_ROOT\" & $Extreg & "\DefaultIcon\", "") $IconSplit = StringSplit($Iconreg, ",") If NOT @error Then If StringInStr($IconSplit[2], "-") Then $IconSplit[2] = StringTrimLeft($IconSplit[2], 1) GUICtrlSetImage($Button[$id], $IconSplit[1], $IconSplit[2]) EndIf Case Else MsgBox(1,"Error", "Filetype " & $ext & " is not supported" ) Delete_item($id) EndSelect EndFunc Software:Model Train Calculator (Screen)Autoit3 beginner! Link to comment Share on other sites More sharing options...
myspacee Posted June 23, 2009 Share Posted June 23, 2009 Good job! is possible to run .exe with some parameters ? 15=x:\Programs\TrueImageES9\TrueImage.exe -s m. Link to comment Share on other sites More sharing options...
Hest Posted June 23, 2009 Author Share Posted June 23, 2009 Good job! is possible to run .exe with some parameters ? 15=x:\Programs\TrueImageES9\TrueImage.exe -s m. You can make a shortcut with parameters and put that in Just need to enable .lnk Software:Model Train Calculator (Screen)Autoit3 beginner! Link to comment Share on other sites More sharing options...
myspacee Posted June 23, 2009 Share Posted June 23, 2009 hmm... I'm using your script in BartPE an XP boot. I don't know if is possible use shortcut in this environment. Is difficult to implement .exe with switches ? Your script support batch (.cmd, .bat) ? m. Link to comment Share on other sites More sharing options...
picea892 Posted June 23, 2009 Share Posted June 23, 2009 I added an on hover event. It will change the toolbar label to to the path of the icon being hovered. expandcollapse popup#Region;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Compression=4 #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_Res_Fileversion=0.1 #AutoIt3Wrapper_Add_Constants=n #EndRegion;**** Directives created by AutoIt3Wrapper_GUI **** #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <StaticConstants.au3> #include <Constants.au3> Global $Button_num = 16 Global $Button_row = 2 Global $Button_width = 68 Global $Button_height = 40 Global $Button_distx = 8 Global $Button_disty = 8 Global $Width_screen = @DesktopWidth Global $Visible_gui = 12 Global $Showwindow = 0 Global $Transparency = 150 Global $Buttons_pr_row = Ceiling($Button_num / $Button_row) Global $Total_buttons = ($Buttons_pr_row * $Button_row) Global $Button[$Total_buttons+1] Global $Buttonid[$Total_buttons*4] Global $Width_program = ($Buttons_pr_row * $Button_width) + ($Buttons_pr_row * $Button_distx) + $Button_distx Global $Height_program = ($Button_row * $Button_height) + ($Button_row * $Button_disty) + $Button_disty + $Visible_gui Global $Height_hide = -($Height_program - $Visible_gui) Global $Width_center = ($Width_screen / 2) - ($Width_program / 2) Local $Buttonmenu[$Total_buttons+1] Local $MenuFile[$Total_buttons+1] Local $MenuFolder[$Total_buttons+1] Local $MenuDelete[$Total_buttons+1] Local $Menuline[$Total_buttons+1] Local $File_error = 0 Global $Icon_folder = 4 Global $Icon_default = 4 Global $Icon_shortcut Global $Icon_link If Not FileExists(@ScriptDir & "\toolbar.ini") Then Create_ini() Global $Filelink = IniReadSection(@ScriptDir & "\toolbar.ini", "Launch") Global $total_files = $Filelink[0][0] #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("QuickTools", $Width_program, $Height_program, $Width_center, $Height_hide, $WS_POPUP + $WS_BORDER + $WS_OVERLAPPED, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW, $WS_EX_ACCEPTFILES)) WinSetTrans($Form1, "", $Transparency) Local $ii = 1 Local $Row = 1 Local $Buttondist = $Button_width + $Button_distx Local $Nextbuttonx = $Button_distx Local $Nextbuttony = $Button_disty For $i = 1 To $Total_buttons Step 1 $Button[$i] = GUICtrlCreateButton("", $Nextbuttonx, $Nextbuttony, $Button_width, $Button_height, $WS_GROUP + $BS_ICON) GUICtrlSetState($Button[$i], $GUI_DROPACCEPTED) Local $Button_i = $Button[$i] $Buttonid[$Button_i] = $i Local $File = IniRead(@ScriptDir & "\toolbar.ini", "Launch", $i, "Empty") If FileExists($File) Then Add_icon($File, $i) ElseIf $File <> "Empty" Then Delete_item($i) Local $File_error = 1 EndIf $Buttonmenu[$i] = GUICtrlCreateContextMenu($Button[$i]) $MenuDelete[$i] = GUICtrlCreateMenuItem("Delete Item", $Buttonmenu[$i]) $Nextbuttonx = $Nextbuttonx + $Buttondist $ii = $ii + 1 If $ii > $Buttons_pr_row Then $Nextbuttonx = $Button_distx $Nextbuttony = (($Button_height + $Button_disty) * $Row) + $Button_disty $row = $row + 1 $ii = 1 EndIf Next If $File_error = 1 Then MsgBox(1,"Error", "One or more files could not be found and has been removed from the toolbar") $Quicklabel = GUICtrlCreateLabel("Quicktools", ($Width_program/2)-100, $Height_program - 12, 200, $Visible_gui, $WS_GROUP + $SS_CENTER) GUICtrlSetFont(-1, 8, 800, 0, "Arial") $Exitlabel = GUICtrlCreateLabel("X", $Width_program-8, 1, 10, 10) GUICtrlSetFont(-1, 7, 400, 0, "Arial") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 Check_mouse();Checks mouse position and shows and hides the toolbar $nMsg = GUIGetMsg() Select Case $nMsg = $Exitlabel Exit Case $nMsg = $GUI_EVENT_DROPPED Add_item() EndSelect For $i = 1 to $Total_buttons Step 1 Select Case $nMsg = $Button[$i] Local $File = IniRead(@ScriptDir & "\toolbar.ini", "Launch", $i, "Empty") If FileExists ($File) Then ShellExecute($File) Else MsgBox(1,"Error", "File could not be found") EndIf EndSelect Next For $i = 1 to $Total_buttons Step 1 Select Case $nMsg = $MenuDelete[$i] Delete_item($i) EndSelect Next $hoveringongoin=0 $hover=GUIGetCursorInfo(WinGetHandle($Form1,"")) For $i = 1 to $Total_buttons Step 1 if $hover[4]=$Button[$i] Then Local $File = IniRead(@ScriptDir & "\toolbar.ini", "Launch", $i, "Empty") If GUICtrlRead($Quicklabel)<>$File then GUICtrlSetData($Quicklabel,$File) $hoveringongoin=1 ExitLoop EndIf Next if $hoveringongoin=0 and GUICtrlRead($Quicklabel)<> "Quicktools" then GUICtrlSetData($Quicklabel,"Quicktools") WEnd Func Show() If $Showwindow = 0 Then WinSetTrans($Form1, "", 250) WinMove($Form1, "", $Width_center, $Height_hide/2) sleep(15) WinMove($Form1, "", $Width_center, $Height_hide/4) sleep(15) WinMove($Form1, "", $Width_center, $Height_hide/8) sleep(15) WinMove($Form1, "", $Width_center, 0) ;~ WinSetTrans($Form1, "", 250) $Showwindow = 1 ElseIf $Showwindow = 1 Then WinMove($Form1, "", $Width_center, $Height_hide/8) sleep(15) WinMove($Form1, "", $Width_center, $Height_hide/4) sleep(15) WinMove($Form1, "", $Width_center, $Height_hide/2) sleep(15) WinMove($Form1, "", $Width_center, $Height_hide) WinSetTrans($Form1, "", $Transparency) $Showwindow = 0 EndIf EndFunc Func Check_mouse() Local $pos = MouseGetPos() If ($Showwindow = 0 AND $pos[1] < $Visible_gui AND $pos[0] > $Width_center AND $pos[0] < ($Width_center + $Width_program)) Then Show() ElseIf ($Showwindow = 1 AND $pos[1] > $Height_program+2) Then Show() EndIf EndFunc Func Create_ini() IniWrite(@ScriptDir & "\toolbar.ini", "Launch", 1, "C:\") IniWrite(@ScriptDir & "\toolbar.ini", "Launch", 2, @ProgramFilesDir & "\Internet Explorer\iexplore.exe") IniWrite(@ScriptDir & "\toolbar.ini", "Launch", 3, @ProgramFilesDir & "\Windows Media Player\wmplayer.exe") IniWrite(@ScriptDir & "\toolbar.ini", "Launch", 4, @SystemDir & "\notepad.exe") IniWrite(@ScriptDir & "\toolbar.ini", "Launch", 5, @SystemDir & "\calc.exe") IniWrite(@ScriptDir & "\toolbar.ini", "Launch", 6, @SystemDir & "\mspaint.exe") IniWrite(@ScriptDir & "\toolbar.ini", "Launch", 7, @WindowsDir & "\explorer.exe") EndFunc;==>Create ini first time the program runs Func Delete_item($id) IniDelete (@ScriptDir & "\toolbar.ini", "Launch", $id) GUICtrlSetImage($Button[$id], "Shell32.dll", 50) GUICtrlSetTip($Button[$id], "") EndFunc Func Add_item() Local $id = $Buttonid[@GUI_DROPID] Local $File = @GUI_DRAGFILE IniWrite (@ScriptDir & "\toolbar.ini", "Launch", $id, $File ) Add_icon($File, $id) EndFunc Func Add_icon($File, $id) Local $atr = FileGetAttrib($File) Local $ext = StringLower(StringRight($File, 4)) Local $extl = StringLower(StringRight($File, 4)) Select Case $atr == "D"; Folders $Iconreg = RegRead("HKEY_CLASSES_ROOT\Directory\DefaultIcon\", "") $IconSplit = StringSplit($Iconreg, ",") If StringInStr($IconSplit[2], "-") Then $IconSplit[2] = StringTrimLeft($IconSplit[2], 1) GUICtrlSetImage($Button[$id], $IconSplit[1], 4) Case $ext = ".exe";Exe files GUICtrlSetImage($Button[$id], $File, 1) Case $ext = ".url";Web links $Iconreg = RegRead("HKEY_CLASSES_ROOT\http\DefaultIcon\", "") $IconSplit = StringSplit($Iconreg, ",") If StringInStr($IconSplit[2], "-") Then $IconSplit[2] = StringTrimLeft($IconSplit[2], 1) GUICtrlSetImage($Button[$id], $IconSplit[1], $IconSplit[2]) Case $ext = ".txt" OR $ext = ".chm" OR $ext = ".odt" OR $ext = ".doc" OR $extl = ".docx" OR $ext = ".pdf" OR $ext = ".ini";Text files $Extreg = RegRead("HKEY_CLASSES_ROOT\" & $ext, "") $Iconreg = RegRead("HKEY_CLASSES_ROOT\" & $Extreg & "\DefaultIcon\", "") $IconSplit = StringSplit($Iconreg, ",") If NOT @error Then If StringInStr($IconSplit[2], "-") Then $IconSplit[2] = StringTrimLeft($IconSplit[2], 1) GUICtrlSetImage($Button[$id], $IconSplit[1], $IconSplit[2]) EndIf Case $ext = ".jpg" OR $ext = ".bmp" OR $ext = ".avi" OR $ext = ".mpg" OR $extl = ".mpeg" OR $ext = ".flv";Movie files $Extreg = RegRead("HKEY_CLASSES_ROOT\" & $ext, "") $Iconreg = RegRead("HKEY_CLASSES_ROOT\" & $Extreg & "\DefaultIcon\", "") $IconSplit = StringSplit($Iconreg, ",") If NOT @error Then If StringInStr($IconSplit[2], "-") Then $IconSplit[2] = StringTrimLeft($IconSplit[2], 1) GUICtrlSetImage($Button[$id], $IconSplit[1], $IconSplit[2]) EndIf Case $ext = ".m3u" OR $ext = ".mp3" OR $ext = ".ogg";Music files $Extreg = RegRead("HKEY_CLASSES_ROOT\" & $ext, "") $Iconreg = RegRead("HKEY_CLASSES_ROOT\" & $Extreg & "\DefaultIcon\", "") $IconSplit = StringSplit($Iconreg, ",") If NOT @error Then If StringInStr($IconSplit[2], "-") Then $IconSplit[2] = StringTrimLeft($IconSplit[2], 1) GUICtrlSetImage($Button[$id], $IconSplit[1], $IconSplit[2]) EndIf Case Else MsgBox(1,"Error", "Filetype " & $ext & " is not supported" ) Delete_item($id) EndSelect EndFunc Link to comment Share on other sites More sharing options...
Hest Posted June 24, 2009 Author Share Posted June 24, 2009 I added an on hover event. It will change the toolbar label to to the path of the icon being hovered.Thx, that looks good. I was thinking about making a tooltip, but I like that idear better Software:Model Train Calculator (Screen)Autoit3 beginner! Link to comment Share on other sites More sharing options...
HAL9000 Posted June 24, 2009 Share Posted June 24, 2009 i get this error --------------------------- Error --------------------------- Filetype c:\ is not supported --------------------------- Link to comment Share on other sites More sharing options...
Hest Posted June 24, 2009 Author Share Posted June 24, 2009 i get this error---------------------------Error---------------------------Filetype c:\ is not supported---------------------------Yeah I'm still working on that one. Its because its not recognised as a folder nor file. Should work in the next update Software:Model Train Calculator (Screen)Autoit3 beginner! Link to comment Share on other sites More sharing options...
BoogY Posted August 7, 2009 Share Posted August 7, 2009 Rely nice man thanks a lot... Link to comment Share on other sites More sharing options...
MadMaxx Posted February 10, 2011 Share Posted February 10, 2011 I added an on hover event. It will change the toolbar label to to the path of the icon being hovered. expandcollapse popup#Region;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Compression=4 #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_Res_Fileversion=0.1 #AutoIt3Wrapper_Add_Constants=n #EndRegion;**** Directives created by AutoIt3Wrapper_GUI **** #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <StaticConstants.au3> #include <Constants.au3> Global $Button_num = 16 Global $Button_row = 2 Global $Button_width = 68 Global $Button_height = 40 Global $Button_distx = 8 Global $Button_disty = 8 Global $Width_screen = @DesktopWidth Global $Visible_gui = 12 Global $Showwindow = 0 Global $Transparency = 150 Global $Buttons_pr_row = Ceiling($Button_num / $Button_row) Global $Total_buttons = ($Buttons_pr_row * $Button_row) Global $Button[$Total_buttons+1] Global $Buttonid[$Total_buttons*4] Global $Width_program = ($Buttons_pr_row * $Button_width) + ($Buttons_pr_row * $Button_distx) + $Button_distx Global $Height_program = ($Button_row * $Button_height) + ($Button_row * $Button_disty) + $Button_disty + $Visible_gui Global $Height_hide = -($Height_program - $Visible_gui) Global $Width_center = ($Width_screen / 2) - ($Width_program / 2) Local $Buttonmenu[$Total_buttons+1] Local $MenuFile[$Total_buttons+1] Local $MenuFolder[$Total_buttons+1] Local $MenuDelete[$Total_buttons+1] Local $Menuline[$Total_buttons+1] Local $File_error = 0 Global $Icon_folder = 4 Global $Icon_default = 4 Global $Icon_shortcut Global $Icon_link If Not FileExists(@ScriptDir & "\toolbar.ini") Then Create_ini() Global $Filelink = IniReadSection(@ScriptDir & "\toolbar.ini", "Launch") Global $total_files = $Filelink[0][0] #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("QuickTools", $Width_program, $Height_program, $Width_center, $Height_hide, $WS_POPUP + $WS_BORDER + $WS_OVERLAPPED, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW, $WS_EX_ACCEPTFILES)) WinSetTrans($Form1, "", $Transparency) Local $ii = 1 Local $Row = 1 Local $Buttondist = $Button_width + $Button_distx Local $Nextbuttonx = $Button_distx Local $Nextbuttony = $Button_disty For $i = 1 To $Total_buttons Step 1 $Button[$i] = GUICtrlCreateButton("", $Nextbuttonx, $Nextbuttony, $Button_width, $Button_height, $WS_GROUP + $BS_ICON) GUICtrlSetState($Button[$i], $GUI_DROPACCEPTED) Local $Button_i = $Button[$i] $Buttonid[$Button_i] = $i Local $File = IniRead(@ScriptDir & "\toolbar.ini", "Launch", $i, "Empty") If FileExists($File) Then Add_icon($File, $i) ElseIf $File <> "Empty" Then Delete_item($i) Local $File_error = 1 EndIf $Buttonmenu[$i] = GUICtrlCreateContextMenu($Button[$i]) $MenuDelete[$i] = GUICtrlCreateMenuItem("Delete Item", $Buttonmenu[$i]) $Nextbuttonx = $Nextbuttonx + $Buttondist $ii = $ii + 1 If $ii > $Buttons_pr_row Then $Nextbuttonx = $Button_distx $Nextbuttony = (($Button_height + $Button_disty) * $Row) + $Button_disty $row = $row + 1 $ii = 1 EndIf Next If $File_error = 1 Then MsgBox(1,"Error", "One or more files could not be found and has been removed from the toolbar") $Quicklabel = GUICtrlCreateLabel("Quicktools", ($Width_program/2)-100, $Height_program - 12, 200, $Visible_gui, $WS_GROUP + $SS_CENTER) GUICtrlSetFont(-1, 8, 800, 0, "Arial") $Exitlabel = GUICtrlCreateLabel("X", $Width_program-8, 1, 10, 10) GUICtrlSetFont(-1, 7, 400, 0, "Arial") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 Check_mouse();Checks mouse position and shows and hides the toolbar $nMsg = GUIGetMsg() Select Case $nMsg = $Exitlabel Exit Case $nMsg = $GUI_EVENT_DROPPED Add_item() EndSelect For $i = 1 to $Total_buttons Step 1 Select Case $nMsg = $Button[$i] Local $File = IniRead(@ScriptDir & "\toolbar.ini", "Launch", $i, "Empty") If FileExists ($File) Then ShellExecute($File) Else MsgBox(1,"Error", "File could not be found") EndIf EndSelect Next For $i = 1 to $Total_buttons Step 1 Select Case $nMsg = $MenuDelete[$i] Delete_item($i) EndSelect Next $hoveringongoin=0 $hover=GUIGetCursorInfo(WinGetHandle($Form1,"")) For $i = 1 to $Total_buttons Step 1 if $hover[4]=$Button[$i] Then Local $File = IniRead(@ScriptDir & "\toolbar.ini", "Launch", $i, "Empty") If GUICtrlRead($Quicklabel)<>$File then GUICtrlSetData($Quicklabel,$File) $hoveringongoin=1 ExitLoop EndIf Next if $hoveringongoin=0 and GUICtrlRead($Quicklabel)<> "Quicktools" then GUICtrlSetData($Quicklabel,"Quicktools") WEnd Func Show() If $Showwindow = 0 Then WinSetTrans($Form1, "", 250) WinMove($Form1, "", $Width_center, $Height_hide/2) sleep(15) WinMove($Form1, "", $Width_center, $Height_hide/4) sleep(15) WinMove($Form1, "", $Width_center, $Height_hide/8) sleep(15) WinMove($Form1, "", $Width_center, 0) ;~ WinSetTrans($Form1, "", 250) $Showwindow = 1 ElseIf $Showwindow = 1 Then WinMove($Form1, "", $Width_center, $Height_hide/8) sleep(15) WinMove($Form1, "", $Width_center, $Height_hide/4) sleep(15) WinMove($Form1, "", $Width_center, $Height_hide/2) sleep(15) WinMove($Form1, "", $Width_center, $Height_hide) WinSetTrans($Form1, "", $Transparency) $Showwindow = 0 EndIf EndFunc Func Check_mouse() Local $pos = MouseGetPos() If ($Showwindow = 0 AND $pos[1] < $Visible_gui AND $pos[0] > $Width_center AND $pos[0] < ($Width_center + $Width_program)) Then Show() ElseIf ($Showwindow = 1 AND $pos[1] > $Height_program+2) Then Show() EndIf EndFunc Func Create_ini() IniWrite(@ScriptDir & "\toolbar.ini", "Launch", 1, "C:\") IniWrite(@ScriptDir & "\toolbar.ini", "Launch", 2, @ProgramFilesDir & "\Internet Explorer\iexplore.exe") IniWrite(@ScriptDir & "\toolbar.ini", "Launch", 3, @ProgramFilesDir & "\Windows Media Player\wmplayer.exe") IniWrite(@ScriptDir & "\toolbar.ini", "Launch", 4, @SystemDir & "\notepad.exe") IniWrite(@ScriptDir & "\toolbar.ini", "Launch", 5, @SystemDir & "\calc.exe") IniWrite(@ScriptDir & "\toolbar.ini", "Launch", 6, @SystemDir & "\mspaint.exe") IniWrite(@ScriptDir & "\toolbar.ini", "Launch", 7, @WindowsDir & "\explorer.exe") EndFunc;==>Create ini first time the program runs Func Delete_item($id) IniDelete (@ScriptDir & "\toolbar.ini", "Launch", $id) GUICtrlSetImage($Button[$id], "Shell32.dll", 50) GUICtrlSetTip($Button[$id], "") EndFunc Func Add_item() Local $id = $Buttonid[@GUI_DROPID] Local $File = @GUI_DRAGFILE IniWrite (@ScriptDir & "\toolbar.ini", "Launch", $id, $File ) Add_icon($File, $id) EndFunc Func Add_icon($File, $id) Local $atr = FileGetAttrib($File) Local $ext = StringLower(StringRight($File, 4)) Local $extl = StringLower(StringRight($File, 4)) Select Case $atr == "D"; Folders $Iconreg = RegRead("HKEY_CLASSES_ROOT\Directory\DefaultIcon\", "") $IconSplit = StringSplit($Iconreg, ",") If StringInStr($IconSplit[2], "-") Then $IconSplit[2] = StringTrimLeft($IconSplit[2], 1) GUICtrlSetImage($Button[$id], $IconSplit[1], 4) Case $ext = ".exe";Exe files GUICtrlSetImage($Button[$id], $File, 1) Case $ext = ".url";Web links $Iconreg = RegRead("HKEY_CLASSES_ROOT\http\DefaultIcon\", "") $IconSplit = StringSplit($Iconreg, ",") If StringInStr($IconSplit[2], "-") Then $IconSplit[2] = StringTrimLeft($IconSplit[2], 1) GUICtrlSetImage($Button[$id], $IconSplit[1], $IconSplit[2]) Case $ext = ".txt" OR $ext = ".chm" OR $ext = ".odt" OR $ext = ".doc" OR $extl = ".docx" OR $ext = ".pdf" OR $ext = ".ini";Text files $Extreg = RegRead("HKEY_CLASSES_ROOT\" & $ext, "") $Iconreg = RegRead("HKEY_CLASSES_ROOT\" & $Extreg & "\DefaultIcon\", "") $IconSplit = StringSplit($Iconreg, ",") If NOT @error Then If StringInStr($IconSplit[2], "-") Then $IconSplit[2] = StringTrimLeft($IconSplit[2], 1) GUICtrlSetImage($Button[$id], $IconSplit[1], $IconSplit[2]) EndIf Case $ext = ".jpg" OR $ext = ".bmp" OR $ext = ".avi" OR $ext = ".mpg" OR $extl = ".mpeg" OR $ext = ".flv";Movie files $Extreg = RegRead("HKEY_CLASSES_ROOT\" & $ext, "") $Iconreg = RegRead("HKEY_CLASSES_ROOT\" & $Extreg & "\DefaultIcon\", "") $IconSplit = StringSplit($Iconreg, ",") If NOT @error Then If StringInStr($IconSplit[2], "-") Then $IconSplit[2] = StringTrimLeft($IconSplit[2], 1) GUICtrlSetImage($Button[$id], $IconSplit[1], $IconSplit[2]) EndIf Case $ext = ".m3u" OR $ext = ".mp3" OR $ext = ".ogg";Music files $Extreg = RegRead("HKEY_CLASSES_ROOT\" & $ext, "") $Iconreg = RegRead("HKEY_CLASSES_ROOT\" & $Extreg & "\DefaultIcon\", "") $IconSplit = StringSplit($Iconreg, ",") If NOT @error Then If StringInStr($IconSplit[2], "-") Then $IconSplit[2] = StringTrimLeft($IconSplit[2], 1) GUICtrlSetImage($Button[$id], $IconSplit[1], $IconSplit[2]) EndIf Case Else MsgBox(1,"Error", "Filetype " & $ext & " is not supported" ) Delete_item($id) EndSelect EndFunc</div> picea892 this is a great utility I use it all the time, thx. I have a request tho. I have looked at doing this myself but it isi far too advanced for me ;-) Currently if you right click on one of the buttons have the option to "Delete Item". I was wondering if it would be possible to add an option to edit the script. Regards Maxx Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now