Jump to content

Launch.IT - App Launcher


Taskms4
 Share

Recommended Posts

Description:  Launch.IT is a simple & moddable/hackable Windows App-Launcher (like MacOS' Spotlight)

Features:

  • A lot of customizations (background-pics, colors, position, etc...) can be made via the ".ini" file
  • You can add aliases in the ".ini" file to launch apps/files and browse url/folders
  • Make use of its 5 functionalities: App launcher (and files/url/path browser), Windows search (find results from your files and folder), Windows Run, DOS commands execution (command prompt), and Google Search
  • It has some embeeded commands like '::help' to display Launch.IT help window
  • Use hotkeys like {Shift}+{Esc} to switch between minimized and default/maximized GUI or {Esc} to exit program.

Screenshots:

 GUI Overview

GUI on desktop

Launch.IT Usage & Customized GUI example

Download:

Launch.IT.zip

 

Launch.IT in brief:

Originally, the aim of this tool was to implement an alternative to Apple's Spotlight (provided along with MacOS) in my Professional Win7 PC for more convenience (and by laziness XD).
Now, I'm using this tool (which I have completely customized to add further functionalities like Calculator, Remote-Desktop, SSH, etc...) every day at work on a Win10 PC. And believe it or not, this makes me saving an incredible amount of time.

 

Like me, do not hesitate to rework the code to add functionalities and modify Launch.IT behaviour.
I hope you'll like it :)

 

Edited by Taskms4
Link to comment
Share on other sites

Very nice and useful. could it add parameters for the shortcuts for example cmd=cmd.exe "ipconfig all"? I tried but did not work. I have not too time to check source code yet.

 

Saludos 

Link to comment
Share on other sites

Hey,

Thanks for the feedback, it's a feature I wanted to add to but honestly I did not had the time to do it (yet?).. :)

EDIT: For the example you provided, your alternative is to use the command  ::c ipconfig all , for other cases you will probably need to modify the source code (at least for the moment)

Edited by Taskms4
Link to comment
Share on other sites

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

Link to comment
Share on other sites

Hi guys,

On 10/14/2018 at 2:35 PM, marcgforce said:

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.

Interesting idea, thanks for sharing! 

 

On 10/15/2018 at 6:02 AM, Mannyfresh31 said:

you should add the 498 and 55 to the source like down below otherwise the pic looks weird
$GUIPic=GUICtrlCreatePic($GUI_IMG, $GUI_IMG_LEFT, $GUI_IMG_TOP,498,55,-1)

What do you mean by the pic looks strange?  Nothing changes for me.. What is your Windows version you're running?
Thanks for noticing though, many other people may have the same "glitch"...

Link to comment
Share on other sites

  • 1 year later...

Hi, This is awesome help simplifies so many things, But the issues i see is that script does not "always be on top". Even after enabling the settings in Ini.file

I have a desktop UWP app, when launched the desktop app goes full screen and during this time i do not see this amazing script to be always on top.

i think the desktop app is overriding , How can i overcome and use the capability of this launch.it application. 

Edited by Melba23
Deleted huge quote
Link to comment
Share on other sites

Create an account or sign in to comment

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

Create an account

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

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...