arcker Posted December 19, 2006 Share Posted December 19, 2006 (edited) Here is my last script, needed by my firm. It's for users that need to access to application quickly, instead of opening the startmenu each time they need. You can your directories, and config some things (transparency, save in inifile...) I'm still on two majors problems : =>guictrlsetonevent doesn't work with the configuration window =>filegetshortcut works rarely (impossible to get custom icons from shortcuts) For now, you need 3 files : The program The slide code (valuater & simucal source, + randallc modified, and then by me) => i can post the file, the upload say me it larger than the space available...for 7ko, sure lol ^^ so here is in code : (Slider_menu.au3) expandcollapse popup;slider.au3 0_29 #include-once #include <GUIConstants.au3> #region - Constants For AnimateWindow Global $i_SLIDER_pass = 0, $s_SLIDER_side="right", $ar_SLIDER_apos[1], $i_SLIDER_hide_state=0 Global Const $AW_HOR_POSITIVE = 0x00000001 Global Const $AW_HOR_NEGATIVE = 0x00000002 Global Const $AW_VER_POSITIVE = 0x00000004 Global Const $AW_VER_NEGATIVE = 0x00000008 Global Const $AW_HIDE = 0x00010000 Global Const $AW_SLIDE = 0x00040000 #endregion #region Constants For Functions Global Const $WindowTitleBarHeight = 24 ; not my doing.. 20 top, 4 bottom.. 4 (3?) either side Global $CurrentActiveWindow, $IniPath = @ScriptDir & "\Toolbar.ini" Global $StartingLabel = "" ; Tell user to click setup, killed after first submit Global $Toolbar_WinLocation = 0 ; 0 = Upper-Left (default), 1 = Lower-Right Global $Button_Width = 40, $Button_Height = 40, $Button_SideGaps = 25, $Button_MidGaps = 5 Global $NumButtonsMax = Int ((@DesktopHeight - ($WindowTitleBarHeight + $Button_Height + 2*$Button_MidGaps)) / ($Button_Height+$Button_MidGaps)) Global $Toolbar_Width = 450;250 Global $Toolbar_Height = @DesktopHeight - $WindowTitleBarHeight, $Slide_Delay = 100 Global $NumPages = 1, $CurrentPage = 1, $CurrentCommand = 1, $NumCommands = 0 Global $Toolbar_Buttons[$NumButtonsMax + 1] ; gui control ... constant dimension size Global $Toolbar_LabelControls[$NumButtonsMax + 1] ; gui control ... constant dimension size Global $Toolbar_LabelText[$NumButtonsMax*$NumPages + 1] ; text Global $Toolbar_FileLocations[$NumButtonsMax*$NumPages + 1][4] ; file location, params, working dir, flag Global $Toolbar_Icons[$NumButtonsMax*$NumPages + 1][2] ; file location, icon number (-1 is def) #endregion #region - Location-specific Variables ; Defaults to Upper-Left Toolbar Location - only changes on restart $Toolbar_OpenWin_Left = 0 $Toolbar_OpenWin_Top = 0 $Toolbar_OpenButton_Text = "y" ; y or z $Toolbar_MainWin_Left = 0 $Toolbar_CloseButton_Text = "j" ; j or m $Toolbar_CloseButton_Left = $Toolbar_Width - ($Button_Width + 5) $Toolbar_CloseButton_Top = $Toolbar_Height - ($Button_Height + 5) $Toolbar_PrevPageButton_Top = $Toolbar_Height - ($Button_Width + 5) $Toolbar_NextPageButton_Top = $Toolbar_Height - ($Button_Width + 5) $Toolbar_ConfigButton_Left = 5 $Toolbar_ConfigButton_Top = $Toolbar_Height - ($Button_Width + 5) $Button_Top = 0 $Toolbar_MainWinAnimationOpen = $AW_SLIDE + $AW_HOR_POSITIVE + $AW_VER_POSITIVE $Toolbar_MainWinAnimationClosed = $AW_HIDE + $AW_SLIDE + $AW_HOR_NEGATIVE + $AW_VER_NEGATIVE #endregion #region - Variables If $Toolbar_WinLocation = 1 Then $Toolbar_OpenWin_Left = @DesktopWidth - 11 $Toolbar_OpenWin_Top = @DesktopHeight - 11 $Toolbar_OpenButton_Text = "z" ; y or z $Toolbar_MainWin_Left = @DesktopWidth - $Toolbar_Width - 6 $Toolbar_CloseButton_Text = "m" ; j or m $Toolbar_CloseButton_Left = 5 ; $Toolbar_Width - ($Button_Width + 5) $Toolbar_CloseButton_Top = 5 ; $Toolbar_Height - ($Button_Height + 5) $Toolbar_PrevPageButton_Top = 5 ; $Toolbar_Height - ($Button_Width + 5) $Toolbar_NextPageButton_Top = 5 ; $Toolbar_Height - ($Button_Width + 5) $Toolbar_ConfigButton_Left = $Toolbar_Width - ($Button_Width + 5) ; 5 $Toolbar_ConfigButton_Top = 5 ; $Toolbar_Height - ($Button_Width + 5) $Button_Top = $Toolbar_Height - (5 + $Button_Top + $NumButtonsMax*($Button_Height + $Button_MidGaps)) ; 45 $Toolbar_MainWinAnimationOpen = $AW_SLIDE + $AW_HOR_NEGATIVE + $AW_VER_NEGATIVE $Toolbar_MainWinAnimationClosed = $AW_HIDE + $AW_SLIDE + $AW_HOR_POSITIVE + $AW_VER_POSITIVE EndIf $hwnd = GUICreate ("Tool", 18, 18, $Toolbar_OpenWin_Left, $Toolbar_OpenWin_Top, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) ;~ $Toolbar_OpenWin = GUICreate ("Tool", 11, 11, $Toolbar_OpenWin_Left, $Toolbar_OpenWin_Top, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) GUISetFont (12, "", "", "Wingdings 3") $Toolbar_OpenButton = GUICtrlCreateButton ($Toolbar_OpenButton_Text, 0, 0, 18, 18, $BS_FLAT) GUICtrlSetColor(-1,0xff0000) ;red GUICtrlSetTip ($Toolbar_OpenButton, "Show Toolbar") WinSetTrans ($hwnd, "", 150) GUISetState (@SW_HIDE) #endregion Func Slide_in($hwndfunc,$hwnd2Func) $i_SLIDER_hide_state = 0 GUISetState(@SW_HIDE, $hwndfunc) DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd2Func, "int", $Slide_Delay, "long", $Toolbar_MainWinAnimationOpen) GUISetState(@SW_SHOW, $hwnd2Func) WinActivate($hwnd2Func) WinWaitActive($hwnd2Func) EndFunc ;==>Slide_in Func Slide_out($hwndfunc,$hwnd2Func) $i_SLIDER_hide_state = 1 DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hwnd2Func, "int", $Slide_Delay, "long", $Toolbar_MainWinAnimationClosed) GUISetState(@SW_HIDE, $hwnd2Func) GUISetState(@SW_SHOW, $hwndfunc) WinActivate($hwndfunc) WinWaitActive($hwndfunc) EndFunc ;==>Slide_out Func SideSwitch($Hide,$Show,$Edit) If $i_SLIDER_pass = "left" Then $i_SLIDER_pass = "right" GuiCtrlSetPos($Hide,1,8) GuiCtrlSetData($Hide, ">") GuiCtrlSetPos($configbutton,1,40) GuiCtrlSetPos($refreshbutton,1,70) GuiCtrlSetPos($addbutton,1,110) if $Edit<>-1 then GUICtrlSetPos($Edit,485,8) Else $i_SLIDER_pass = "left" GuiCtrlSetPos($Hide,485, 8) GuiCtrlSetData($Hide, "<") if $Edit<>-1 then GUICtrlSetPos($Edit,1,8) EndIf EndFunc Func _WinMove($Hide,$Show,$Edit,$hwndfunc,$hwnd2Func);_Win_in(byref $sideMonitor) $ar_SLIDER_apos = WinGetPos($hwnd2Func) $a_pos2 = WinGetPos($hwndfunc) If $i_SLIDER_pass = "left" Then If $ar_SLIDER_apos[0]+306 < (@DesktopWidth / 2) Then If $ar_SLIDER_apos[0] <> 0 And $i_SLIDER_hide_state = 0 And $ar_SLIDER_apos[0] Then WinMove($hwnd2Func, "", 0, $ar_SLIDER_apos[1]) WinMove($hwndfunc, "", 0, $ar_SLIDER_apos[1]) ;~ WinMove($hwndfunc, "", -588, $ar_SLIDER_apos[1]) EndIf If $a_pos2[0] <> - 588 And $i_SLIDER_hide_state = 1 Then WinMove($hwndfunc, "", 0, $a_pos2[1]) ;~ WinMove($hwndfunc, "", -588, $a_pos2[1]) WinMove($hwnd2Func, "", 0, $a_pos2[1]) EndIf Else SideSwitch($Hide,$Show,$Edit) EndIf EndIf If $i_SLIDER_pass = "right" Then If $ar_SLIDER_apos[0]+306 > (@DesktopWidth / 2) Then If $ar_SLIDER_apos[0] <> @DesktopWidth-505 And $i_SLIDER_hide_state = 0 Then WinMove($hwnd2Func, "", @DesktopWidth-505, $ar_SLIDER_apos[1]) WinMove($hwndfunc, "", @DesktopWidth-23, $ar_SLIDER_apos[1]) ; should be -15 EndIf If $a_pos2[0] <> (@DesktopWidth-23) And $i_SLIDER_hide_state = 1 Then ; should be -15 WinMove($hwndfunc, "", @DesktopWidth-23, $ar_SLIDER_apos[1]) ; should be -15 WinMove($hwnd2Func, "", @DesktopWidth-505, $ar_SLIDER_apos[1]) EndIf Else SideSwitch($Hide,$Show,$Edit) EndIf EndIf EndFunc func _WinHide($hwndF,$hwnd2F) If $i_SLIDER_pass = 1 Then WinSetTitle($hwnd2F, "", "Sliding Launcher") $i_SLIDER_pass = 0 Else Slide_out($hwndF,$hwnd2F) EndIf EndFunc ;==>_DisplayDate The ini file (toolbar_menu.ini) [config] title=toolbar new method alwaysvisible=0 menuspeed=100 transparencyopened=255 transparencyclose=255 [directories] [tabs] Edited December 19, 2006 by arcker -- Arck System _ Soon -- Ideas make everything "La critique est facile, l'art est difficile" Projects :[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list] 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