Jump to content

marcgforce

Members
  • Posts

    18
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

marcgforce's Achievements

Seeker

Seeker (1/7)

4

Reputation

  1. Func _MouseIsOverHWnd($hWnd) ;to check if mouse is on or off GUI Local $bMouseOver If not WinActive($hWnd) then return False Local $aMousePos = MouseGetPos() Local $aWinPos = WinGetPos($hWnd) if ($aMousePos[0] < $aWinPos[0] Or $aMousePos[0] > $aWinPos[0] + $aWinPos[2]) Or ($aMousePos[1] < $aWinPos[1] Or $aMousePos[1] > $aWinPos[1] + $aWinPos[3]) Then $bMouseOver = False Else $bMouseOver = True EndIf Return $bMouseOver EndFunc ;==>_MouseIsOverHWnd Just checking if mouse is over gui...
  2. easy peasy 😄
  3. dan_555 in you game auto o gram, it should be grate to make a color cycle to change the color of the square (if its grey to black and if its black, to grey, right click should be X )
  4. Thanks for reply but my problem is not on the hotsetkey function, just when you use two screens on your desktop and want to capture something by drawing a restangle with the mouse, the rectangle is shown on the main screen (when you capture on it) and not on the second (if you capture on it)... Thanks
  5. Hello guys, I'm asking for help, i have a script that captures a region of the screen defined by drawing a rectangle with mouse on it; it works perfectly when there's only one screen attached to the computer but when a second screen is connected, the rectangle is not shown on the virtualized screen... someone could fix this script, i'm turning around without founding the solution... #include <Date.au3> #include<array.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #Include <ScreenCapture.au3> #Include <Misc.au3> #include <EditConstants.au3> #include <Clipboard.au3> Global $pos, $sfilename_complete Global $iX1, $iY1, $iX2, $iY2, $aPos, $sMsg, $sBMP_Path Global Const $IMAGE = $sfilename_complete ; Location of the image file to print Global $s_ProgramTitle01 = "Select Rectangle" Global $visionner = False HotKeySet("{PRINTSCREEN}","_capture") Opt("TrayMenuMode",1) Local $trayMenuLancer = TrayCreateItem("Voir la capture") TrayItemSetState($trayMenuLancer,4) Local $trayMenu = TrayCreateItem ("Quitter") While 1 $nsystray = TrayGetMsg() Select case $nsystray = $trayMenuLancer If $visionner = False Then TrayItemSetState($trayMenuLancer,1) $visionner = True Else $visionner = False TrayItemSetState($trayMenuLancer,4) EndIf case $nsystray = $trayMenu Exit EndSelect sleep(100) WEnd Func _capture() local $aRet = Mark_Rect() If IsArray($aRet) then Local $hGUI, $hBMP, $hBitmap, $hGraphic, $hImage, $iX, $iY, $hClone $input_name = Inputbox("Capture","Entrer le nom de la capture écran", "capture-" & StringReplace(_nowtime(),":","")) if @error == 1 then Return while _CheckForbidden($input_name) <> 0 msgbox (64,"Erreur", "Erreur, le nom comporte des caractères interdits :"& @CRLF & '["/\\*?<>|:]') $input_name = Inputbox("Capture","Entrer le nom de la capture écran", "capture-" & StringReplace(_nowtime(),":","")) if @error == 1 then Return wend local $sfilename = $input_name $sfilename_jpg_complete = @MyDocumentsDir & "\" & $sfilename & ".jpg" $sfilename_bmp_complete = @MyDocumentsDir & "\" & $sfilename & ".bmp" sleep (500) ; Capture un bitmap 32 bits $hBMP = _ScreenCapture_Capture(@MyDocumentsDir & "\" & $sfilename & ".bmp", $iX1, $iY1, $iX2, $iY2, False) $hJPG = _ScreenCapture_Capture(@MyDocumentsDir & "\" & $sfilename & ".jpg", $iX1, $iY1, $iX2, $iY2, False) $hClipboard_Bitmap = _WinAPI_LoadImage("",$sfilename_bmp_complete, $IMAGE_BITMAP, $iX2-$iX1,$iy2-$iy1,$LR_LOADFROMFILE) _ClipBoard_Open(0) _ClipBoard_Empty() _ClipBoard_SetDataEx($hClipboard_Bitmap,$CF_BITMAP) _ClipBoard_Close() FileDelete($sfilename_bmp_complete) if not $hClipboard_Bitmap then Msgbox(64,"Erreur", "Image non capturée") Else msgbox(0,"Capture","Le fichier à été copié dans " & $sfilename_jpg_complete & " et placé dans le Presse papiers",1) if $visionner Then ShellExecute($sfilename_jpg_complete) EndIf ;ShellExecute($sfilename_complete) Else Return $aRet EndIf EndFunc ;==> _capture Func Mark_Rect() Local $deskSurface = _GetVirtualScreen() Local $aMouse_Pos, $hMask, $hMaster_Mask, $iTemp Local $UserDLL = DllOpen("user32.dll") Local $aRet[4] ; Create transparent GUI with Cross cursor $hCross_GUI = GUICreate("Test", $deskSurface[1] - $deskSurface[0] , $deskSurface[3] - 20, $deskSurface[0], $deskSurface[2], $WS_POPUP, $WS_EX_TOPMOST) WinSetTrans($hCross_GUI, "", 8) GUISetState(@SW_SHOW, $hCross_GUI) GUISetCursor(3, 1, $hCross_GUI) ; Wait until mouse button pressed While Not _IsPressed("01", $UserDLL) Sleep(10) if _IsPressed("1B", $UserDLL) then ;GUIDelete( $hRectangle_GUI) GUIDelete($hCross_GUI) DllClose($UserDLL) $aRet = "ESC" return $aRet EndIf WEnd ; Get first mouse position $aMouse_Pos = MouseGetPos() $iX1 = $aMouse_Pos[0] $iY1 = $aMouse_Pos[1] ConsoleWrite($iX1 & @tab & $iy1 & @CRLF) Global $hRectangle_GUI = GUICreate("", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST) ; initial value ;Global $hRectangle_GUI = GUICreate("", $deskSurface[1] - $deskSurface[0] , $deskSurface[3], $deskSurface[0], $deskSurface[2], $WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST); modification that doesn't work like i want. GUISetBkColor(0x000000) ;guisetstate(@SW_SHOW,$hRectangle_GUI) ; $WS_EX_TOOLWINDOW + ; Draw rectangle while mouse button pressed While _IsPressed("01", $UserDLL) $aMouse_Pos = MouseGetPos() $hMaster_Mask = _WinAPI_CreateRectRgn(0, 0, 0,0) $hMask = _WinAPI_CreateRectRgn($iX1, $aMouse_Pos[1], $aMouse_Pos[0], $aMouse_Pos[1] + 1) ; Bottom of rectangle _WinAPI_CombineRgn($hMaster_Mask, $hMask, $hMaster_Mask, 2) _WinAPI_DeleteObject($hMask) $hMask = _WinAPI_CreateRectRgn($iX1, $iY1, $iX1 + 1, $aMouse_Pos[1]) ; Left of rectangle _WinAPI_CombineRgn($hMaster_Mask, $hMask, $hMaster_Mask, 2) _WinAPI_DeleteObject($hMask) $hMask = _WinAPI_CreateRectRgn($iX1 + 1, $iY1 + 1, $aMouse_Pos[0], $iY1) ; Top of rectangle _WinAPI_CombineRgn($hMaster_Mask, $hMask, $hMaster_Mask, 2) _WinAPI_DeleteObject($hMask) $hMask = _WinAPI_CreateRectRgn($aMouse_Pos[0], $iY1, $aMouse_Pos[0] + 1, $aMouse_Pos[1]) ; Right of rectangle _WinAPI_CombineRgn($hMaster_Mask, $hMask, $hMaster_Mask, 2) _WinAPI_DeleteObject($hMask) ; Set overall region _WinAPI_SetWindowRgn($hRectangle_GUI, $hMaster_Mask) If WinGetState($hRectangle_GUI) < 15 Then GUISetState() Sleep(10) WEnd ; Get second mouse position $iX2 = $aMouse_Pos[0] $iY2 = $aMouse_Pos[1] ; Set in correct order if required If $iX2 < $iX1 Then $iTemp = $iX1 $iX1 = $iX2 $iX2 = $iTemp EndIf If $iY2 < $iY1 Then $iTemp = $iY1 $iY1 = $iY2 $iY2 = $iTemp EndIf GUIDelete( $hRectangle_GUI) GUIDelete($hCross_GUI) DllClose($UserDLL) $aRet[0] = $iX1 $aRet[1] = $iY1 $aRet[2] = $iX2 $aRet[3] = $iY2 if ($iX2-$iX1)+($iY2-$iY1) < 150 Then msgbox(0,"Erreur","Capture trop petite : "& ($iX2-$iX1)+($iY2-$iY1) & " Pixel(s), non enregistrée",2) $aRet = "" $aRet = "ESC" EndIf return $aRet EndFunc ;==>Mark_Rect Func _GetVirtualScreen() ;~ 'Virtual Desktop sizes Local $SM_XVIRTUALSCREEN = 76 ; 'Virtual Left Local $SM_YVIRTUALSCREEN = 77 ; 'Virtual Top Local $SM_CXVIRTUALSCREEN = 78 ; 'Virtual Width Local $SM_CYVIRTUALSCREEN = 79 ; 'Virtual Height Dim $xyScreen[4] Dim $VirtualScreen[4] = [$SM_XVIRTUALSCREEN, $SM_CXVIRTUALSCREEN, $SM_YVIRTUALSCREEN, $SM_CYVIRTUALSCREEN] For $x = 0 To 3 $xTemp = DllCall("user32.dll", "int", "GetSystemMetrics", "int", $VirtualScreen[$x]) If $x = 1 Then ;~ Note: $SM_CXVIRTUALSCREEN + $SM_XVIRTUALSCREEN = $RightSideScreen $xyScreen[$x] = ($xTemp[0] + $xyScreen[$x - 1]) - 1 Else $xyScreen[$x] = $xTemp[0] If $x = 3 Then $xyScreen[$x] -= 1 EndIf Next Return ($xyScreen) EndFunc ;==>_GetVirtualScreen Func _CheckForbidden($string) Local $pattern_forbid = '["/\\*?<>|:]' Return StringRegExp($string, $pattern_forbid) EndFunc Thanks...
  6. The script was sleeping on my exemple collections, and last month i've decided to add the possibility to add my own shortcuts by drag'n drop using the "dragdropevent-udf and making this tool an great utility.... i've added : - drag and drop shortcuts, files, and hyperlinks - an iconset dll to have your own icons - possibility to save the windows position and size and also getting back to the initial state (context menu from the title bar) -shortcuts and config are saved in two inifiles in appdata (each user can have his own shortcuts) the gui appears when mouse stays 1 sec at the borders of the screen and disapears after 5 secs or if a clic is done out of the gui if you want to add a shortcut, you'll need to fix the windows by the context menu (figer) i've open a github repository for this tool, if you want to add your own ideas or correct bugs. the files like iconset and dragdropevent are on the github repo... thanks. #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=..\..\Users\0469327\Pictures\Icones\launchpad.ico #AutoIt3Wrapper_Outfile=launchpad.exe #AutoIt3Wrapper_Res_Description=Launcher SPAFA #AutoIt3Wrapper_Res_Fileversion=1.0.0.0 #AutoIt3Wrapper_Res_CompanyName=SPAFA MARSEILLE #AutoIt3Wrapper_Res_LegalCopyright=Marc GRAZIANI #AutoIt3Wrapper_Res_Language=1036 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ; =============================================================================================================================== ; Title .........: LaunchPad ; Description ...: button deck to be used as an applications launcher (and not only) ; Author(s) .....: Chimp (Gianni Addiego) ; credits to @KaFu, @Danyfirex, @mikell (see comments for references) ; Modification...: Marcgforce (drag and drop add, passing ini to links) ; =============================================================================================================================== #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3>;<WinAPISysWin.au3> #include <SendMessage.au3> #include <WinAPIFiles.au3> #include <Array.au3> #include <file.au3> #include <TrayConstants.au3> ; Required for the $TRAY_ICONSTATE_SHOW constant. #Include "DragDropEvent.au3" #include <ButtonConstants.au3> #include <ButtonConstants.au3> #include <GDIPlus.au3> #include <Misc.au3> #include <ScreenCapture.au3> #include <WinAPIShellEx.au3> #include <WinAPIRes.au3> #include <WinAPISysWin.au3> ;Turn off redirection for a 32-bit script on 64-bit system. If @OSArch = "X64" And Not @AutoItX64 Then _WinAPI_Wow64EnableWow64FsRedirection(False) ; https://docs.microsoft.com/en-us/windows/win32/winmsg/wm-sizing Global Const $WMSZ_LEFT = 1 Global Const $WMSZ_RIGHT = 2 Global Const $WMSZ_TOP = 3 Global Const $WMSZ_TOPLEFT = 4 Global Const $WMSZ_TOPRIGHT = 5 Global Const $WMSZ_BOTTOM = 6 Global Const $WMSZ_BOTTOMLEFT = 7 Global Const $WMSZ_BOTTOMRIGHT = 8 Global Enum $vButton_Tip = 0, $vButton_IconPath, $vButton_IconNumber, $vButton_Command Global $version="V 0.1 alpha" Global $dll_icones = @scriptdir & "\Assets\iconset.dll" Global $array Global $g_tStruct = DllStructCreate($tagPOINT) ; Create a structure that defines the point to be checked. Global $fixwindows = False Dim $aPos[4] Dim $idNewsubmenu[40] Dim $idChangeIcon[40] ;listview notifications local const $appdatauser = @AppDataDir & "\launchpad" if not FileExists($appdatauser) then DirCreate($appdatauser) if not FileExists(@scriptdir & "\Assets") then DirCreate(@scriptdir & "\Assets") $search = FileFindFirstFile($dll_icones) if $search = -1 Then FileInstall(".\Assets\iconset.dll", @ScriptDir & "\Assets\iconset.dll",1) EndIf #cs The following 2D array contains the settings that determine the behavior of each "Button" namely 4 parameters for each row (for each button); [n][0] the tooltip of the button [n][1] path of an icon or a file containing icons [n][2] the number of the icon (if the previous parameter is a collection) [n][3] AutoIt command(s) to be executed directly on button click (or also the name of a function) #ce Global const $aStartTools[][] = [ _ ; this arrays could be used as first links in the app ['Settings', 'SHELL32.dll', 177, 'run("explorer.exe shell:::{D20EA4E1-3957-11d2-A40B-0C5020524153}")','bouton1'], _ ; 'Test()'], _ ; call a function 'Test()' ['Windows version', 'winver.exe', 1, 'run("explorer.exe shell:::{BB06C0E4-D293-4f75-8A90-CB05B6477EEE}")','bouton2'], _ ; or "Run('winver.exe')" ['This computer', 'netcenter.dll', 6, 'run("explorer.exe shell:::{20D04FE0-3AEA-1069-A2D8-08002B30309D}")','bouton3'], _ ['Devices and Printers', 'SHELL32.dll', 272, 'run("explorer.exe shell:::{A8A91A66-3A7D-4424-8D24-04E180695C7A}")','bouton4'], _ ['Folder options', 'SHELL32.dll', 210, 'run("explorer.exe shell:::{6DFD7C5C-2451-11d3-A299-00C04F8EF6AF}")','bouton5'], _ ['Command Prompt', @ComSpec, 1, 'Run(@ComSpec)','bouton6'], _ ['Internet Explorer', @ProgramFilesDir & '\Internet Explorer\iexplore.exe', 1, "Run(@ProgramFilesDir & '\Internet Explorer\iexplore.exe')",'bouton7'], _ ['Media Player', @ProgramFilesDir & '\Windows media player\wmplayer.exe', 1, "Run(@ProgramFilesDir & '\Windows media player\wmplayer.exe')",'bouton8'], _ ['File browser', @WindowsDir & '\explorer.exe', 1, "Run(@WindowsDir & '\explorer.exe')",'bouton9'], _ ['Notepad', @SystemDir & '\notepad.exe', 1, "Run(@SystemDir & '\notepad.exe')",'bouton10'], _ ['Wordpad', @SystemDir & '\write.exe', 1, "Run(@SystemDir & '\write.exe')",'bouton11'], _ ['Registry editor', @SystemDir & '\regedit.exe', 1, "ShellExecute('regedit.exe')",'bouton12'], _ ['Connect to', 'netcenter.dll', 19, 'run("explorer.exe shell:::{38A98528-6CBF-4CA9-8DC0-B1E1D10F7B1B}")','bouton13'], _ ['Calculator', @SystemDir & '\Calc.exe', 1, "Run(@SystemDir & '\calc.exe')",'bouton14'], _ ['Control panel', 'control.exe', 1, 'run("explorer.exe shell:::{5399E694-6CE5-4D6C-8FCE-1D8870FDCBA0}")','bouton15'], _ ['Users manager', @SystemDir & '\Netplwiz.exe', 1, "ShellExecute('Netplwiz.exe')",'bouton16'], _ ; {7A9D77BD-5403-11d2-8785-2E0420524153} ['Run', 'SHELL32.dll', 25, 'Run("explorer.exe Shell:::{2559a1f3-21d7-11d4-bdaf-00c04f60b9f0}")','bouton17'], _ ['Search files', 'SHELL32.dll', 135, 'run("explorer.exe shell:::{9343812e-1c37-4a49-a12e-4b2d810d956b}")','bouton18'], _ ['On screen Magnifier', @SystemDir & '\Magnify.exe', 1, "ShellExecute('Magnify.exe')",'bouton19'], _ ['Paint', @SystemDir & '\mspaint.exe', 1, "Run(@SystemDir & '\mspaint.exe')",'bouton20'], _ ['Remote desktop', @SystemDir & '\mstsc.exe', 1, " Run('mstsc.exe')",'bouton21'], _ ['Resource monitoring', @SystemDir & '\resmon.exe', 1, "Run('resmon.exe')",'bouton22'], _ ['Device manager', 'SHELL32.dll', 13, 'Run("explorer.exe Shell:::{74246bfc-4c96-11d0-abef-0020af6b0b7a}")','bouton23'], _ ['Audio', 'SndVol.exe', 1, 'Run("explorer.exe Shell:::{F2DDFC82-8F12-4CDD-B7DC-D4FE1425AA4D}")','bouton24'], _ ; or 'run(@SystemDir & "\SndVol.exe")'] ['Task view', 'SHELL32.dll', 133, 'Run("explorer.exe shell:::{3080F90E-D7AD-11D9-BD98-0000947B0257}")','bouton25'], _ ['Task Manager', @SystemDir & '\taskmgr.exe', 1, 'Send("^+{ESC}")''bouton26'], _ ; "Run(@SystemDir & '\taskmgr.exe')",'bouton1'], _ ['On Screen Keyboard', 'osk.exe', 1, 'ProcessExists("osc.exe") ? False : ShellExecute("osk.exe")','bouton27'], _ ; <-- ternary example ['God Mode','control.exe', 1,'Run("explorer.exe Shell:::{ED7BA470-8E54-465E-825C-99712043E01C}")','bouton28'] _ ] ;#ce ;_arraydisplay($aStartTools) Global $fileConfig = $appdatauser & "\config.ini" if not FileExists($fileConfig) Then $file = FileOpen($fileConfig,1) IniWriteSection($fileConfig,"Position","Left=" & @CR & "top=" & @cr & "lignes="& @cr & "colones=") IniWriteSection($fileConfig,"COLOR","color=") FileClose($file) Else $apos[0] = IniRead($fileconfig,"Position","left",0) $apos[1] = iniread($fileconfig,"Position","top",0) $apos[2] = iniread($fileconfig,"Position","lignes",16) $apos[3] = iniread($fileconfig,"Position","colones",2) EndIf ;------------------------- recherche d'un fichier de lien------------------------------- Global $filelink = $appdatauser & "\launchpad.link" Global $aTools ; declaration of the array used by the application for all the links ;------------------------- recherche d'un fichier de lien------------------------------- local $nb_section local $ini = $filelink ; Lecture du fichier ini qui contient les raccourcis $sections = IniReadSectionNames($ini) ; lecture de toutes les sections du fichier ini (.link) if @error <> 0 then $nb_section = 0 if $nb_section == 0 Then ;consolewrite($nb_section & @CRLF) for $i = 1 to 40 iniwritesection($ini, "bouton" & $i,"label=Libre" & @CR& "link=" & @CR & "icone=" & @crlf) Next ;Sleep(1000) For $i = 0 to UBound($aStartTools) -1 iniwrite($ini,$aStartTools[$i][4] ,"label", $aStartTools[$i][0]) iniwrite($ini,$aStartTools[$i][4] ,"link", $aStartTools[$i][3]) iniwrite($ini,$aStartTools[$i][4] ,"icone", $aStartTools[$i][1] & ","& $aStartTools[$i][2]) Next $sections = IniReadSectionNames($ini) EndIf if IsArray($sections) then $nb_section = $sections[0] if $nb_section < 40 Then fileopen($ini,1) for $i = $nb_section + 1 to 40 iniwritesection($ini, "bouton" & $i,"label=Libre" & @CR& "link=" & @CR & "icone=" & @crlf) Next FileClose($ini) $sections = IniReadSectionNames($ini) EndIf $nb = $sections[0] ; tableau de toutes les sections Local $res[$nb+1][5] ; création d'un tableau qui va contenir l'ensemble des liens For $i = 1 to $nb ; remplissage du tableau $res ;$res[$i][0] = $sections[$i] ;consolewrite (@CRLF & $i & @TAB & IniRead($ini,$sections[$i],"label","erreur")) $res[$i-1][0] = IniRead($ini,$sections[$i],"label","erreur") ; lecture du fichier et remplissage des ruches du tableau $fichier_icone = stringsplit(IniRead($ini,$sections[$i],"icone","erreur"),",") if $fichier_icone[0] > 1 Then ;_ArrayDisplay($fichier_icone) $res[$i-1][1] = $fichier_icone[1] $res[$i-1][2] = $fichier_icone[2] Else $res[$i-1][1] = IniRead($ini,$sections[$i],"icone","erreur") EndIf $res[$i-1][3] = IniRead($ini,$sections[$i],"link","erreur") $res[$i-1][4] = $sections[$i] Next $aTools = $res ; Show desktop {3080F90D-D7AD-11D9-BD98-0000947B0257} ; Desktop Background {ED834ED6-4B5A-4bfe-8F11-A626DCB6A921} ; IE internet option {A3DD4F92-658A-410F-84FD-6FBBBEF2FFFE} ; ['Notes', 'StikyNot.exe', 1, "ShellExecute('StikyNot')"], _ ; ['... if Notepad is running' & @CRLF & 'Send F5 to it', 'SHELL32.dll', 167, ' WinExists("[CLASS:Notepad]") ? ControlSend("[CLASS:Notepad]", "", "", "{F5}") : MsgBox(16, ":(", "Notepad not found", 2)'] _ ; Check if Notepad is currently running ;_ArrayDisplay($aTools) Opt("TrayMenuMode", 3) Global $iStep = 40 ; button size Global $iNrPerLine if $apos[3] = "" Then $iNrPerLine = 2 Else $iNrPerLine = $apos[3] EndIf Global $iNrOfLines if $apos[2] = "" then $iNrOfLines = 20;Ceiling(UBound($aTools) / $iNrPerLine) Else $iNrOfLines = $aPos[2] EndIf if $apos[0] = "" then $apos[0] = @DesktopWidth - $iStep * 3 if $apos[1] = "" then $apos[1] = @DesktopHeight / 20 Global $GUI = GUICreate('LaunchPad', 10, 10, $apos[0] , $apos[1] ,$WS_THICKFRAME + $WS_EX_ACCEPTFILES, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST)) GUICtrlSetBkColor(-1,0xFFFFFF) $GuiContextMenu = GUICtrlCreateContextMenu() $idSavePosition = GUICtrlCreateMenuItem("Sauver la position", $GuiContextMenu) $idReinitializePosition = GUICtrlCreateMenuItem("Reinitialiser la position", $GuiContextMenu) GUICtrlCreateMenuItem("", $GuiContextMenu) $idReinstallLinkFile = GUICtrlCreateMenuItem("Reinitialisation complete", $GuiContextMenu) $idFixWindows = GUICtrlCreateMenuItem("Figer", $GuiContextMenu) Global $aMyMatrix = _GuiControlPanel("Button", $iNrPerLine, $iNrOfLines, $iStep, $iStep, BitOR(0x40, 0x1000), -1, 0, 0, 0, 0, 0, 0, False, "") ;_ArrayDisplay($idNewsubmenu) Global $iPreviousX = ($aMyMatrix[0])[1], $iPreviousY = ($aMyMatrix[0])[2] For $i = 1 To UBound($aMyMatrix)-1 GUICtrlSetResizing($aMyMatrix[$i], $GUI_DOCKALL) ; (2+32+256+512) so the control will not move during resizing If $i <= UBound($aTools) Then If $aTools[$i-1][$vButton_IconPath] = "" Then GUICtrlSetImage($aMyMatrix[$i], $dll_icones,80) GUICtrlSetTip(-1,"Glisser/déposer de (fichier/dossier/raccourcis) pour créer un nouveau lien") Else GUICtrlSetImage($aMyMatrix[$i], $aTools[$i-1 ][$vButton_IconPath], $aTools[$i-1 ][$vButton_IconNumber]) GUICtrlSetTip($aMyMatrix[$i], $aTools[$i -1][$vButton_Command],$aTools[$i-1 ][$vButton_Tip] ) EndIf EndIf Next _WinSetClientSize($GUI, ($aMyMatrix[0])[11], ($aMyMatrix[0])[12]) ; thanks to KaFu DragDropEvent_Startup() ;GUISetState(@SW_SHOW, $GUI) ;GUISetState(@SW_SHOW, $GuiIcon) ; https://devblogs.microsoft.com/oldnewthing/20110218-00/?p=11453 GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") GUIRegisterMsg($WM_SIZING, "WM_SIZING") GUIRegisterMsg($WM_NOTIFY, WM_NOTIFY) TrayCreateItem("LAUNCHPAD") TrayCreateItem("") ; Create a separator line. Global $idHide = TrayCreateItem("Hide") Global $idShow = TrayCreateItem("Show") TrayCreateItem("") ; Create a separator line. Global $idExit = TrayCreateItem("Exit") Global $idPos = TrayCreateItem("Save windows Position") Global $idDfault = TrayCreateItem("Reinitialiser la position") Global $idOpenFileLink = TrayCreateItem("ouvrir le dossier des liens") TraySetState($TRAY_ICONSTATE_SHOW) _MainLoop() Func _MainLoop() Local $iDeltaX, $iDeltaY, $row, $col, $left, $top Global $hTimer = TimerInit() Local $aPos DragDropEvent_Register($GUI) GUIRegisterMsg($WM_DRAGENTER, "OnDragDrop") GUIRegisterMsg($WM_DRAGOVER, "OnDragDrop") GUIRegisterMsg($WM_DRAGLEAVE, "OnDragDrop") GUIRegisterMsg($WM_DROP, "OnDragDrop") While 1 Sleep (10) If _MouseIsOverHWnd($GUI) == false and _IsPressed(01) and $fixwindows = False then GUISetState(@SW_HIDE, $GUI) $hTimer = 0 EndIf If TimerDiff($hTimer) > 5000 and _MouseIsOverHWnd($GUI) == False and $fixwindows = False Then GUISetState(@SW_HIDE, $GUI) $hTimer = 0 EndIf $aCursor = GUIGetCursorInfo($GUI) $aPos = MouseGetPos () If $aPos[0] = 0 Or $aPos[1] = 0 Or $aPos[0] = @DesktopWidth-1 Or $aPos[1] = @DesktopHeight-1 Then $hTimer = TimerInit () EndIf While $aPos[0] = 0 Or $aPos[1] = 0 Or $aPos[0] = @DesktopWidth-1 Or $aPos[1] = @DesktopHeight-1 and not _IsPressed(01); The GUI appears when the mouse touch the screen borders for 1500 ms $aPos = MouseGetPos() if TimerDiff($hTimer) > 1000 then GUISetState(@SW_SHOW, $GUI) $hTimer = TimerInit() ExitLoop EndIf sleep(1) WEnd ;_______________________ ; If TimerDiff($hTimer) > 5000 Then ; GUISetState(@SW_HIDE, $GUI) ; $hTimer = 0 ; EndIf ; $aPos = MouseGetPos () ; If $aPos[0] = 0 Or $aPos[1] = 0 Or $aPos[0] = @DesktopWidth-1 Or $aPos[1] = @DesktopHeight-1 Then ; $hTimer = TimerInit () ; GUISetState(@SW_SHOW, $GUI) ; EndIf $Msg = GUIGetMsg() for $i = 0 to ubound($idNewsubmenu)-1 if $Msg = $idNewsubmenu[$i] and $aTools[$i][3] <> "" Then $sMsg = Msgbox(4,"","Etes vous sur de vouloir supprimer ce raccourcis ?") if $sMsg == 6 Then iniwrite($filelink,$aTools[$i][4],"label","Libre") iniwrite($filelink,$aTools[$i][4],"link","") iniwrite($filelink,$aTools[$i][4],"icone","") $atools[$i][0] = "Libre" $atools[$i][1] = "" $atools[$i][2] = "" $atools[$i][3] = "" GUICtrlSetImage($aMyMatrix[$i+1], $dll_icones,80) ToolTip("") EndIf EndIf Next For $i = 0 to ubound($idChangeIcon) - 1 If $Msg = $idChangeIcon[$i] and $atools[$i][3] <> "" Then $aRet = _PickIconDlg($dll_icones) If Not @error Then $aTools[$i][1] = $aRet[0] $aTools[$i][2] = $aRet[1] IniWrite($filelink,$aTools[$i][4],"icone",$aRet[0] & "," & $aRet[1]) GUICtrlSetImage($aMyMatrix[$i+1], $aTools[$i][1], $aTools[$i][2]) EndIf EndIf Next Switch $Msg Case $GUI_EVENT_CLOSE GUISetState(@SW_HIDE) $hTimer = 0 Case $aMyMatrix[1] To $aMyMatrix[40] $hTimer = TimerInit () For $i = 1 To UBound($aMyMatrix) - 1 If $Msg = $aMyMatrix[$i] Then If $i <= UBound($aTools) and $aTools[$i-1][3] <> "" Then if StringInStr($atools[$i-1][3],"run(") then $dummy = Execute($aTools[$i - 1][3]) Else $dummy = ShellExecute($aTools[$i - 1][3]) EndIf EndIf EndIf Next case $idSavePosition $apos = WinGetPos($gui) iniwrite($fileConfig,"Position","left",$apos[0]) iniwrite($fileConfig,"Position","top",$apos[1]) IniWrite($fileconfig,"Position","lignes",($aMyMatrix[0])[2]) IniWrite($fileconfig,"Position","colones",($aMyMatrix[0])[1]) msgbox(0,"","Position sauvegardée avec succès",3) Case $idReinitializePosition iniwrite($fileconfig,"position","left","") iniwrite($fileConfig,"Position","top","") IniWrite($fileconfig,"Position","lignes","") IniWrite($fileconfig,"Position","colones","") _RestartProgram() Case $idReinstallLinkFile local $sMsg = Msgbox(4,"","Etes vous certain de vouloir reinitialiser tous les liens ?") if $sMsg == 6 Then FileDelete($filelink) _RestartProgram() EndIf Case $idFixWindows if $fixwindows = False Then $fixwindows = True GUICtrlSetState($msg, $GUI_CHECKED + $GUI_UNCHECKED - BitAND(GUICtrlRead($msg), $GUI_UNCHECKED) - BitAND(GUICtrlRead($msg), $GUI_CHECKED)) Else $fixwindows = False GUICtrlSetState($msg, $GUI_CHECKED + $GUI_UNCHECKED - BitAND(GUICtrlRead($msg), $GUI_CHECKED) - BitAND(GUICtrlRead($msg), $GUI_UNCHECKED)) EndIf EndSwitch Switch TrayGetMsg() Case $idShow $hTimer = TimerInit () GUISetState(@SW_SHOW) Case $idHide GUISetState(@SW_HIDE) $hTimer = 0 Case $idExit ExitLoop Case $idPos $apos = WinGetPos($gui) iniwrite($fileConfig,"Position","left",$apos[0]) iniwrite($fileConfig,"Position","top",$apos[1]) IniWrite($fileconfig,"Position","lignes",($aMyMatrix[0])[2]) IniWrite($fileconfig,"Position","colones",($aMyMatrix[0])[1]) case $idDfault iniwrite($fileconfig,"position","left","") iniwrite($fileConfig,"Position","top","") IniWrite($fileconfig,"Position","lignes","") IniWrite($fileconfig,"Position","colones","") _RestartProgram() Case $idOpenFileLink ShellExecute(@AppDataDir & "\Launchpad") EndSwitch ; check if any size has changed If $iPreviousX <> ($aMyMatrix[0])[1] Or $iPreviousY <> ($aMyMatrix[0])[2] Then ; calculate the variations $iDeltaX = Abs($iPreviousX - ($aMyMatrix[0])[1]) $iDeltaY = Abs($iPreviousY - ($aMyMatrix[0])[2]) ; if both dimensions changed at the same time, the largest variation prevails over the other If $iDeltaX >= $iDeltaY Then ; keep the new number of columns ; calculate and set the correct number of lines accordingly _SubArraySet($aMyMatrix[0], 2, Ceiling((UBound($aMyMatrix) - 1) / ($aMyMatrix[0])[1])) Else ; otherwise keep the new number of rows ; calculate and set the correct number of columns accordingly _SubArraySet($aMyMatrix[0], 1, Ceiling((UBound($aMyMatrix) - 1) / ($aMyMatrix[0])[2])) EndIf ; set client area new sizes _WinSetClientSize($GUI, ($aMyMatrix[0])[1] * $iStep, ($aMyMatrix[0])[2] * $iStep) ; remember the new panel settings $iPreviousX = ($aMyMatrix[0])[1] $iPreviousY = ($aMyMatrix[0])[2] ; rearrange the controls inside the panel For $i = 0 To UBound($aMyMatrix) - 2 ; coordinates 1 based $col = Mod($i, $iPreviousX) + 1 ; Horizontal position within the grid (column) $row = Int($i / $iPreviousX) + 1 ; Vertical position within the grid (row number) $left = ($aMyMatrix[0])[5] + (((($aMyMatrix[0])[3] + ($aMyMatrix[0])[9]) * $col) - ($aMyMatrix[0])[9]) - ($aMyMatrix[0])[3] + ($aMyMatrix[0])[7] $top = ($aMyMatrix[0])[6] + (((($aMyMatrix[0])[4] + ($aMyMatrix[0])[10]) * $row) - ($aMyMatrix[0])[10]) - ($aMyMatrix[0])[4] + ($aMyMatrix[0])[8] GUICtrlSetPos($aMyMatrix[$i + 1], $left, $top) Next EndIf WEnd EndFunc ;==>_MainLoop Func _MouseIsOverHWnd($hWnd) ;to check if mouse is on or off GUI Local $bMouseOver If not WinActive($hWnd) then return False Local $aMousePos = MouseGetPos() Local $aWinPos = WinGetPos($hWnd) if ($aMousePos[0] < $aWinPos[0] Or $aMousePos[0] > $aWinPos[0] + $aWinPos[2]) Or ($aMousePos[1] < $aWinPos[1] Or $aMousePos[1] > $aWinPos[1] + $aWinPos[3]) Then $bMouseOver = False Else $bMouseOver = True EndIf Return $bMouseOver EndFunc ;==>_MouseIsOverHWnd Func WM_NOTIFY ($hwnd, $iMsg, $iwParam, $ilParam) If $hwnd = $GUI Then $hTimer = TimerInit () Return $GUI_RUNDEFMSG EndFunc ; Allow/Disallow specific borders resizing ; thanks to Danyfirex ; --------- ; https://www.autoitscript.com/forum/topic/201464-partially-resizable-window-how-solved-by-danyfirex-%F0%9F%91%8D/?do=findComment&comment=1445748 Func WM_NCHITTEST($hwnd, $iMsg, $iwParam, $ilParam) If $hwnd = $GUI Then $hTimer = TimerInit() Local $iRet = _WinAPI_DefWindowProc($hwnd, $iMsg, $iwParam, $ilParam) ; https://docs.microsoft.com/en-us/windows/win32/inputdev/wm-nchittest If $iRet = $HTBOTTOM Or $iRet = $HTRIGHT Or $iRet = $HTBOTTOMRIGHT Or $iRet = $HTCAPTION Or $iRet = $HTCLOSE Then Return $iRet ; default process of border resizing Else ; resizing not allowed Return $HTCLIENT ; do like if cursor is in the client area EndIf EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_NCHITTEST ; controls and process resizing operations in real time ; thanks to mikell ; ------ ; https://www.autoitscript.com/forum/topic/201464-partially-resizable-window-how-solved-by-danyfirex-%F0%9F%91%8D/?do=findComment&comment=1445754 Func WM_SIZING($hwnd, $iMsg, $wparam, $lparam) ; https://docs.microsoft.com/en-us/windows/win32/winmsg/wm-sizing Local $iCols = ($aMyMatrix[0])[1] Local $iRows = ($aMyMatrix[0])[2] Local $xClientSizeNew, $yClientSizeNew #cs $wparam The edge of the window that is being sized. $lparam A pointer to a RECT structure with the screen coordinates of the drag rectangle. To change the size or position of the drag rectangle, an application must change the members of this structure. Return value Type: LRESULT #ce $wparam $aPos = WinGetPos($GUI) #cs Success : a 4 - element array containing the following information : $aArray[0] = X position $aArray[1] = Y position $aArray[2] = Width #ce Success : a 4 - element array containing the following information : $aPos2 = WinGetClientSize($GUI) #cs Success: a 2-element array containing the following information: $aArray[0] = Width of window's client area #ce Success: a 2-element array containing the following information: ; https://docs.microsoft.com/en-us/previous-versions//dd162897(v=vs.85) Local $sRect = DllStructCreate("Int[4]", $lparam) ; outer dimensions (includes borders) Local $left = DllStructGetData($sRect, 1, 1) Local $top = DllStructGetData($sRect, 1, 2) Local $Right = DllStructGetData($sRect, 1, 3) Local $bottom = DllStructGetData($sRect, 1, 4) ; border width Local $iEdgeWidth = ($aPos[2] - $aPos2[0]) / 2 Local $iHeadHeigth = $aPos[3] - $aPos2[1] - $iEdgeWidth * 2 Local $aEdges[2] $aEdges[0] = $aPos[2] - $aPos2[0] ; x $aEdges[1] = $aPos[3] - $aPos2[1] ; y $xClientSizeNew = $Right - $left - $aEdges[0] $xClientSizeNew = Round($xClientSizeNew / $iStep) * $iStep $yClientSizeNew = $bottom - $top - $aEdges[1] $yClientSizeNew = Round($yClientSizeNew / $iStep) * $iStep Switch $wparam Case $WMSZ_RIGHT ; calculate the new position of the right border DllStructSetData($sRect, 1, $left + $xClientSizeNew + $aEdges[0], 3) Case $WMSZ_BOTTOM ; calculate the new position of the bottom border DllStructSetData($sRect, 1, $top + $yClientSizeNew + $aEdges[1], 4) Case $WMSZ_BOTTOMRIGHT ; calculate the new position of both borders DllStructSetData($sRect, 1, $left + $xClientSizeNew + $aEdges[0], 3) DllStructSetData($sRect, 1, $top + $yClientSizeNew + $aEdges[1], 4) EndSwitch #cs If DllStructGetData($sRect, 1, 3) > @DesktopWidth Then ; $Right DllStructSetData($sRect, 1, DllStructGetData($sRect, 1, 3) - $iStep, 3) $xClientSizeNew -= $iStep EndIf If DllStructGetData($sRect, 1, 4) > @DesktopHeight Then ; $bottom DllStructSetData($sRect, 1, DllStructGetData($sRect, 1, 4), 4) $yClientSizeNew -= $iStep #ce If DllStructGetData($sRect, 1, 3) > @DesktopWidth Then ; $Right ; check if number of rows has changed If $iRows <> $yClientSizeNew / $iStep Then _SubArraySet($aMyMatrix[0], 2, $yClientSizeNew / $iStep) EndIf ; check if number of columns has changed If $iCols <> $xClientSizeNew / $iStep Then _SubArraySet($aMyMatrix[0], 1, $xClientSizeNew / $iStep) EndIf ;consolewrite(@crlf & "rows =" & @tab & $iRows & @tab & "Col =" & @TAB & $iCols & @tab & "$xClientSizeNew = " & @tab & $xClientSizeNew & @tab & "$yClientSizeNew =" & @tab & $yClientSizeNew ) Return $GUI_RUNDEFMSG EndFunc ;==>WM_SIZING ; set client area new sizes ; thanks to KaFu ; ---- ; https://www.autoitscript.com/forum/topic/201524-guicreate-and-wingetclientsize-mismatch/?do=findComment&comment=1446141 Func _WinSetClientSize($hwnd, $iW, $iH) Local $aWinPos = WinGetPos($hwnd) Local $sRect = DllStructCreate("int;int;int;int;") DllStructSetData($sRect, 3, $iW) DllStructSetData($sRect, 4, $iH) _WinAPI_AdjustWindowRectEx($sRect, _WinAPI_GetWindowLong($hwnd, $GWL_STYLE), _WinAPI_GetWindowLong($hwnd, $GWL_EXSTYLE)) WinMove($hwnd, "", $aWinPos[0], $aWinPos[1], $aWinPos[2] + (DllStructGetData($sRect, 3) - $aWinPos[2]) - DllStructGetData($sRect, 1), $aWinPos[3] + (DllStructGetData($sRect, 4) - $aWinPos[3]) - DllStructGetData($sRect, 2)) EndFunc ;==>_WinSetClientSize ; ; #FUNCTION# ==================================================================================================================== ; Name...........: _GuiControlPanel ; Description ...: Creates a rectangular panel with adequate size to contain the required amount of controls ; and then fills it with the same controls by placing them according to the parameters ; Syntax.........: _GuiControlPanel($ControlType, $nrPerLine, $nrOfLines, $ctrlWidth, $ctrlHeight, $style, $exStyle, $xPos = 0, $yPos = 0, $xBorder, $yBorder, $xSpace = 1, $ySpace = 1, $Group = false, , $sGrpTitle = "") ; Parameters ....: $ControlType - Type of controls to be generated ("Button"; "Text"; ..... ; $nrPerLine - Nr. of controls per line in the matrix ; $nrOfLines - Nr. of lines in the matrix ; $ctrlWidth - Width of each control ; $ctrlHeight - Height of each control ; $Style - Defines the style of the control ; $exStyle - Defines the extended style of the control ; $xPanelPos - x Position of panel in GUI ; $yPanelPos - y Position of panel in GUI ; $xBorder - distance from lateral panel's borders to the matrix (width of left and right margin) default = 0 ; $yBorder - distance from upper and lower panel's borders to the matrix (width of upper and lower margin) default = 0 ; $xSpace - horizontal distance between the controls ; $ySpace - vertical distance between the controls ; $Group - if you want to group the controls (true or false) ; $sGrpTitle - title of the group (ignored if above is false) ; Return values .: an 1 based 1d array containing references to each control ; element [0] contains an 1d array containing various parameters about the panel ; Author ........: Gianni Addiego (Chimp) ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: ; =============================================================================================================================== Func _GuiControlPanel($ControlType, $nrPerLine, $nrOfLines, $ctrlWidth, $ctrlHeight, $style = -1, $exStyle = -1, $xPanelPos = 0, $yPanelPos = 0, $xBorder = 0, $yBorder = 0, $xSpace = 1, $ySpace = 1, $Group = False, $sGrpTitle = "") Local Static $sAllowedControls = "|Label|Input|Edit|Button|CheckBox|Radio|List|Combo|Pic|Icon|Graphic|" If Not StringInStr($sAllowedControls, '|' & $ControlType & '|') Then Return SetError(1, 0, "Unkown control") Local $PanelWidth = (($ctrlWidth + $xSpace) * $nrPerLine) - $xSpace + ($xBorder * 2) Local $PanelHeight = (($ctrlHeight + $ySpace) * $nrOfLines) - $ySpace + ($yBorder * 2) Local $hGroup If $Group Then If $sGrpTitle = "" Then $xPanelPos += 1 $yPanelPos += 1 $hGroup = GUICtrlCreateGroup("", $xPanelPos - 1, $yPanelPos - 7, $PanelWidth + 2, $PanelHeight + 8) GUICtrlSetColor(-1, 0xFFFFFF) Else $xPanelPos += 1 $yPanelPos += 15 $hGroup = GUICtrlCreateGroup($sGrpTitle, $xPanelPos - 1, $yPanelPos - 15, $PanelWidth + 2, $PanelHeight + 16) GUICtrlSetColor(-1, 0xFFFFFF) EndIf EndIf ; create the controls Local $aGuiGridCtrls[$nrPerLine * $nrOfLines + 1] Local $aPanelParams[14] = [ _ $ControlType, $nrPerLine, $nrOfLines, $ctrlWidth, $ctrlHeight, _ $xPanelPos, $yPanelPos, $xBorder, $yBorder, $xSpace, $ySpace, $PanelWidth, $PanelHeight, $hGroup] For $i = 0 To $nrPerLine * $nrOfLines - 1 ; coordinates 1 based $col = Mod($i, $nrPerLine) + 1 ; Horizontal position within the grid (column) $row = Int($i / $nrPerLine) + 1 ; Vertical position within the grid (row) $left = $xPanelPos + ((($ctrlWidth + $xSpace) * $col) - $xSpace) - $ctrlWidth + $xBorder $top = $yPanelPos + ((($ctrlHeight + $ySpace) * $row) - $ySpace) - $ctrlHeight + $yBorder $text = $i + 1 ; "*" ; "." ; "(*)" ; create the control(s) if $i >= ubound($aTools)-1 Then ExitLoop Else $aGuiGridCtrls[$i + 1] = Execute("GUICtrlCreate" & $ControlType & "($text, $left, $top, $ctrlWidth, $ctrlHeight, $style, $exStyle)") ;Global $g_tile_notif = GUICtrlCreateDummy() $idContextmenu = GUICtrlCreateContextMenu($aGuiGridCtrls[$i + 1]) $idNewsubmenu[$i] = GUICtrlCreateMenuItem("Supprimer", $idContextmenu) $idChangeIcon[$i] = GUICtrlCreateMenuItem("Changer Icone", $idContextmenu) if $aTools[$i][1] = "" then ;GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT) ;WinSetTrans(-1,Default,100) EndIf EndIf Next If $Group Then GUICtrlCreateGroup("", -99, -99, 1, 1) ; close group $aGuiGridCtrls[0] = $aPanelParams Return $aGuiGridCtrls EndFunc ;==>_GuiControlPanel ; writes a value to an element of an array embedded in another array Func _SubArraySet(ByRef $aSubArray, $iElement, $vValue) $aSubArray[$iElement] = $vValue EndFunc ;==>_SubArraySet ;Func _WinAPI_AdjustWindowRectEx(ByRef $tRECT, $iStyle, $iExStyle = 0, $bMenu = False) ; Local $aRet = DllCall('user32.dll', 'bool', 'AdjustWindowRectEx', 'struct*', $tRECT, 'dword', $iStyle, 'bool', $bMenu, _ ; 'dword', $iExStyle) ; If @error Then Return SetError(@error, @extended, False) ; ; If Not $aRet[0] Then Return SetError(1000, 0, 0) ; ; Return $aRet[0] ;EndFunc ;==>_WinAPI_AdjustWindowRectEx Func OnDragDrop($hWnd, $Msg, $wParam, $lParam) ;consolewrite($hWnd & @tab & $Msg & @crlf) Static $DropAccept Switch $Msg Case $WM_DRAGENTER, $WM_DROP ToolTip("") Select Case DragDropEvent_IsFile($wParam) If $Msg = $WM_DROP Then Position() ; needed for _WinAPI_WindowFromPoint Local $mouseId = _WinAPI_WindowFromPoint($g_tStruct) ; Find de hwnd of the control because GUIGetCursorInfo doesn't work with text file $mouseId = _WinAPI_GetDlgCtrlID($mouseId) ; gets the Id of hwnd Local $FileList = DragDropEvent_GetFile($wParam) consolewrite(@CRLF & $FileList) Local $section , $latools Local $aDetails = FileGetShortcut($FileList) if IsArray($aDetails) Then $Program = $aDetails[0] EndIf Local $ProposeLink = stringsplit($FileList,"\") $ProposeLink = StringRegExpReplace($ProposeLink[UBound($ProposeLink)-1], '(.*)\..*', "$1") For $i = 1 To UBound($aMyMatrix) - 1 If $mouseId = $aMyMatrix[$i] and $aTools[$i - 1][3] = "" Then $section = $aTools[$i -1][4] $latools = $i - 1 consolewrite(@crlf & $section & @TAB & $fileList) iniwrite($filelink,$section,"link",$FileList) ExitLoop Elseif $mouseId = $aMyMatrix[$i] and $aTools[$i -1][3] <> "" Then $section = $aTools[$i -1][4] $latools = $i -1 Local $question = msgbox(4,"", "Etes vous certain de vouloir écraser le raccourcis existant ?") if $question == 6 then consolewrite(@crlf & $section & @TAB & $filelist) iniwrite($filelink,$section,"link",$FileList) else Return EndIf ExitLoop EndIf Next Local $reponse = InputBox("Nom de l'icone","Donnez un titre au raccourcis",$ProposeLink); quel label aura le raccourcis if @error == 1 or $reponse = "" Then iniwrite($filelink,$section,"link","") Iniwrite($filelink,$section,"label","") Return EndIf Iniwrite($filelink,$section,"label",$reponse); tout est ok on peut ecrire la valeur dans le fichier de config local $sExt = StringRegExpReplace($FileList, "^.*\.", "") ; extraction de son extension Switch $sExt case "doc" , "docx" , "odt" IniWrite($filelink,$section,"icone",$dll_icones &",436") case "xls" , "xlsx" , "ods" IniWrite($filelink,$section,"icone",$dll_icones &",441") case "pdf" IniWrite($filelink,$section,"icone",$dll_icones &",400") Case "ppt" , "pptx" , "odp" IniWrite($filelink,$section,"icone",$dll_icones &",431") Case "txt" , "rtf" IniWrite($filelink,$section,"icone",$dll_icones &",406") Case Else if $sExt = "lnk" then $FileList = $Program if _WinAPI_ExtractIconEx( $FileList,-1,0,0,0) > 0 Then ; permet de tester si le fichier possède une ou plusiers icone(s) Local $aIcon[3] = [64, 32, 16] For $i = 0 To UBound($aIcon) - 1 $aIcon[$i] = _WinAPI_Create32BitHICON(_WinAPI_ShellExtractIcon($FileList,0, $aIcon[$i], $aIcon[$i]), 1) Next _WinAPI_SaveHICONToFile(@ScriptDir & "\Assets\" & $reponse & ".ico", $aIcon) For $i = 0 To UBound($aIcon) - 1 _WinAPI_DestroyIcon($aIcon[$i]) Next IniWrite($filelink,$section,"icone",@ScriptDir & "\Assets\" & $reponse & ".ico"); si oui écriture dans le fichier Else $aRet = _PickIconDlg($dll_icones) If Not @error Then IniWrite($filelink,$section,"icone",$aRet[0] & "," & $aRet[1]) Else iniwrite($filelink,$section,"link","") Iniwrite($filelink,$section,"label","") Return EndIf EndIf EndSwitch $fichier_icone = stringsplit(IniRead($filelink,$aTools[$latools][4],"icone","erreur"),",") if $fichier_icone[0] > 1 Then $aTools[$latools][1] = $fichier_icone[1] $aTools[$latools][2] = $fichier_icone[2] Else $aTools[$latools][1] = IniRead($filelink,$aTools[$latools][4],"icone","erreur") $aTools[$latools][2] = "," & Number("0") EndIf $aTools[$latools][0] = $reponse $aTools[$latools][3] = IniRead($filelink,$section,"link","erreur") for $i = 0 to 4 consolewrite (@CRLF & "colone " & $i & @TAB & $aTools[$latools][$i]) Next ;GUICtrlSetBkColor($mouseId,$GUI_BKCOLOR_TRANSPARENT) GUICtrlSetImage($mouseId, $aTools[$latools][1], $aTools[$latools][2]) GUICtrlSetTip($mouseId, $aTools[$latools][3],$aTools[$latools][0]) EndIf $DropAccept = $DROPEFFECT_COPY Case DragDropEvent_IsText($wParam) If $Msg = $WM_DROP Then Position() ; needed for _WinAPI_WindowFromPoint to get the right hwnd Local $mouseId = _WinAPI_WindowFromPoint($g_tStruct) ; Find de hwnd of the control because GUIGetCursorInfo doesn't work $mouseId = _WinAPI_GetDlgCtrlID($mouseId) ; gets the Id of hwnd $hyperlink = DragDropEvent_GetText($wParam) Local $section , $latools For $i = 1 To UBound($aMyMatrix) - 1 ;consolewrite($i & " " ) If $mouseId = $aMyMatrix[$i] and $aTools[$i-1][3] = "" Then $section = $aTools[$i-1][4] $latools = $i -1 iniwrite($filelink,$section,"link",$hyperlink) ExitLoop Elseif $mouseId = $aMyMatrix[$i] and $aTools[$i-1][3] <> "" Then $section = $aTools[$i-1][4] $latools = $i -1 Local $question = msgbox(4,"", "Etes vous certain de vouloir écraser le raccourcis existant ?") if $question == 6 then iniwrite($filelink,$section,"link",$hyperlink) else Return EndIf ExitLoop EndIf Next $reponse = InputBox("Nom du lien","Donnez un titre !",StringTrimLeft($hyperlink,7)) if @error == 1 or $reponse = "" Then Return Iniwrite($filelink,$section,"label",$reponse) $aRet = _PickIconDlg($dll_icones) If Not @error Then IniWrite($filelink,$section,"icone",$aRet[0] & "," & $aRet[1]) Else iniwrite($filelink,$section,"link","") Iniwrite($filelink,$section,"label","") Return EndIf $fichier_icone = stringsplit(IniRead($filelink,$aTools[$latools][4],"icone","erreur"),",") if $fichier_icone[0] > 1 Then $aTools[$latools][1] = $fichier_icone[1] $aTools[$latools][2] = $fichier_icone[2] Else $aTools[$latools][1] = IniRead($filelink,$aTools[$latools][4],"icone","erreur") $aTools[$latools][2] = "," & Number("0") EndIf $aTools[$latools][0] = $reponse $aTools[$latools][3] = $hyperlink for $i = 0 to 4 consolewrite (@CRLF & "colone " & $i & @TAB & $aTools[$latools][$i]) Next ;GUICtrlSetBkColor($mouseId,$GUI_BKCOLOR_TRANSPARENT) GUICtrlSetImage($mouseId, $aTools[$latools][1], $aTools[$latools][2]) GUICtrlSetTip($mouseId, $aTools[$latools][3],$aTools[$latools][0]) EndIf $DropAccept = $DROPEFFECT_COPY Case Else $DropAccept = $DROPEFFECT_NONE EndSelect Return $DropAccept Case $WM_DRAGOVER Return $DropAccept Case $WM_DRAGLEAVE ToolTip("") EndSwitch EndFunc Func Test() MsgBox(0, 0, ":)", 1) EndFunc ;==>Test Func _Check_LabelForbidden($string) if $string = "Libre" then $string = 1 Return $string EndFunc Func _PickIconDlg($sFileName, $nIconIndex=0, $hWnd=0) Local $nRet, $aRetArr[2] $nRet = DllCall("shell32.dll", "int", "PickIconDlg", _ "hwnd", $hWnd, _ "wstr", $sFileName, "int", 1000, "int*", $nIconIndex) If Not $nRet[0] Then Return SetError(1, 0, -1) $aRetArr[0] = $nRet[2] $aRetArr[1] = $nRet[4] + 1 Return $aRetArr EndFunc Func Position() DllStructSetData($g_tStruct, "x", MouseGetPos(0)) DllStructSetData($g_tStruct, "y", MouseGetPos(1)) EndFunc ;==>Position #Region --- Restart Program --- Func _RestartProgram() If @Compiled = 1 Then Run(FileGetShortName(@ScriptFullPath)) Else Run(FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath)) EndIf Exit EndFunc; ==> _RestartProgram #EndRegion --- Restart Program ---
  7. dear xJilo i believe you're not very familiar with autoit and scripting, so train yourself with basic training courses before asking help for this, to be honest, become familiar with variables, constants, arrays etc... and it will be more easy for you to understand code from autoit.
  8. For your understanding : ClipPut ( "value" ) --> copy data to clip memory Clipget() read value from clip but why do you want to pass thoose values by the clip when FileCopy ( "source", "dest" [, flag = 0] ) woud do the job more easely...
  9. Untouch but adding the new search basic method by restarting script and modifying the $ARRAY_OF_FOLDERS = [@scriptdir, @MyDocumentsDir] Nice work... #include <Constants.au3> #include <GUIConstants.au3> #include <GuiTreeView.au3> #include <File.au3> Opt("MustDeclareVars", 1) Const $ARRAY_OF_FOLDERS = [@scriptdir, @MyDocumentsDir] Const $DEFAULT_FILTER = "*.au3" Local $hGUI = GUICreate("Search Content", 600, 440, 190, 120) GUISetFont(11) Local $idSelect = GUICtrlCreateButton("Select Folder", 25, 20, 135, 30) Local $idFolder = GUICtrlCreateCombo("", 185, 24, 400, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlCreateLabel("Filter :", 25, 58, 50, 25) Local $idFilter = GUICtrlCreateInput($DEFAULT_FILTER, 70, 55, 90, 25) GUICtrlCreateLabel("Text to search :", 185, 58, 100, 25) Local $idText = GUICtrlCreateInput("", 285, 55, 300, 25) Local $idTreeFile = GUICtrlCreateTreeView(25, 90, 560, 300) GUICtrlSetFont(-1, 9) Local $idSearch = GUICtrlCreateButton("Search", 100, 400, 100, 25) Local $idOpen = GUICtrlCreateButton("Open", 400, 400, 100, 25) local $idNewSearch = GUICtrlCreateButton("New Search", 230, 400, 150, 25) GUISetState(@SW_SHOW) Local $sFolder, $idTVselect, $aSelect[1], $idParent GUICtrlSetData($idFolder, _ArrayToString($ARRAY_OF_FOLDERS), $ARRAY_OF_FOLDERS[0]) While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idSelect $sFolder = FileSelectFolder("Select root folder", @ScriptDir, 0, @ScriptDir, $hGUI) If @error Then ContinueLoop GUICtrlSetData($idFolder, $sFolder, $sFolder) Case $idSearch If Not GUICtrlRead($idFolder) Or Not GUICtrlRead($idFilter) Then MsgBox($MB_SYSTEMMODAL, "Error", "You must provide folder and filter fields") ContinueLoop EndIf ReDim $aSelect[1] $aSelect[0] = 0 SearchText($idTreeFile, GUICtrlRead($idFolder), GUICtrlRead($idFilter), GUICtrlRead($idText)) Case $idOpen $idTVselect = GUICtrlRead($idTreeFile) If Not $idTVselect Or _GUICtrlTreeView_GetParentHandle($idTreeFile, $idTVselect) Then MsgBox($MB_SYSTEMMODAL, "Error", "Please select file you want to open") ContinueLoop EndIf OpenFile(GUICtrlRead($idTreeFile, $GUI_READ_EXTENDED), GUICtrlRead($idText)) Case $idNewSearch _RestartProgram() EndSwitch $idTVselect = GUICtrlRead($idTreeFile) If $idTVselect Then If _GUICtrlTreeView_GetParentHandle($idTreeFile, $idTVselect) Then ContinueLoop For $i = 1 To $aSelect[0] If $idTVselect = $aSelect[$i] Then ContinueLoop 2 Next _ArrayAdd($aSelect, $idTVselect) $aSelect[0] += 1 DisplayLine($hGUI, $idTreeFile, $idTVselect, ControlTreeView($hGUI, "", $idTreeFile, "GetSelected"), GUICtrlRead($idText)) EndIf WEnd Func SearchText($idTree, $sFolder, $sFilter, $sText) Local Const $CURSOR_WAIT = 15 Local $bFound = False _GUICtrlTreeView_DeleteAll($idTree) Local $aFile = _FileListToArrayRec($sFolder, $sFilter, $FLTAR_FILES, $FLTAR_RECUR, $FLTAR_NOSORT, $FLTAR_FULLPATH) If @error Then Return MsgBox($MB_SYSTEMMODAL, "Error", "No file selected") GUISetCursor($CURSOR_WAIT, $GUI_CURSOR_OVERRIDE) For $i = 1 To $aFile[0] If Not $sText Or StringInStr(FileRead($aFile[$i]), $sText) Then GUICtrlCreateTreeViewItem($aFile[$i], $idTree) $bFound = True EndIf Next GUISetCursor() If Not $bFound Then MsgBox($MB_SYSTEMMODAL, "Error", "Text not found") EndFunc ;==>SearchText Func DisplayLine($hGUI, $idTree, $idItem, $sItem, $sText) If Not $sText Then Return Local $aLine = FileReadToArray($sItem) For $i = 1 To UBound($aLine) - 1 If StringInStr($aLine[$i], $sText) Then GUICtrlCreateTreeViewItem($aLine[$i], $idItem) Next ControlTreeView($hGUI, "", $idTree, "Expand", $sItem) EndFunc ;==>DisplayLine Func OpenFile($sFile, $sText) Local $sDrive, $sDir, $sFileName, $sExtension _PathSplit($sFile, $sDrive, $sDir, $sFileName, $sExtension) ClipPut($sText) ShellExecute($sFile, "", $sDrive & $sDir, "open") EndFunc ;==>OpenFile #Region --- Restart Program --- Func _RestartProgram() If @Compiled = 1 Then Run(FileGetShortName(@ScriptFullPath)) Else Run(FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath)) EndIf Exit EndFunc; ==> _RestartProgram #EndRegion --- Restart Program ---
  10. Thank you for this app, i think it should be useful for most of us, i would suggest you to add a context menu to the search button, just adding some controls or whatever the user would add to it. I've made a modification to the script to add this with a little bit of command red in an another ini file that you could implement the context menu is red when the GUI is made, its a démonstration version, and if you agree i would like to develop the possibility for the user to add or remove entries in the menu. the modified script : #pragma compile(Out, Launch.IT.exe) #pragma compile(Icon, icon\Launchit.ico) ;#pragma compile(ExecLevel, highestavailable) ;#pragma compile(Compatibility, win7) ;#pragma compile(UPX, False) ;***************************** /!\ ***************************** #pragma compile(x64, True) ;;;COMMENT THIS LINE IF YOU WANT TO COMPILE A 32-BITS VERSION OF THE PROGRAM #pragma compile(ProductName, Launch.IT (64-bits)) ;;;IF THE LINE ABOVE IS COMMENTED, MODIFY "64-bits" BY "32-bits" ;*************************************************************** #pragma compile(FileDescription, Launch.IT: hackable Windows app launcher) #pragma compile(ProductVersion, 1.0) #pragma compile(FileVersion, 1.0.10) #pragma compile(LegalCopyright, By Taskms4 / Not protected by copyrights) #pragma compile(LegalTrademarks, 'Launch.IT is not a registered trademark') ;#pragma compile(CompanyName, 'My Company') #cs ===[SCRIPT HEADER]========================================================================================================================================================= Title ............: MTSkin UDF Description ......: Create Light & Modern GUI for Autoit Scripts Script Version ...: v1.0 Author ...........: Taskms4 Language .........: English AutoIt Version ...: v3.3.12.0+ Notes ............: Version History ..: v0.0.1 - Temporary GUI design & launching programs/applications using static aliases (using variables set inside the code) -- v1.0.0 - New GUI design & launching programs/applications using ".ini" file (can be customized easily without modifying the code) v1.0.1 - Added "inner commands" : RUN, EXPLORER, FILE SEARCH. v1.0.2 - Added the RUN DOS COMMAND "inner command" v1.0.3 - Added the GOOGLE SEARCH "inner command" v1.0.4 - Improved URL management (in previous versions we had to add the "::e " before the URL) v1.0.5 - Search input color can now be modified within the ".ini" file under "GENERAL.CONTROLS","SEARCH_INPUT_HEXCOLOR" v1.0.6 - Added Help module with '::help' command and Edge Support for '::g ...' command (Google Search) v1.0.7 - If a path is typed in launch.IT will now browse the path in an explorer window ('::e' command is not necessary to be specified) v1.0.8 - Added options "GUI_ALWAYSONTOP" and "GUI_ISDRAGGABLE" in the "ini" file v1.0.9 - Reworked code to make it clearer and "shareable" + Added function _GenerateDefaultIniFile() to create a default Ini file if not found v1.0.10 - Added self restart inner command '::restart' to auto restart program (e.g.: after ini modification) #ce ========================================================================================================================================================================== #NoTrayIcon #include <ButtonConstants.au3> #include <MsgBoxConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <Array.au3> #include <File.au3> #include <Misc.au3> #include <SendMessage.au3> HotKeySet("+{ESC}", "_WinMove") ;"+{ESC}" = SHIFT+ESC #Region Global Vars/Constants Initialization ----------------------------------------- ;###################### ;## GLOBAL-CONSTANTS ## ;###################### Global Const $SC_DRAGMOVE = 0xF012 ;#(Used to make GUI draggable) Global Const $INITVALUE=-255 Global Const $INIFILE="launchit.conf.ini" If Not(FileExists($INIFILE)) Then _ErrorIniNotFound() Global Const $ACTION_HELP_CMD="::help" Global Const $ACTION_RESTART_CMD="::restart" Global Const $ACTION_DOSCMD_PATTERN="::c " Global Const $ACTION_EXPLORE_PATTERN="::e " Global Const $ACTION_GOOGLE_PATTERN="::g " Global Const $ACTION_RUN_PATTERN="::r " Global Const $ACTION_SEARCH_PATTERN="::s " ;** Here you can add your own commands here (by defining some patterns) ;** Note the use of "spaces" at the end of the patterns (except for "::help") ;** Do not forget to modify the "Launch.IT Action" Region to add actions linked to the command patterns (See _SearchAction()) ;################# ;## GLOBAL-VARS ## ;################# Global $WHND=0 Global $INICMDLIST=0 Global $WINPOS=0 ;0=MainGUI / 1=MinimizedGUI Global $nbr_section Global $nbr_cle[20][50];tableau de la valeur ( ligne de commandes à éxecuter ) Global $menu_handle[20][50];tableau des handles ;;MAIN GUI Global $GUI_HEIGHT=$INITVALUE Global $GUI_WIDTH=$INITVALUE Global $GUI_LEFT=$INITVALUE Global $GUI_TOP=$INITVALUE Global $GUI_IMG=$INITVALUE Global $GUI_IMG_LEFT=$INITVALUE Global $GUI_IMG_TOP=$INITVALUE Global $GUI_ISDRAGGABLE=$INITVALUE Global $GUI_ALWAYSONTOP=$INITVALUE ;;MIN. GUI Global $MINGUI_HEIGHT=$INITVALUE Global $MINGUI_WIDTH=$INITVALUE Global $MINGUI_LEFT=$INITVALUE Global $MINGUI_TOP=$INITVALUE Global $MINGUI_IMG=$INITVALUE Global $MINGUI_IMG_LEFT=$INITVALUE Global $MINGUI_IMG_TOP=$INITVALUE ;;BUTTONS Global $SEARCH_ACTION=$INITVALUE ;0="close", 1="minimize", 2="none" Global $SEARCH_INPUT_LEFT=$INITVALUE Global $SEARCH_INPUT_TOP=$INITVALUE Global $SEARCH_INPUT_HEXCOLOR=$INITVALUE Global $SEARCH_INPUT_FONTCOLOR=$INITVALUE Global $SEARCH_IMG=$INITVALUE Global $SEARCH_BTN_WIDTH=$INITVALUE Global $SEARCH_BTN_HEIGHT=$INITVALUE Global $SEARCH_BTN_LEFT=$INITVALUE Global $SEARCH_BTN_TOP=$INITVALUE Global $SETTINGS_IMG=$INITVALUE Global $SETTINGS_BTN_WIDTH=$INITVALUE Global $SETTINGS_BTN_HEIGHT=$INITVALUE Global $SETTINGS_BTN_LEFT=$INITVALUE Global $SETTINGS_BTN_TOP=$INITVALUE Global $MINIMIZE_IMG=$INITVALUE Global $MINIMIZE_BTN_LEFT=$INITVALUE Global $MINIMIZE_BTN_TOP=$INITVALUE Global $MINIMIZE_BTN_WIDTH=$INITVALUE Global $MINIMIZE_BTN_HEIGHT=$INITVALUE Global $MAXIMIZE_IMG=$INITVALUE Global $MAXIMIZE_BTN_LEFT=$INITVALUE Global $MAXIMIZE_BTN_TOP=$INITVALUE Global $MAXIMIZE_BTN_WIDTH=$INITVALUE Global $MAXIMIZE_BTN_HEIGHT=$INITVALUE #EndRegion Global Vars/Constants Initialization -------------------------------------- ;#Allow only one instance of Launch.IT (Singleton) If _Singleton("Launch.IT", 1) = 0 Then ;MsgBox(48, "Warning", "An occurrence of this program is already running") WinActivate("Launch.IT","") Exit EndIf ;#Read the "ini" file & Create GUI If _ReadIni() Then _MainGUI() #Region Main GUI Creation ------------------------------------------------------------ Func _MainGUI() $WHND = GUICreate ( "Launch.IT", $GUI_WIDTH, $GUI_HEIGHT, $GUI_LEFT, $GUI_TOP, $WS_POPUP, $WS_EX_LAYERED) $GUIPic=GUICtrlCreatePic($GUI_IMG, $GUI_IMG_LEFT, $GUI_IMG_TOP, 0, 0, -1) GUICtrlSetState($GUIPic, $GUI_DISABLE) $Input= GUICtrlCreateInput("", $SEARCH_INPUT_LEFT, $SEARCH_INPUT_TOP, 260, 29, -1, $WS_EX_WINDOWEDGE) ;;($WS_EX_WINDOWEDGE = No Border)) GUICtrlSetBkColor($Input, $SEARCH_INPUT_HEXCOLOR) GUICtrlSetFont($Input, 12, -1, -1, "Arial") GUICtrlSendMsg($Input, $EM_SETCUEBANNER, False, "Search...") GUICtrlSetColor($Input, $SEARCH_INPUT_FONTCOLOR) $Search=GUICtrlCreateButton("", $SEARCH_BTN_LEFT, $SEARCH_BTN_TOP, $SEARCH_BTN_WIDTH, $SEARCH_BTN_HEIGHT, BitOr($BS_BITMAP,$BS_DEFPUSHBUTTON)) GUICtrlSetImage(-1,$SEARCH_IMG) $Settings=GUICtrlCreateButton("",$SETTINGS_BTN_LEFT, $SETTINGS_BTN_TOP, $SETTINGS_BTN_WIDTH, $SETTINGS_BTN_HEIGHT, $BS_BITMAP) GUICtrlSetImage(-1,$SETTINGS_IMG) $Minimize=GUICtrlCreateButton("", $MINIMIZE_BTN_LEFT, $MINIMIZE_BTN_TOP, $MINIMIZE_BTN_WIDTH, $MINIMIZE_BTN_HEIGHT, $BS_BITMAP) GUICtrlSetImage(-1,$MINIMIZE_IMG) ;Make GUI on Top only if (GUI_ALWAYSONTOP==True) in the "ini" file If $GUI_ALWAYSONTOP==True Then WinSetOnTop($WHND, "Launch.IT", 1) Global $idContextmenu = GUICtrlCreateContextMenu($Search) _Contextmenu() GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_PRIMARYDOWN ;#Drag/Move GUI only if (GUI_ISDRAGGABLE == True) in the "ini" file If $GUI_ISDRAGGABLE==True Then _SendMessage($WHND, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) $NewPos=WinGetPos($WHND) ;;MsgBox(0,'GUI-Move (On-Drag Event)',"X-Pos(Left)=<"&$NewPos[0]&"> | Y-Pos(Top)=<"&$NewPos[1]&">") $GUI_LEFT=$NewPos[0] $GUI_TOP=$NewPos[1] EndIf Case $Minimize _WinMove() Case $Search Local $dataTyped=GUICtrlRead($Input) If $dataTyped Then _SearchAction($dataTyped) Switch $SEARCH_ACTION Case 0 Exit Case 1 _WinMove() Case Else GUICtrlSetData($Input,"") EndSwitch EndIf Case $Settings _LaunchSettings() case Else For $j = 1 To $nbr_section For $i = 1 To $nbr_cle[$j][0] If $nMsg = $menu_handle[$j][$i] Then Run($nbr_cle[$j][$i]) EndIf Next Next EndSwitch WEnd EndFunc ;==>_MainGUI #EndRegion Main GUI Creation --------------------------------------------------------- #Region Minimized GUI Creation ------------------------------------------------------- Func _MinimizedGUI() $WHND = GUICreate ( "", $MINGUI_WIDTH, $MINGUI_HEIGHT, $MINGUI_LEFT, $MINGUI_TOP, $WS_POPUP, BitOR($WS_EX_LAYERED,$WS_EX_TOPMOST)) ;~ $WHND = GUICreate ( "", $MINGUI_WIDTH, $MINGUI_HEIGHT, $MINGUI_LEFT, $MINGUI_TOP, $WS_POPUP, BitOR($WS_EX_LAYERED,$WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) $MINGUIPic=GUICtrlCreatePic($MINGUI_IMG, $MINGUI_IMG_LEFT, $MINGUI_IMG_TOP, 0, 0, -1) GUICtrlSetState($MINGUIPic, $GUI_DISABLE) $Maximize=GUICtrlCreateButton("", $MAXIMIZE_BTN_LEFT, $MAXIMIZE_BTN_TOP, $MAXIMIZE_BTN_WIDTH, $MAXIMIZE_BTN_HEIGHT, BitOr($BS_BITMAP,$BS_DEFPUSHBUTTON)) GUICtrlSetImage(-1,$MAXIMIZE_IMG) GUISetState(@SW_SHOW) WinSetOnTop($WHND, "", 1) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Maximize,$GUI_EVENT_RESTORE _WinMove() EndSwitch WEnd EndFunc ;==>_MinimizedGUI #EndRegion Minimized GUI Creation ---------------------------------------------------- #Region Moving GUI (Minimize/Maximize) ----------------------------------------------- Func _WinMove() If $WINPOS=1 Then $WINPOS=0 GUIDelete() _MainGUI() ElseIf $WINPOS=0 Then $WINPOS=1 GUIDelete() _MinimizedGUI() EndIf EndFunc ;==>_MinimizedGUI #EndRegion Moving GUI (Minimize/Maximize) -------------------------------------------- #Region Initialize variables from "ini" file ----------------------------------------- Func _ReadIni() ;Initialize MAINGUI vars with IniFile data $GUI_HEIGHT=IniRead($INIFILE,"GENERAL.MAINGUI","MAINGUI_HEIGHT",$INITVALUE) $GUI_WIDTH=IniRead($INIFILE,"GENERAL.MAINGUI","MAINGUI_WIDTH",$INITVALUE) $GUI_LEFT=IniRead($INIFILE,"GENERAL.MAINGUI","MAINGUI_LEFT",$INITVALUE) $GUI_TOP=IniRead($INIFILE,"GENERAL.MAINGUI","MAINGUI_TOP",$INITVALUE) $GUI_ISDRAGGABLE=IniRead($INIFILE,"GENERAL.MAINGUI","MAINGUI_ISDRAGGABLE",$INITVALUE) $GUI_ALWAYSONTOP=IniRead($INIFILE,"GENERAL.MAINGUI","MAINGUI_ALWAYSONTOP",$INITVALUE) $GUI_IMG=IniRead($INIFILE,"GENERAL.MAINGUI","MAINGUI_IMAGE",$INITVALUE) If Not(FileExists($GUI_IMG)) Then Msgbox(16,'Error in the ".ini" file','File specified under "GENERAL.MAINGUI > MAINGUI_IMAGE"'&@CRLF&'does not exist! Please check the ".ini" file.') Exit Endif $GUI_IMG_LEFT=IniRead($INIFILE,"GENERAL.MAINGUI","MAINGUI_IMAGE_LEFT",$INITVALUE) $GUI_IMG_TOP=IniRead($INIFILE,"GENERAL.MAINGUI","MAINGUI_IMAGE_TOP",$INITVALUE) ;Initialize MINGUI vars with IniFile data $MINGUI_HEIGHT=IniRead($INIFILE,"GENERAL.MINIMIZEDGUI","MINIMIZEDGUI_HEIGHT",$INITVALUE) $MINGUI_WIDTH=IniRead($INIFILE,"GENERAL.MINIMIZEDGUI","MINIMIZEDGUI_WIDTH",$INITVALUE) $MINGUI_LEFT=IniRead($INIFILE,"GENERAL.MINIMIZEDGUI","MINIMIZEDGUI_LEFT",$INITVALUE) $MINGUI_TOP=IniRead($INIFILE,"GENERAL.MINIMIZEDGUI","MINIMIZEDGUI_TOP",$INITVALUE) $MINGUI_IMG=IniRead($INIFILE,"GENERAL.MINIMIZEDGUI","MINIMIZEDGUI_IMAGE",$INITVALUE) If Not(FileExists($MINGUI_IMG)) Then Msgbox(16,'Error in the ".ini" file','File specified under "GENERAL.MAINGUI > MINIMIZEDGUI_IMAGE"'&@CRLF&'does not exist! Please check the ".ini" file.') Exit Endif $MINGUI_IMG_LEFT=IniRead($INIFILE,"GENERAL.MINIMIZEDGUI","MINIMIZEDGUI_IMAGE_LEFT",$INITVALUE) $MINGUI_IMG_TOP=IniRead($INIFILE,"GENERAL.MINIMIZEDGUI","MINIMIZEDGUI_IMAGE_TOP",$INITVALUE) ;Initialize CONTROLS vars with IniFile data $SEARCH_ACTION=IniRead($INIFILE,"GENERAL.CONTROLS","SEARCH_ACTION",1) $SEARCH_INPUT_LEFT=IniRead($INIFILE,"GENERAL.CONTROLS","SEARCH_INPUT_LEFT",$INITVALUE) $SEARCH_INPUT_TOP=IniRead($INIFILE,"GENERAL.CONTROLS","SEARCH_INPUT_TOP",$INITVALUE) $SEARCH_INPUT_HEXCOLOR=IniRead($INIFILE,"GENERAL.CONTROLS","SEARCH_INPUT_HEXCOLOR",0xC0C0C0) $SEARCH_INPUT_FONTCOLOR=IniRead($INIFILE,"GENERAL.CONTROLS","SEARCH_INPUT_FONTCOLOR",0xffffff) $SEARCH_IMG=IniRead($INIFILE,"GENERAL.CONTROLS","SEARCH_IMAGE",$INITVALUE) If Not(FileExists($SEARCH_IMG)) Then Msgbox(16,'Error in the ".ini" file','File specified under "GENERAL.MAINGUI > SEARCH_IMAGE"'&@CRLF&'does not exist! Please check the ".ini" file.') Exit Endif $SEARCH_BTN_LEFT=IniRead($INIFILE,"GENERAL.CONTROLS","SEARCH_BTN_LEFT",$INITVALUE) $SEARCH_BTN_TOP=IniRead($INIFILE,"GENERAL.CONTROLS","SEARCH_BTN_TOP",$INITVALUE) $SEARCH_BTN_WIDTH=IniRead($INIFILE,"GENERAL.CONTROLS","SEARCH_BTN_WIDTH",$INITVALUE) $SEARCH_BTN_HEIGHT=IniRead($INIFILE,"GENERAL.CONTROLS","SEARCH_BTN_HEIGHT",$INITVALUE) $SETTINGS_IMG=IniRead($INIFILE,"GENERAL.CONTROLS","SETTINGS_IMAGE",$INITVALUE) If Not(FileExists($SETTINGS_IMG)) Then Msgbox(16,'Error in the ".ini" file','File specified under "GENERAL.MAINGUI > SETTINGS_IMAGE"'&@CRLF&'does not exist! Please check the ".ini" file.') Exit Endif $SETTINGS_BTN_LEFT=IniRead($INIFILE,"GENERAL.CONTROLS","SETTINGS_BTN_LEFT",$INITVALUE) $SETTINGS_BTN_TOP=IniRead($INIFILE,"GENERAL.CONTROLS","SETTINGS_BTN_TOP",$INITVALUE) $SETTINGS_BTN_WIDTH=IniRead($INIFILE,"GENERAL.CONTROLS","SETTINGS_BTN_WIDTH",$INITVALUE) $SETTINGS_BTN_HEIGHT=IniRead($INIFILE,"GENERAL.CONTROLS","SETTINGS_BTN_HEIGHT",$INITVALUE) $MINIMIZE_IMG=IniRead($INIFILE,"GENERAL.CONTROLS","MINIMIZE_IMAGE",$INITVALUE) If Not(FileExists($MINIMIZE_IMG)) Then Msgbox(16,'Error in the ".ini" file','File specified under "GENERAL.MAINGUI > MINIMIZE_IMAGE"'&@CRLF&'does not exist! Please check the ".ini" file.') Exit Endif $MINIMIZE_BTN_LEFT=IniRead($INIFILE,"GENERAL.CONTROLS","MINIMIZE_BTN_LEFT",$INITVALUE) $MINIMIZE_BTN_TOP=IniRead($INIFILE,"GENERAL.CONTROLS","MINIMIZE_BTN_TOP",$INITVALUE) $MINIMIZE_BTN_WIDTH=IniRead($INIFILE,"GENERAL.CONTROLS","MINIMIZE_BTN_WIDTH",$INITVALUE) $MINIMIZE_BTN_HEIGHT=IniRead($INIFILE,"GENERAL.CONTROLS","MINIMIZE_BTN_HEIGHT",$INITVALUE) $MAXIMIZE_IMG=IniRead($INIFILE,"GENERAL.CONTROLS","MAXIMIZE_IMAGE",$INITVALUE) If Not(FileExists($MAXIMIZE_IMG)) Then Msgbox(16,'Error in the ".ini" file','File specified under "GENERAL.MAINGUI > MAXIMIZE_IMAGE"'&@CRLF&'does not exist! Please check the ".ini" file.') Exit Endif $MAXIMIZE_BTN_LEFT=IniRead($INIFILE,"GENERAL.CONTROLS","MAXIMIZE_BTN_LEFT",$INITVALUE) $MAXIMIZE_BTN_TOP=IniRead($INIFILE,"GENERAL.CONTROLS","MAXIMIZE_BTN_TOP",$INITVALUE) $MAXIMIZE_BTN_WIDTH=IniRead($INIFILE,"GENERAL.CONTROLS","MAXIMIZE_BTN_WIDTH",$INITVALUE) $MAXIMIZE_BTN_HEIGHT=IniRead($INIFILE,"GENERAL.CONTROLS","MAXIMIZE_BTN_HEIGHT",$INITVALUE) ;Recover all commands/actions in an array using IniFile data $INICMDLIST=IniReadSection($INIFILE,"ALIASES") If @error Then Msgbox(64,"Info",'No commands have been set in the ".ini" file') ;IF ALL OK RETURN "1" FOR SUCCESS return 1 EndFunc ;==>_ReadIni #EndRegion Initialize variables from "ini" file -------------------------------------- #Region Launch Settings (Opening "ini" file) ----------------------------------------- Func _LaunchSettings() If MsgBox(4, "Launch.IT Settings", "Launching settings will close the program..."&@CRLF&"Would you like to continue?") = 6 Then ShellExecute('notepad.exe', @WorkingDir&'\'&$INIFILE, '') sleep(15) Exit EndIf EndFunc ;==>_MinimizedGUI #EndRegion Launch Settings (Opening "ini" file) -------------------------------------- #Region Launch.IT Action on User's search typed -------------------------------------- Func _SearchAction($sSrch) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; ;; [10 CASES]: ;; ;; - Search is "::help" => Display help about embedded commands below ;; ;; - Search is "::restart" => Auto restart the program (e.g.: after ini modification) ;; ;; - Search like "::c ...." => Run Dos Cmd by opening a command prompt ;; ;; - Search like "::e ...." => Open an explorer and browse the path/url/file typed ;; ;; - Search like "::g ...." => Open an web browser (Chrome, Firefox or IE) and launch google results for the search ;; ;; - Search like "::r ...." => Run cmd like Windows Run (Win+R) ;; ;; - Search like "::s ...." => Search file results (force search) using Windows Search ;; ;; - Search like "http://..." or "https://..." or "www...." => Launch explorer to HTTP address (may open IE by default) ;; ;; - Search like "word" => run command/program/file linked to alias "word" ;; ;; - Search like "word" => if Not an alias then search files containing "word" (Windows Search) ;; ;; ;; ;; => Add your own commands/actions below ;; ;; _____________ ;; ;; ;; ;; NOTE: Command patterns above are case-insensitive ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; If $sSrch=$ACTION_HELP_CMD Then ShellExecute("Help.Launch.IT.exe") ;#Help.Launch.IT.exe was provided with Launch.IT source code and placed in the same folder sleep(15) ElseIf $sSrch=$ACTION_RESTART_CMD Then _SelfRestart() ElseIf StringRegExp( $sSrch, $ACTION_DOSCMD_PATTERN, 0) Then Local $CMDtoRUN=StringReplace($sSrch, $ACTION_DOSCMD_PATTERN, "") ;#DEBUG# Msgbox(0,"","DOS COMMAND TO RUN = "&$CMDtoRUN) Run('"' & @ComSpec & '" /k ' & $CMDtoRUN, @WindowsDir) sleep(15) ElseIf StringRegExp( $sSrch, $ACTION_EXPLORE_PATTERN, 0) Then Local $PATH=StringReplace($sSrch, $ACTION_EXPLORE_PATTERN, "") ;#DEBUG# Msgbox(0,"","PATH TO BROWSE = "&$PATH) If StringInStr($PATH,"%APPDATA%") Then $PATH=StringReplace($PATH, "%APPDATA%", @AppDataDir) If StringInStr($PATH,"%TEMP%") Then $PATH=StringReplace($PATH, "%TEMP%", @TempDir) If StringInStr($PATH,"%HOMEDRIVE%") Then $PATH=StringReplace($PATH, "%HOMEDRIVE%", @HomeDrive) If StringInStr($PATH,"%PROGRAMDATA%") Then $PATH=StringReplace($PATH, "%PROGRAMDATA%", @HomeDrive&"\ProgramData") If StringInStr($PATH,"%PROGRAMFILES%") Then $PATH=StringReplace($PATH, "%PROGRAMFILES%", @HomeDrive&"\Program Files") If StringInStr($PATH,"%SYSTEMROOT%") Then $PATH=StringReplace($PATH, "%SYSTEMROOT%", @WindowsDir) ;If StringInStr($PATH,"%WINDOWSDIR%") Then $PATH=StringReplace($PATH, "%WINDOWSDIR%", @WindowsDir) If StringInStr($PATH,"%USERPROFILE%") Then $PATH=StringReplace($PATH, "%USERPROFILE%", @UserProfileDir) If StringInStr($PATH,"%PROGRAMFILES86%") Then $PATH=StringReplace($PATH, "%PROGRAMFILES86%", @ProgramFilesDir) ShellExecute($PATH) sleep(15) ElseIf ( StringRegExp( $sSrch, '^[a-zA-Z]:\\(((?![<>:"/\\|?*]).)+((?<![ .])\\)?)*$', 0) Or StringRegExp( $sSrch, '^\\\\(((?![<>:"/\\|?*]).)+((?<![ .])\\)?)*$', 0) Or StringRegExp( $sSrch, '^%[a-zA-Z]+%\\(((?![<>:"/\\|?*]).)+((?<![ .])\\)?)*$', 0) Or StringRegExp( $sSrch, '^%[a-zA-Z]+%$', 0) ) Then ;;Path directly typed in the search input (i.e.: "c:\users\john doe\desktop\folder\") Local $PATH=$sSrch If StringInStr($PATH,"%APPDATA%") Then $PATH=StringReplace($PATH, "%APPDATA%", @AppDataDir) If StringInStr($PATH,"%TEMP%") Then $PATH=StringReplace($PATH, "%TEMP%", @TempDir) If StringInStr($PATH,"%HOMEDRIVE%") Then $PATH=StringReplace($PATH, "%HOMEDRIVE%", @HomeDrive) If StringInStr($PATH,"%PROGRAMDATA%") Then $PATH=StringReplace($PATH, "%PROGRAMDATA%", @HomeDrive&"\ProgramData") If StringInStr($PATH,"%PROGRAMFILES%") Then $PATH=StringReplace($PATH, "%PROGRAMFILES%", @HomeDrive&"\Program Files") If StringInStr($PATH,"%SYSTEMROOT%") Then $PATH=StringReplace($PATH, "%SYSTEMROOT%", @WindowsDir) ;If StringInStr($PATH,"%WINDOWSDIR%") Then $PATH=StringReplace($PATH, "%WINDOWSDIR%", @WindowsDir) If StringInStr($PATH,"%USERPROFILE%") Then $PATH=StringReplace($PATH, "%USERPROFILE%", @UserProfileDir) If StringInStr($PATH,"%PROGRAMFILES86%") Then $PATH=StringReplace($PATH, "%PROGRAMFILES86%", @ProgramFilesDir) ShellExecute($PATH) sleep(15) ElseIf StringRegExp( $sSrch, $ACTION_GOOGLE_PATTERN, 0) Then Local $GoogleSearch="https://www.google.com/search?q="&StringReplace( StringReplace($sSrch, $ACTION_GOOGLE_PATTERN, ""), " ", "%20" ) ;#DEBUG# Msgbox(0,"","GOOGLE SEARCH = "&$GoogleSearch) ;;; 1-CHROME ;;; $ChromePath=RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe", "") If $ChromePath Then ShellExecute($ChromePath,$GoogleSearch) Else ;;; 2-FIREFOX ;;; $ChromePath="" $FFPath=RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe", "") If $FFPath Then ShellExecute($FFPath,$GoogleSearch) Else ;;; 3-EDGE ;;; If FileExists(@WindowsDir&"\SystemApps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\") Then ShellExecute("microsoft-edge:"&$GoogleSearch) Else ;;; 4-IE ;;; ShellExecute($GoogleSearch) EndIf EndIf EndIf sleep(15) ElseIf StringRegExp( $sSrch, $ACTION_RUN_PATTERN, 0) Then Local $CMDtoRUN=StringReplace($sSrch, $ACTION_RUN_PATTERN, "") ;#DEBUG# Msgbox(0,"","COMMAND TO RUN = "&$CMDtoRUN) Run($CMDtoRUN, @WindowsDir) ;Run($CMDtoRUN, '') If Not(@error) Then sleep(15) Else ShellExecute($CMDtoRUN, "", @WindowsDir) If Not(@error) Then sleep(15) Else Msgbox(16,"Run", 'Windows cannot run "'&$CMDtoRUN&'".'&@CRLF&'Make sure you typed the program/command correctly.') EndIf EndIf ElseIf StringRegExp( $sSrch, $ACTION_SEARCH_PATTERN, 0) Then Local $STRtoSEARCH=StringReplace($sSrch, $ACTION_SEARCH_PATTERN, "") ;#DEBUG# Msgbox(0,"","STRING TO SEARCH = "&$STRtoSEARCH) $obj = ObjCreate("WScript.Shell") $obj.Run ("explorer /root,""search-ms:query="&$STRtoSEARCH&"") sleep(15) ElseIf StringRegExp( $sSrch, "http://", 0) Or StringRegExp( $sSrch, "https://", 0) Or StringRegExp( $sSrch, "www.", 0) Then ShellExecute($sSrch) sleep(15) ElseIf _ArraySearch($INICMDLIST,$sSrch)>0 Then Local $iInd=_ArraySearch($INICMDLIST,$sSrch) ;#DEBUG# Msgbox(0,"",'ALIAS "'&$sSrch&'" REFERS TO ACTION "'&$INICMDLIST[$iInd][1]&'"') Local $sDrive = "", $sDir = "", $sFileName = "", $sExtension = "" Local $GetPath = _PathSplit($INICMDLIST[$iInd][1], $sDrive, $sDir, $sFileName, $sExtension) ShellExecute($INICMDLIST[$iInd][1], "", $sDrive&"\"&$sDir) Else ;#DEBUG# Msgbox(0,"Not found", '"'&$sSrch&'" not found, launching Windows Search for finding files containing string typed...') $obj = ObjCreate("WScript.Shell") $obj.Run ("explorer /root,""search-ms:query="&$sSrch&"") sleep(15) EndIf EndFunc ;==>_ReadCommands #EndRegion Launch.IT Action on User's search typed ----------------------------------- Func _ErrorIniNotFound() ;MsgBox(4+16,"Error",'Unable to launch application because configuration file "'&@WorkingDir&'\'&$INIFILE&'" does not exist!'&@CRLF&'Do you want to generate default configuration file?') $answer = MsgBox(4+16,"Error - Configuration file not found",'Unable to launch application because configuration file "'&@WorkingDir&'\'&$INIFILE&'" does not exist!'&@CRLF&@CRLF&'Do you want to generate default configuration file?') If $answer==6 Then ;(6 = $IDYES => Button "Yes" clicked) _GenerateDefaultIniFile() Else MsgBox(64,"Exiting program",'As no configuration file was found, the program will now be closed..') Exit EndIf EndFunc ;==>_ErrorIniNotFound Func _GenerateDefaultIniFile() $fh=FileOpen($INIFILE, 2) ;(2 = FO_OVERWRITE) FileWriteLine($fh,';;This file was generated because no configuration file was found (file "'&@WorkingDir&'\'&$INIFILE&'" does not exist)' & @CRLF) FileWriteLine($fh,'[GENERAL.MAINGUI]' & @CRLF) FileWriteLine($fh,'MAINGUI_WIDTH=497' & @CRLF) FileWriteLine($fh,'MAINGUI_HEIGHT=54' & @CRLF) FileWriteLine($fh,'MAINGUI_LEFT=-1' & @CRLF) FileWriteLine($fh,'MAINGUI_TOP=-1' & @CRLF) FileWriteLine($fh,'MAINGUI_IMAGE="skin\GUI.bmp"' & @CRLF) FileWriteLine($fh,'MAINGUI_IMAGE_LEFT=-1' & @CRLF) FileWriteLine($fh,'MAINGUI_IMAGE_TOP=-1' & @CRLF) FileWriteLine($fh,'MAINGUI_ISDRAGGABLE=True' & @CRLF) FileWriteLine($fh,'MAINGUI_ALWAYSONTOP=False' & @CRLF) FileWriteLine($fh,@CRLF) FileWriteLine($fh,'[GENERAL.MINIMIZEDGUI]' & @CRLF) FileWriteLine($fh,'MINIMIZEDGUI_WIDTH=28' & @CRLF) FileWriteLine($fh,'MINIMIZEDGUI_HEIGHT=75' & @CRLF) FileWriteLine($fh,'MINIMIZEDGUI_LEFT=0' & @CRLF) FileWriteLine($fh,'MINIMIZEDGUI_TOP=-1' & @CRLF) FileWriteLine($fh,'MINIMIZEDGUI_IMAGE="skin\GUIMinimized.bmp"' & @CRLF) FileWriteLine($fh,'MINIMIZEDGUI_IMAGE_LEFT=-1' & @CRLF) FileWriteLine($fh,'MINIMIZEDGUI_IMAGE_TOP=-1' & @CRLF) FileWriteLine($fh,@CRLF) FileWriteLine($fh,'[GENERAL.CONTROLS]' & @CRLF) FileWriteLine($fh,'SEARCH_ACTION=2' & @CRLF) FileWriteLine($fh,'SEARCH_INPUT_LEFT=147' & @CRLF) FileWriteLine($fh,'SEARCH_INPUT_TOP=14' & @CRLF) FileWriteLine($fh,'SEARCH_INPUT_HEXCOLOR=0x2D8BC4' & @CRLF) FileWriteLine($fh,'SEARCH_IMAGE="skin\search.bmp"' & @CRLF) FileWriteLine($fh,'SEARCH_BTN_LEFT=418' & @CRLF) FileWriteLine($fh,'SEARCH_BTN_TOP=9' & @CRLF) FileWriteLine($fh,'SEARCH_BTN_WIDTH=41' & @CRLF) FileWriteLine($fh,'SEARCH_BTN_HEIGHT=37' & @CRLF) FileWriteLine($fh,'SETTINGS_IMAGE="skin\settings.bmp"' & @CRLF) FileWriteLine($fh,'SETTINGS_BTN_LEFT=75' & @CRLF) FileWriteLine($fh,'SETTINGS_BTN_TOP=4' & @CRLF) FileWriteLine($fh,'SETTINGS_BTN_WIDTH=52' & @CRLF) FileWriteLine($fh,'SETTINGS_BTN_HEIGHT=45' & @CRLF) FileWriteLine($fh,'MINIMIZE_IMAGE="skin\minimize.bmp"' & @CRLF) FileWriteLine($fh,'MINIMIZE_BTN_LEFT=468' & @CRLF) FileWriteLine($fh,'MINIMIZE_BTN_TOP=7' & @CRLF) FileWriteLine($fh,'MINIMIZE_BTN_WIDTH=23' & @CRLF) FileWriteLine($fh,'MINIMIZE_BTN_HEIGHT=23' & @CRLF) FileWriteLine($fh,'MAXIMIZE_IMAGE="skin\maximize.bmp"' & @CRLF) FileWriteLine($fh,'MAXIMIZE_BTN_LEFT=0' & @CRLF) FileWriteLine($fh,'MAXIMIZE_BTN_TOP=7' & @CRLF) FileWriteLine($fh,'MAXIMIZE_BTN_WIDTH=23' & @CRLF) FileWriteLine($fh,'MAXIMIZE_BTN_HEIGHT=23' & @CRLF) FileWriteLine($fh,@CRLF) FileWriteLine($fh,'[ALIASES]' & @CRLF) FileWriteLine($fh,'ie=iexplore.exe' & @CRLF) FileWriteLine($fh,'cmd=cmd.exe' & @CRLF) FileWriteLine($fh,'calc=calc.exe' & @CRLF) FileWriteLine($fh,'control=control.exe' & @CRLF) FileWriteLine($fh,'regedit=regedit.exe' & @CRLF) FileWriteLine($fh,'taskmgr=taskmgr.exe' & @CRLF) FileWriteLine($fh,'paint=mspaint.exe' & @CRLF) FileWriteLine($fh,'system=msinfo32.exe' & @CRLF) FileWriteLine($fh,'notepad=notepad.exe' & @CRLF) FileWriteLine($fh,'eventvwr=eventvwr.exe' & @CRLF) FileWriteLine($fh,'windows=c:\Windows\' & @CRLF) FileWriteLine($fh,'bing=https://www.bing.com/' & @CRLF) FileWriteLine($fh,'google=https://www.google.com/' & @CRLF) FileWriteLine($fh,'youtube=https://www.youtube.com/' & @CRLF) EndFunc ;==>_GenerateIniFile Func _SelfRestart() If @Compiled = 1 Then Run( FileGetShortName(@ScriptFullPath)) Else Run( FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath)) EndIf Exit EndFunc Func _Contextmenu() $var = IniReadSectionNames(@ScriptDir & "\menuauto.ini") If @error Then MsgBox(4096, "", "Il manque le fichier menuauto.ini " & @ScriptDir & "\menuauto.ini") Else $nbr_section = $var[0] For $j = 1 To $nbr_section $var2 = IniReadSection(@ScriptDir & "\menuauto.ini", $var[$j]) $menu_handle[$j][0] = GUICtrlCreateMenu($var[$j], $idContextmenu) $nbr_cle[$j][0] = $var2[0][0] For $i = 1 To $var2[0][0] $menu_handle[$j][$i] = GUICtrlCreateMenuItem($var2[$i][0], $menu_handle[$j][0]) $nbr_cle[$j][$i] = $var2[$i][1] Next Next EndIf EndFunc ;==>_menu for the ini file : [&Utilitaires] Lancement Malwarebytes=C:\Program Files\Malwarebytes' Anti-Malware\mbam.exe = le signe égal, sans clé devant, va créer une ligne de séparation dans la liste &Déframentation=C:\Program Files\MyDefrag v4.3.1\MyDefrag.exe [&dos] Command=cmd [Sites &internet] Dégrouptest=C:\Program Files\Internet Explorer\IEXPLORE.EXE http://www.degrouptest.com &GOOGLE=C:\Program Files\Internet Explorer\IEXPLORE.EXE http://www.google.fr [&Réseau] Connexion réseau=C:\WINDOWS\system32\rundll32.exe shell32.dll,Control_RunDLL ncpa.cpl [&System] Gestion des disques=mmc.exe c:\windows\system32\diskmgmt.msc Propriété system=C:\WINDOWS\system32\rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl = le signe égal, sans clé devant, va créer une ligne de séparation dans la liste Services=mmc.exe c:\windows\system32\services.msc Observateur d'évènements=mmc.exe c:\windows\system32\eventvwr.msc Dossiers partagés c:\windows\system32\fsmgmt.msc tell me about this modification
  11. Nice work, an impressive demonstration of the capabilities of autoit, i've just implemented a popup style windows (without borders) witch can be moved and a context menu with exit and about, if someone knows how we can cancel the white square of the popup (transparency does'nt work) it would be interresting for exemple... ;the Hilfiker / MobaTime Swiss Railway Clock ;coded by UEZ build 2018-02-16 ;thanks to Eukalyptus for the _CreateBrushedAluminum() function! #pragma compile(Icon, "c:\Program Files (x86)\AutoIt3\Icons\au3.ico") #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/so /pe /rm #AutoIt3Wrapper_Run_After=del /f /q "%scriptdir%\%scriptfile%_stripped.au3" #AutoIt3Wrapper_UseX64=n #include <GDIPlus.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <SendMessage.au3> ;---------------------------added by margforce---------------------- _GDIPlus_Startup() Global $hGUI, $iFPS = 0, $iShowFPS = 0, $bExit Global Const $iW = 500, $iH = $iW, $iWh = $iW / 2, $iHh = $iH / 2, $sTitle = "GDI+ Swiss Railway Clock v1.1" Global Const $fRad = ACos(-1) / 180, $fDeg = 180 / ACos(-1), $iTimer = 30 Global $fMin_next, $hDC, $hCanvas, $hBitmap_Clock, $fDiameter, $hDC_backbuffer, $fShadowAngle Global Const $SC_DRAGMOVE = 0xF012 Global Const $margin = 12; distance from edge of window where dragging is possible---------------------------added by margforce---------------------- AutoItSetOption("GUIOnEventMode", 1) GDIPlus_SwissRailwayClock() AutoItSetOption("GUIOnEventMode", 0) _GDIPlus_Shutdown() ;---------------------------added by margforce---------------------- GUIRegisterMsg($WM_LBUTTONDOWN, "WM_LBUTTONDOWN") func _context_menu() Local $idContextmenu = GUICtrlCreateContextMenu() Local $idNewsubmenu_exit = GUICtrlCreateMenuItem("Exit", $idContextmenu) Local $idNewsubmenu_info = GUICtrlCreateMenuItem("A propos", $idContextmenu) GUICtrlSetOnEvent($idNewsubmenu_exit,"_Exit_about") GUICtrlSetOnEvent($idNewsubmenu_info,"_Apropos") EndFunc Func _move_clock() _SendMessage($hGUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) EndFunc ;---------------------------added by margforce---------------------- Func GDIPlus_SwissRailwayClock() $bExit = False $hGUI = GUICreate($sTitle, $iW, $iH, -1, -1, $WS_POPUP) GUICtrlSetResizing(-1,$GUI_DOCKWIDTH) GUISetBkColor(0xFFFFFF, $hGUI) ;_WinAPI_SetLayeredWindowAttributes( $hGUI, 0xFFFFFF, 255) GUISetState(@SW_SHOW, $hGUI) ;~ GUISetCursor(16, 1) ;create canvas elements $hDC = _WinAPI_GetDC($hGUI) Local Const $hHBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iW, $iH) $hDC_backbuffer = _WinAPI_CreateCompatibleDC($hDC) Local Const $DC_obj = _WinAPI_SelectObject($hDC_backbuffer, $hHBitmap) $hCanvas = _GDIPlus_GraphicsCreateFromHDC($hDC_backbuffer) _GDIPlus_GraphicsSetSmoothingMode($hCanvas, $GDIP_SMOOTHINGMODE_HIGHQUALITY) _GDIPlus_GraphicsSetPixelOffsetMode($hCanvas, $GDIP_PIXELOFFSETMODE_HIGHQUALITY) Local Const $hBrush_Clr = _GDIPlus_BrushCreateSolid(0xFF000000), _ $hBrush_FPS = _GDIPlus_BrushCreateSolid(0xF0808080), _ $hFormat_FPS = _GDIPlus_StringFormatCreate(), _ $hFamily_FPS = _GDIPlus_FontFamilyCreate("Arial"), _ $hFont_FPS = _GDIPlus_FontCreate($hFamily_FPS, 8), _ $tLayout_FPS = _GDIPlus_RectFCreate(0, 0, 60, 16) $fDiameter = $iW $hBitmap_Clock = GenerateClockBg($fDiameter) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit_About") GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "_move_clock");---------------------------added by margforce---------------------- GUISetOnEvent($GUI_EVENT_SECONDARYDOWN, "_context_menu");---------------------------added by margforce---------------------- $fMin_next = @MIN GUIRegisterMsg($WM_TIMER, "Draw") ;$WM_TIMER = 0x0113 DllCall("User32.dll", "int", "SetTimer", "hwnd", $hGUI, "int", 0, "int", $iTimer, "int", 0) Do If $bExit Then ExitLoop Until Not Sleep(100) ;release resources GUIRegisterMsg($WM_TIMER, "") _GDIPlus_FontDispose($hFont_FPS) _GDIPlus_FontFamilyDispose($hFamily_FPS) _GDIPlus_StringFormatDispose($hFormat_FPS) _GDIPlus_BrushDispose($hBrush_Clr) _GDIPlus_BrushDispose($hBrush_FPS) _GDIPlus_GraphicsDispose($hCanvas) _WinAPI_SelectObject($hDC_backbuffer, $DC_obj) _WinAPI_DeleteDC($hDC_backbuffer) _WinAPI_DeleteObject($hHBitmap) _WinAPI_ReleaseDC($hGUI, $hDC) GUIDelete($hGUI) EndFunc ;==>GDIPlus_SwissRailwayClock Func Draw() _GDIPlus_GraphicsDrawImageRect($hCanvas, $hBitmap_Clock, 0, 0, $fDiameter, $fDiameter) UpdateClock($hCanvas, $fDiameter) _WinAPI_BitBlt($hDC, 0, 0, $iW, $iH, $hDC_backbuffer, 0, 0, $SRCCOPY) EndFunc Func _Exit_About() $bExit = True EndFunc ;==>_Exit_About Func UpdateClock($hGfx, $fDiameter) Local Const $fRadius = $fDiameter / 2, $hBrush_Shadow = _GDIPlus_BrushCreateSolid(0x18A8A8A8) Local $fSec, $fMin, $fHr Static $bBounce = 0, $f = 0, $fAmplitude = 3 Local $m1 = $fDiameter * 0.015 ;hour $fHr = 30 * (@HOUR + @MIN / 60) _GDIPlus_GraphicsTranslateTransform($hGfx, $fRadius, $fRadius) _GDIPlus_GraphicsRotateTransform($hGfx, $fHr) _GDIPlus_GraphicsTranslateTransform($hGfx, -$fRadius, -$fRadius) Local Const $hBrush = _GDIPlus_BrushCreateSolid(0xFF101010) Local $iWidth1 = $fDiameter * 0.0375, _ $iHeight1 = $fDiameter / 2.5, _ $iWidth12 = $iWidth1 / 2, _ $fPosY = $fDiameter * 0.2, $iWidth2, $iWidth22, $fPosY2 DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush_Shadow, _ "float", $fRadius - $iWidth12 + Cos(($fShadowAngle - $fHr) * $fRad) * $m1, _ "float", $fPosY + Sin(($fShadowAngle - $fHr) * $fRad) * $m1, _ "float", $iWidth1, "float", $iHeight1) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush, _ "float", $fRadius - $iWidth12, _ "float", $fPosY, _ "float", $iWidth1, "float", $iHeight1) _GDIPlus_GraphicsResetTransform($hGfx) ;min If $fMin_next <> @MIN Then $bBounce = 1 Switch $bBounce Case 1 $fMin = (6 * Mod(($fMin_next + 1), 60)) + Sin($f * 1.9) * $fAmplitude If $fAmplitude = 0 Then $fMin_next = @MIN $f = 0 $fAmplitude = 3 $bBounce = 0 Else $fAmplitude -= 0.5 $fAmplitude = $fAmplitude <= 0 ? 0 : $fAmplitude $f += 1 EndIf Case Else $fMin = (6 * @MIN) EndSwitch _GDIPlus_GraphicsTranslateTransform($hGfx, $fRadius, $fRadius) _GDIPlus_GraphicsRotateTransform($hGfx, $fMin) _GDIPlus_GraphicsTranslateTransform($hGfx, -$fRadius, -$fRadius) $iWidth1 = $fDiameter * 0.03 $iHeight1 = $fRadius $iWidth12 = $iWidth1 / 2 $fPosY = $fDiameter * 0.1 DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush_Shadow, _ "float", $fRadius - $iWidth12 + Cos(($fShadowAngle - $fMin) * $fRad) * $m1, _ "float", $fPosY + Sin(($fShadowAngle - $fMin) * $fRad) * $m1, _ "float", $iWidth1, "float", $iHeight1) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush, _ "float", $fRadius - $iWidth12, _ "float", $fPosY, _ "float", $iWidth1, "float", $iHeight1) _GDIPlus_GraphicsResetTransform($hGfx) ;sec $fSec = 6 * (@SEC * 1.02564 + @MSEC / 1000) If $fSec >= 360 Then $fSec = 0 _GDIPlus_GraphicsTranslateTransform($hGfx, $fRadius, $fRadius) _GDIPlus_GraphicsRotateTransform($hGfx, $fSec) _GDIPlus_GraphicsTranslateTransform($hGfx, -$fRadius, -$fRadius) $fPosY = $fDiameter * 0.27 $fPosY2 = $fDiameter * 0.19 $iWidth1 = $fDiameter * 0.0095 $iHeight1 = $fRadius * 1.3 - $fPosY $iWidth12 = $iWidth1 / 2 $iWidth2 = $fDiameter * 0.083333 $iWidth22 = $iWidth2 / 2 ;shadow seconds DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush_Shadow, _ "float", $fRadius + Cos(($fShadowAngle - $fSec) * $fRad) * $m1, _ "float", $fPosY + Sin(($fShadowAngle - $fSec) * $fRad) * $m1, _ "float", $iWidth1 + $fDiameter * 0.006667, "float", $iHeight1 + $fDiameter * 0.006667) DllCall($__g_hGDIPDll, "int", "GdipFillEllipse", "handle", $hGfx, "handle", $hBrush_Shadow, _ "float", $fRadius - $iWidth22 + Cos(($fShadowAngle - $fSec) * $fRad) * $m1, _ "float", $fPosY2 + Sin(($fShadowAngle - $fSec) * $fRad) * $m1, _ "float", $iWidth2, "float", $iWidth2) ;seconds _GDIPlus_BrushSetSolidColor($hBrush, 0xF8C01010) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush, _ "float", $fRadius - $iWidth12, _ "float", $fPosY, _ "float", $iWidth1, "float", $iHeight1) DllCall($__g_hGDIPDll, "int", "GdipFillEllipse", "handle", $hGfx, "handle", $hBrush, _ "float", $fRadius - $iWidth22, _ "float", $fPosY2, _ "float", $iWidth2, "float", $iWidth2) _GDIPlus_GraphicsResetTransform($hGfx) Local Const $hPen = _GDIPlus_PenCreate(0xFFA02020) DllCall($__g_hGDIPDll, "int", "GdipFillEllipse", "handle", $hGfx, "handle", $hBrush, _ "float", $fRadius - $iWidth1, _ "float", $fRadius - $iWidth1, _ "float", 2 * $iWidth1, "float", 2 * $iWidth1) DllCall($__g_hGDIPDll, "int", "GdipDrawEllipse", "handle", $hGfx, "handle", $hPen, _ "float", $fRadius - $iWidth1, _ "float", $fRadius - $iWidth1, _ "float", 2 * $iWidth1, "float", 2 * $iWidth1) _GDIPlus_PenDispose($hPen) _GDIPlus_BrushDispose($hBrush) _GDIPlus_BrushDispose($hBrush_Shadow) EndFunc Func GenerateClockBg($fDiameter) Local Const $hBitmap = _GDIPlus_BitmapCreateFromScan0($fDiameter, $fDiameter), $hGfx = _GDIPlus_ImageGetGraphicsContext($hBitmap), _ $hBrush = _GDIPlus_BrushCreateSolid(0xFF000000), $hPen = _GDIPlus_PenCreate(0xFF000000), _ $hEffect = _GDIPlus_EffectCreateBlur(10.5, 0), $fBorderSize = $fDiameter * 0.03333 _GDIPlus_GraphicsSetSmoothingMode($hGfx, 4) _GDIPlus_GraphicsSetPixelOffsetMode($hGfx, 4) _GDIPlus_GraphicsSetTextRenderingHint($hGfx, 4) _GDIPlus_GraphicsClear($hGfx, 0xFFFFFFFF) _GDIPlus_PenSetColor($hPen, 0xA0000000) _GDIPlus_PenSetWidth($hPen, $fBorderSize) Local Const $fSize = $fDiameter * 0.95 - $fBorderSize / 2, $fRadius = $fDiameter / 2 Local $fShadow_vx = $fDiameter * 0.0095, $fShadow_vy = $fDiameter * 0.01 $fShadowAngle = ATan($fShadow_vy / $fShadow_vx) * $fDeg If $fShadow_vx < 0 And $fShadow_vy >= 0 Then $fShadowAngle += 180 If $fShadow_vx < 0 And $fShadow_vy < 0 Then $fShadowAngle -= 180 _GDIPlus_GraphicsDrawEllipse($hGfx, $fBorderSize + $fShadow_vx, $fBorderSize + $fShadow_vy, $fSize, $fSize, $hPen) _GDIPlus_BitmapApplyEffect($hBitmap, $hEffect) _GDIPlus_PenSetColor($hPen, 0xF0000000) Local Const $hBitmap_Texture = _CreateBrushedAluminum($fDiameter, $fDiameter, $fShadowAngle) Local Const $hTexture = _GDIPlus_TextureCreate($hBitmap_Texture) DllCall($__g_hGDIPDll, "int", "GdipSetPenBrushFill", "ptr", $hPen, "ptr", $hTexture) _GDIPlus_GraphicsDrawEllipse($hGfx, $fBorderSize, $fBorderSize, $fSize, $fSize, $hPen) _GDIPlus_GraphicsTranslateTransform($hGfx, $fRadius, $fRadius) _GDIPlus_GraphicsRotateTransform($hGfx, -6) _GDIPlus_GraphicsTranslateTransform($hGfx, -$fRadius, -$fRadius) Local $iWidth1 = $fDiameter * 0.026667, $iHeight1 = $fDiameter / 10, $iWidth12 = $iWidth1 / 2, $fPosY = $fDiameter * 0.083333, _ $iWidth2 = $fDiameter * 0.013333, $iHeight2 = $fDiameter * 0.0416667, $iWidth22 = $iWidth2 / 2 For $i = 0 to 59 _GDIPlus_GraphicsTranslateTransform($hGfx, $fRadius, $fRadius) _GDIPlus_GraphicsRotateTransform($hGfx, 6) _GDIPlus_GraphicsTranslateTransform($hGfx, -$fRadius, -$fRadius) Switch Mod($i, 5) Case 0 _GDIPlus_GraphicsFillRect($hGfx, $fRadius - $iWidth12, $fPosY, $iWidth1, $iHeight1, $hBrush) Case Else _GDIPlus_GraphicsFillRect($hGfx, $fRadius - $iWidth22, $fPosY, $iWidth2, $iHeight2, $hBrush) EndSwitch Next _GDIPlus_GraphicsResetTransform($hGfx) Local Const $hBitmap_Logo = _GDIPlus_BitmapCreateFromMemory(_Au3_Icon()) Local Const $hBitmap_Logo_Scaled = _GDIPlus_ImageResize($hBitmap_Logo, $fDiameter * 0.08, $fDiameter * 0.08) Local $aDim = _GDIPlus_ImageGetDimension($hBitmap_Logo_Scaled) _GDIPlus_GraphicsDrawImageRect($hGfx, $hBitmap_Logo_Scaled, $fRadius - $aDim[0] / 2, $fRadius / 1.75, $aDim[0], $aDim[1]) _GDIPlus_ImageDispose($hBitmap_Logo) _GDIPlus_ImageDispose($hBitmap_Logo_Scaled) Local Const $hFamily = _GDIPlus_FontFamilyCreate("Segoe Script"), $hFont = _GDIPlus_FontCreate($hFamily, $fDiameter * 0.025), $hFormat = _GDIPlus_StringFormatCreate() _GDIPlus_StringFormatSetAlign($hFormat, 1) _GDIPlus_StringFormatSetLineAlign($hFormat, 1) ;~ _GDIPlus_BrushSetSolidColor($hBrush, 0xFF400000) _GDIPlus_GraphicsDrawStringEx($hGfx, "Clock by" & @CRLF & "UEZ", $hFont, _GDIPlus_RectFCreate($fRadius - $fRadius * 0.2, $fRadius + $fRadius * 0.2, $fRadius * 0.4, $fRadius * 0.4), $hFormat, $hBrush) _GDIPlus_ImageDispose($hBitmap_Texture) _GDIPlus_BrushDispose($hTexture) _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_EffectDispose($hEffect) _GDIPlus_PenDispose($hPen) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGfx) Return $hBitmap EndFunc Func _CreateBrushedAluminum($iW, $iH, $fLightAngle = 40, $iBlurDist = 12, $fBlurTrans = 0.6666, $fRed = 0.8, $fGreen = 0.9, $fBlue = 1, $iLightColor = 0xF0FFFFFF, $fLightSigma = 0.5, $fLightScale = 0.83) ;coded by Eukalyptus! $iBlurDist = Ceiling($iBlurDist) $iBlurDist += 1 - Mod($iBlurDist, 2) Local $iOverSize = 0 For $i = 1 To $iBlurDist Step 2 $iOverSize += $i + $i + 1 Next Local $iWO = $iW + $iOverSize ;========================================= ; Add Noise ;========================================= Local $iNoiseSize = 40 Local $hBmp_Noise = _GDIPlus_BitmapCreateFromScan0($iNoiseSize, $iNoiseSize) Local $hGfx_Noise = _GDIPlus_ImageGetGraphicsContext($hBmp_Noise) Local $tData = _GDIPlus_BitmapLockBits($hBmp_Noise, 0, 0, $iNoiseSize, $iNoiseSize, BitOR($GDIP_ILMREAD, $GDIP_ILMWRITE), $GDIP_PXF32ARGB) Local $iStride = DllStructGetData($tData, "Stride") Local $iWidth = DllStructGetData($tData, "Width") Local $iHeight = DllStructGetData($tData, "Height") Local $pScan0 = DllStructGetData($tData, "Scan0") Local $tPixel = DllStructCreate("dword[" & $iWidth * $iHeight & "];", $pScan0) Local $iAmp For $row = 0 To $iHeight - 1 For $col = 0 To $iWidth - 1 $iAmp = Random(0, 0xFF, 1) DllStructSetData($tPixel, 1, BitOR(0xFF000000, BitShift($iAmp, -16), BitShift($iAmp, -8), $iAmp), $row * $iWidth + $col + 1) Next Next _GDIPlus_BitmapUnlockBits($hBmp_Noise, $tData) ;========================================= ; Create Full NoiseBitmap ;========================================= Local $hBmp_Full = _GDIPlus_BitmapCreateFromScan0($iWO, $iH) Local $hGfx_Full = _GDIPlus_ImageGetGraphicsContext($hBmp_Full) _GDIPlus_GraphicsSetSmoothingMode($hGfx_Full, 4) _GDIPlus_GraphicsSetInterpolationMode($hGfx_Full, 3) Local $iXOff, $iYOff, $iSizeX, $iSizeY For $y = 0 To $iH Step $iNoiseSize / 2 For $x = 0 To $iWO Step $iNoiseSize / 2 $iXOff = Random(0, $iNoiseSize / 2, 1) $iYOff = Random(0, $iNoiseSize / 2, 1) $iSizeX = $iNoiseSize - $iXOff $iSizeY = $iNoiseSize - $iYOff _GDIPlus_GraphicsDrawImageRectRect($hGfx_Full, $hBmp_Noise, $iXOff, $iYOff, $iSizeX, $iSizeY, $x, $y, $iSizeX, $iSizeY) Next Next _GDIPlus_GraphicsDispose($hGfx_Noise) _GDIPlus_BitmapDispose($hBmp_Noise) ;========================================= ; MotionBlur ;========================================= Local $hBmp_Full2 = _GDIPlus_BitmapCreateFromScan0($iWO, $iH) Local $hGfx_Full2 = _GDIPlus_ImageGetGraphicsContext($hBmp_Full2) _GDIPlus_GraphicsSetSmoothingMode($hGfx_Full2, 4) _GDIPlus_GraphicsSetInterpolationMode($hGfx_Full, 3) Local $tColorMatrix = DllStructCreate("float[5]; float[5]; float[5]; float[5]; float[5];") DllStructSetData($tColorMatrix, 1, 1, 1) DllStructSetData($tColorMatrix, 2, 1, 2) DllStructSetData($tColorMatrix, 3, 1, 3) DllStructSetData($tColorMatrix, 4, $fBlurTrans, 4) DllStructSetData($tColorMatrix, 5, 1, 5) Local $hImgAttrib = _GDIPlus_ImageAttributesCreate() DllCall($__g_hGDIPDll, "int", "GdipSetImageAttributesColorMatrix", "ptr", $hImgAttrib, "int", 1, "int", 1, "struct*", $tColorMatrix, "struct*", 0, "int", 0) For $i = 1 To $iBlurDist Step 2 DllCall($__g_hGDIPDll, "int", "GdipDrawImageRectRect", "ptr", $hGfx_Full2, "ptr", $hBmp_Full, _ "float", $i, "float", 0, "float", $iWO, "float", $iH, _ "float", 0, "float", 0, "float", $iWO, "float", $iH, _ "int", 2, "ptr", $hImgAttrib, "ptr", 0, "ptr", 0) If $i >= $iBlurDist Then DllStructSetData($tColorMatrix, 1, $fRed, 1) DllStructSetData($tColorMatrix, 2, $fGreen, 2) DllStructSetData($tColorMatrix, 3, $fBlue, 3) DllStructSetData($tColorMatrix, 4, 1, 4) DllCall($__g_hGDIPDll, "int", "GdipSetImageAttributesColorMatrix", "ptr", $hImgAttrib, "int", 1, "int", 1, "struct*", $tColorMatrix, "struct*", 0, "int", 0) EndIf DllCall($__g_hGDIPDll, "int", "GdipDrawImageRectRect", "ptr", $hGfx_Full, "ptr", $hBmp_Full2, _ "float", $i + 1, "float", 0, "float", $iWO, "float", $iH, _ "float", 0, "float", 0, "float", $iWO, "float", $iH, _ "int", 2, "ptr", $hImgAttrib, "ptr", 0, "ptr", 0) Next _GDIPlus_ImageAttributesDispose($hImgAttrib) _GDIPlus_GraphicsDispose($hGfx_Full2) _GDIPlus_BitmapDispose($hBmp_Full2) _GDIPlus_GraphicsDispose($hGfx_Full) ;========================================= ; Add Light ;========================================= Local $hBmp_Alu = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Local $hGfx_Alu = _GDIPlus_ImageGetGraphicsContext($hBmp_Alu) _GDIPlus_GraphicsSetSmoothingMode($hGfx_Alu, 4) _GDIPlus_GraphicsSetInterpolationMode($hGfx_Full, 3) _GDIPlus_GraphicsDrawImage($hGfx_Alu, $hBmp_Full, -$iOverSize, 0) _GDIPlus_BitmapDispose($hBmp_Full) Local $tPointF1 = DllStructCreate("float; float;") Local $tPointF2 = DllStructCreate("float; float;") DllStructSetData($tPointF2, 2, $iH * $fLightScale) $aResult = DllCall($__g_hGDIPDll, "int", "GdipCreateLineBrush", "struct*", $tPointF1, "struct*", $tPointF2, "uint", 0, "uint", $iLightColor, "int", 0, "handle*", 0) If @error Or Not IsArray($aResult) Then Return SetError(1, 4, False) Local $hBrush = $aResult[6] _GDIPlus_LineBrushSetSigmaBlend($hBrush, $fLightSigma) _GDIPlus_LineBrushSetGammaCorrection($hBrush) DllCall($__g_hGDIPDll, "int", "GdipRotateLineTransform", "ptr", $hBrush, "float", $fLightAngle, "int", 0) _GDIPlus_GraphicsFillRect($hGfx_Alu, 0, 0, $iW, $iH, $hBrush) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGfx_Alu) Return $hBmp_Alu EndFunc ;==>_CreateBrushedAluminum ;Code below was generated by: 'File to Base64 String' Code Generator v1.20 Build 2018-02-02 Func _Au3_Icon($bSaveBinary = False, $sSavePath = @ScriptDir) Local $Au3_Icon $Au3_Icon &= 'iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAP0ElEQVR4XtWZW4hs6VXHf+v79qWquruquqtvZ/r0uc8540yScTIQQ0JkDOYyGhIkhhAxxhdR8mDAgAg+6FsE9UVffNMH8S0ERAwS1DFeEo3m6owzmUySc+Zc+15VXZd9+dZyp6ro4pDTORlGIfnDn703TW/+//X9v/Wt3i3PPfccP85w/GhBgLqkS23ixhpRfau6bgItIPpRN5Ag0Xl88jYrxu/E+KA492E0vJd44d245BKQ/H8bkAe80wMOEE5HA5c8SpQ822yv/ubW9vnfffyxR3+vs7r6YcS9HewZnP9ZXPwE0Py/NuCBJj65iERvQPybcNFP4JKzuPgq+CeR6GnwV3FJB4juM+mSNj55Ehe97/LFC5947PL2ey5tb755daW1+fiVc295+qk3fuTShfPPPnb10d+J60sfI6o9BbRer4EIaOLis1Nh6dtBfs6ljY82ljqfiNLFX8X597uk/ksrG4/8ftJo/lq62P51XPQOJHoc3DV8egZYxLkLcW3xQ088fvWTj2ysXItjnxRlGY6Ojmxvb98iJwtnz6xeXO80tx+9tP0Rcf6tuHhzLuS1YwmJLiHuslRVbzQbjydJsrXSbl4RIVlpLZ0xM71+e+cbC41a+8zayuVxlo9CCPnX/vslt7S89iEzy4/7R/+MT7+Lhq2V5dbbO63Ftbwog/feDYdDt7e3R71eo9vt2tbWlkZRRC1NFkHWQDpACmQ/bBuVWUyaiN+Kk9oH2q3mO/Ky0HNn1p9sNxeaBpiBmpl3TlTNqouoqkmFoKp5XuT1NKlVFS5ffOXm54ui2EFIr17afudCLV1SM5mBity+fRuAzc1NVC1EkfN3dg+/9e1vf/ePMfssYXz9hzXQJKo/BTyKlovrZ7Y+fPXi1luryubOOeKqPBpKQiilLAMhBAwEw7x3RN9jFImPIhTR8TjPQghFvZY2s7wY pkmc' $Au3_Icon &= 'Ag5ARFBVuXHjBpVPqurTaDRMVRERQgjll776wp9YKP+KMP5a9NCsS7SBuHMgb2stt9+13FraXltubYegmkRRMh4POTwccdAbMy4CQTFDBBEDABMvYmnirNVIaC3UpVFP667WqFdmrRLfYA7MDIBWq0WaplQRIo5j8d6bVvDOxbV6fXV03C0BeYgBvyxx7R1prfbs2srym8+e6bxhtrwMjnt276Bv3UGOuYQ4bVCrJ1JVWtxEvxO0xBHIiiBVpbnbLexetysLidjmygKLCwsYzjATwACpQK/XY2VlBTNjZ2cHVTXvvYkgg3F2lI2z2+ByIEScjgRx23GSPvPU41d+BQE1zMqCnb197h2NxCeLttBeliiOmCUGDIIJFgIbzYh2IyUoqBrHo0LuHQ4ozMl37g1sqTaUrdWWJbW6haAChnOOPM/Z3d1lNBpRVX/CEJTIOxkOs2Mt8z4iAHa6ARdvVnzL+a3NnzfMVNEyz/z1Wzt2XHgWW+tUwkUV8tKYlQ81IZLA9nJMI40IaohAFAnLSxHeSm7sDWi0VuR4cMxLN/fl0maLxsICqlRUVldXOTg4IEkSOp2OVUAE1Iz+YLSHyAAYndZGE1yyAXqt1Wq/b3Vl6WxQC/lo4F5+dccK15Dmchs1yEpAHCAwEe+IKbm8GhN5T6mKEwGmwgAWFxdYHo7Y6fdoLDUZDz0vvnrI1S1lYXEJnRmuhANYBalozolT1dDt97+Chq+j+f6DDUh0Bh8/k9br7754buOng5oW2ci9fGNHxtRoLrbIgwEecw5sasAQRAPnVx3eC0UIE/FmxhxgwMZqm1G+T/d4SL3eoAzKizcPefycUG8soqqEEAxMzFARIcvL8fWbO18YH/c+DfICcPwgA4JZa2lp6b3XLp39kK8QQtBbd/ZlUIgttJakNFA8OIeZQ5hVPyhnm0Y9dpTBEMDMeBBMPGc6i/RvdRnnCVWTIMvHfPPWEU+c97iohpmad47jcda/u3Pw /MHh' $Au3_Icon &= '0b+Zll8GfREtd08bJSJ81DgeDO6WQYOBHh3uy04/M5c0RCaxEBSHmsNMUKBUo5Uo6w0hVwEzToOZQcW01uCR5ZQym2zqSRcbZyW39gdgATPEgLu7hy/v7+3+jWn5GUz/Hi1vAPagUaKGS65geqndbD2ZJnE8Hh3bzb0BuFgkignq0FnmMWaCIHElFzuO0jwOQ+bR+YFGaomHMJyumIvAp1RdirVmnaRWMxGcqwi2i9mrhGyHOe43gEQrLq698+wj6x9f77SvWYVefyjjgOBjwKMiGG4uXsBZydU1jyGoKhpK8iLHe08cJ4gID4aAAhZQA8GBj7Gi4Ob+gMuPREBCGUKJWQNYBASw08bpBbDVtZXWNQPLs6FVvV6QyHAROmuRChigCGjg0rIjdTqpYlHk3L5zl2rO4Tu39iZmDDCzCZnfT4gTmL8PnAMXczTIyPOAqlk1JJ73Sf2NOH9pZoIHGYiApXqjcQVMMXQ8GssoV8NFgngMhyLA1IgLGRfa0K4beZCJ2J3dXfa7Q6I4pV9E3D0YYmV2f/7n90RRTC1yWChQExAPPsJUORzkTjVYNaVuXLm0/UHEXcDXaqcZSBBZi6NoAwRMGWUlhkzE4zwgqBoGYIGzLWG1rmQlOIHjfo+j45z11RUKE6ivcHsYca+bI9j0d21OMMR5Uq9okaEA4k5YGTBMKVV1MBwfYhpVbJy+AuKaYJEZqAbpjQoQx5yCMTspG8ZG05Opm4kL9IYZucJOd0AZL4G4yQgQxTXAMO6PkAF5NqY/KjAXA8LcgGecl6JBEcH1+sd3QFpA68EGosbC7IfxNNqlZaWdCAem92Y0IuXiMuQB5EQUdNotttY7bK52OL+6yLWO8pObsLboCMr3nws2NZAFAZ8whZwY0aAoAoY16rVVIIAVD+5CpklVqcvVmHwFM1TVBTU5GRNwiBnLDcfVjpIHB6bMAbVaQqNeQ8RQVcBRmCGnHWYYWZ5jEoGraDoTP6WpEYKK 91YV' $Au3_Icon &= 'pX1ld+/Ah6zonxYhFCsXGumqqk2fDDspCkanIVxbKRkHh6l+X09XNcoQKEolmKAnwgUDzO7fyKZKVgTwMYh7gEFsQtNw697BC6HIR4ic0oUEESQKqkFEHCYmjpMe5zAudCLGFoHp97dDQEQwZmbKchqPYZ9B/4DxoIdqeSJezQhlwTAvwaecQDiBiMwe8cvtxS0fpxfAWoB7QIQoQlm8/NIrNz9z7fLZ94vzSeycZaWJYDzxSB1MmW2q+0TrieAReZ6RF4FRHhgXSqEQJkl0PLadkiR+ZkIIoWCUGdRjmB/rJxQRvBfMQIwESEGSmQG930AY7+HS5/N8fCXPy6KeuiSNnR2Pc1mqJ5ONOywU78BsLjwfjRj0e5NO0s+UIH5aUV+HKJlm21fUkkwhwVAzBCiLgmCAiwG7n6b4yIub6VcsA7uO6Q4QHjRKFGg5rObzs/VasmiqZZr4qJrd7bGtBcnyAifzHIeg9LoH7B70GWoEyRIsLEzFu1nnMuaVRRjmBUupYgrihLIsURyIZ155nVIDjSRR50Sq9tx7+ZXrf46Gf8TKm4CdMguJz4uil+fFKIp80lxo2NZ6g+oZVQXmq9w9OuDmzhFaW4HFzrTSGNicU9hJsPMAmAIOwyjLAM7PzOr9xGgvpZhBvz/aE/HerMiA0WldSIGeqXZFJC6Dulq9ThmChBAwM0wVMxgOj7m730NrHVhYB+fAwikjtIAACGqAKjp7V1AD8QD3VZ5Q4H1kywux5EXQ732Ra7eab0I1AO40AyCupxpe2T/qf9P7yMTUiqKwk9YnMhnWDg+PyKUOjc682gg/EMJ8jzKFqoG4k8xjYUot6LQagikGriyDdnv9zyNyBJSnG9C8b0X2D3mpN9MkcveJB1SV7tE+B4MwFY8ADxEv833pBEwAM8bjMaNxBshcvJYQcpyPbKtTpyjNIufk7l73q1qMvoiVuwCnGRAgixvNKxe21t+VZVlpZq6izA4pBsd9dg5H kDZn' $Au3_Icon &= 'J2eYb9RTMPdn1GLBcJhN33WUCcQNCMWEUwMF2+st0RCsAkf94W7/ePAVzO4Ag1MNzNDcPrP+B2aBEALARLzBJDp7B10CHnwCIQct59l/iAlBaUSgBoJRBp2KdxHo7F3FiFaraZ0Fb3kRDCyr/pz8pyIbfRa4B+hpBhLAti9cfmahnjyd53kBRFYBwFSt1+vZOC8hSkHnFZsygCmg87zcvwSIMR2bDcyUrFSAaSFCCeWIWr1hV9YbMspKjSPnrt/e/fdsNPg7TL9xWnyYn2qkYL/ovVPVWVLNBGA4HNLrDzmz1rbVVsMIGRVtugoFWDE3MjMzp4HmRGSIQBXNybfOLC/BbGqgGFq93uCJc21GeaFR5P0oK3pl0Bugz6P57R+U0wgoN7fO/8Zyq/nRooJhEYZUsLIsqDqA1Bs1lpotW9IgiXfcORqJlSNwCfgIxE84H78FYHofCupRCfjJp8K9wz4BD24SQVtpt+XiRsOqTY2A6/aGt1+9c+8vLBSfI4RXgIzTQQSki43axzHVEILI/Eua9fsDd9TtXd/c2Iy9d49kQfP2YhotNWJ5dW/EMJusguBicBMTcwPCFKqYQCgDg1FGXhqIWpQmnD/Tpplig9EYAesNsnu37tz7S9Pw14Tsf4AeD0F0/tLlReekphoEEDAB0SzL5ODoqI/qn+0e9ZezUp9dbjbOJ/W0aRAurNUlK+vubndsw6zAilwQARy4+SqIlZShIGt2LIQgca1h651l1tt1iqKQ42EIceTdzn7v+b39/U+L889j4VtT8Q+HfOUbL3zq7Ob6J800VlWbfR3W3b193z06/EPEfwoXP+ai+BdWO+0PFEXIq/3wBjAwVGazd29U0q+YFYGghjFF7KDmApVGGQ2PbWOtI1WzIC8Vg1Bp94fdwau37+78KdhzaHgFLbpA4OEgwmzNmPR8RCZDVuj2elG3e/S5NIn/KMuLQyR+Ucv80zs7ey+BbVVinIjUVpcXL816O826 13Zd' $Au3_Icon &= 'gMTEOQcCqIo4RlkpVRu2Uk129w8DneWxeO9v3N79l+pCnuVfxvRfCdkLwIDXAPnSf33tU+fOnvktEXNFUUi1af3e3sHXNRQfA746P0+p4eJlxJ9D5I3OR09fPnfml6vD5m6rubCdRC4FAUDNdDTOe977ej2NUjOjdzxgNBwVh73h3/ooGXrvk2w8esE0PI9Nus11oM9rhHzhi//xtpXV1c+msW92uz0ODw6fA/1t4Es8GDEu3kDcFRclP6Ua2nGcbMdxvI4hzossLdQvAeRFeS/Liv00jddUtej2Bs9pKP4TDYdgOdBD3C4h2wcCrx1M/8kn7j2Y/gxwM03Tz2RZdouHo4GLOuA2EGliNBGpY3qM8+uAoeV3MBvjXBucTJ5dfIcwGgIGlIDxOjAx8DrhgQioEdUjxCmmEQDlaDATGTPF+JRKv24Dbp71GX9M8L84Jo46QVTs6gAAAABJRU5ErkJggg==' Local $bString = _WinAPI_Base64Decode($Au3_Icon) If @error Then Return SetError(1, 0, 0) $bString = Binary($bString) If $bSaveBinary Then Local Const $hFile = FileOpen($sSavePath & "\au3-icon2.png", 18) If @error Then Return SetError(2, 0, $bString) FileWrite($hFile, $bString) FileClose($hFile) EndIf Return $bString EndFunc ;==>_Au3_Icon Func _WinAPI_Base64Decode($sB64String) Local $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "ptr", 0, "dword*", 0, "ptr", 0, "ptr", 0) If @error Or Not $aCrypt[0] Then Return SetError(1, 0, "") Local $bBuffer = DllStructCreate("byte[" & $aCrypt[5] & "]") $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "struct*", $bBuffer, "dword*", $aCrypt[5], "ptr", 0, "ptr", 0) If @error Or Not $aCrypt[0] Then Return SetError(2, 0, "") Return DllStructGetData($bBuffer, 1) EndFunc ;==>_WinAPI_Base64Decode ;---------------------------added by margforce---------------------- Func GetMousePosType() Local $cp = GUIGetCursorInfo() Local $wp = WinGetPos($hGUI) Local $side = 0 Local $TopBot = 0 Local $curs If $cp[0] < $margin Then $side = 1 If $cp[0] > $wp[2] - $margin Then $side = 2 If $cp[1] < $margin Then $TopBot = 3 If $cp[1] > $wp[3] - $margin Then $TopBot = 6 Return $side + $TopBot EndFunc ;==>GetMousePosType func _Apropos() Msgbox(64,"The Hilfiker / MobaTime Swiss Railway Clock", "Coded by UEZ build 2018-02-16" & @CRLF & "Thanks to Eukalyptus for the _CreateBrushedAluminum() function! " & @CRLF & "Popup style & context menu by Marcgforce") EndFunc Func WM_LBUTTONDOWN($hWnd, $iMsg, $StartWIndowPosaram, $lParam) Local $drag = GetMousePosType() If $drag > 0 Then MSGBOX(0,'',"test") DllCall("user32.dll", "long", "SendMessage", "hwnd", $hWnd, "int", $WM_SYSCOMMAND, "int", 0xF000 + $drag, "int", 0) EndIf EndFunc ;==>WM_LBUTTONDOWN ;---------------------------added by margforce----------------------
  12. Hello, Nice script but something is wrong, because when you click rapidly on the mole and kill it, it does not move until you stop cliking madly, so its easy to make a god score and having 99% i tried to find a solution but nothing works like it would. if someone understand the problem and find a way out it will be a very good game...
  13. if i remeber it was a update of flashplayer
  14. Hello guys, tested and aproved, simply one things to ad : #RequireAdmin because of a crash line 75 trying to dl with an user profile have a nice developpement
  15. Nice script, really usefull, but missing a context menu or button to minimize or send to tray, because it takes a very big part of screen. Thanks for your job
×
×
  • Create New...