#Region converted Directives from C:\AutoIT-3\Utilities\SCITE Snippet\Snippet.au3.ini #AutoIt3Wrapper_aut2exe=C:\Program Files\AutoIt3\Beta\Aut2Exe\Aut2Exe.exe #AutoIt3Wrapper_icon=D:\AutoIT-3\Utilities\SCITE Snippet\Scite.ico #AutoIt3Wrapper_outfile=C:\Program Files\AutoIt3\SciTe\Snippets\Snippet.exe #AutoIt3Wrapper_Allow_Decompile=4 #AutoIt3Wrapper_Res_Description=Snippet Holder for SciTE #AutoIt3Wrapper_Res_Fileversion=2.0.2.7 #AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y #AutoIt3Wrapper_Res_LegalCopyright=Sodexho #AutoIt3Wrapper_Res_Field1Name=Written by: #AutoIt3Wrapper_Res_Field1Value=Michael Olson #EndRegion converted Directives from C:\AutoIT-3\Utilities\SCITE Snippet\Snippet.au3.ini ; ;Snippet holder for SCITE ;v 2.1 Fixed / added the following ; - file, exit ; - the Help, About with a hyperlink to the Forum thread for more info ; - the Add New Snippet problem if no catagories exist (Thanks JdeB) ; - The Category CMDtmp was showing on the main screen ; - Overwrite of Snippet checking was preventing the Modifications of current Snippets ;v 2.0 Much better handling of the Right Click in SciTE, modification made to the ini structure to handle this... "Thanks again JdeB" ; Also put in checking so you don't accidently overwrite an old snippet when you name a new one. ;v 1.9 Allow new Snippet creation via, Right Click in SciTE ;v 1.8 Used gafrost code to automatically update the stored x,y coords when ever they change, Also added the hotkey of Ctrl+Alt+s to automatically add any selected text in scite into a new Snippet. ;v 1.7 Modified the already launched function to show msgbox. & modified the way it attempts to find the SciTE directory to launch SciTE. ;v 1.6 modified the GUI so it is a MDICHILD of SCITE so it will minimize with SciTE and is only on top of SciTE ;v 1.5 Added ability to modify code before adding into ini ; - Added ability to modify a snippet that is currently stored ; - added the abiltiy to move a snippet from one category to another ; - modified ini structure slightly ; - The code is too long now to paste directly into this so I have attached the file below ;v 1.4 Added ability to rename and delete Categories and snippets ;v 1.3 no longer replaces the clipboard contents when retrieving a snippet ;v 1.2 Improved the Paste into SciTE, Added a Right click, Preview Snippet option. ;v 1.1 fixed an issue with unable to paste code back into SciTE $file = @ScriptDir & "\Snippets.ini" if $cmdlineraw <> "" Then ;Snippet was sent via command line $cmdlineClean = StringReplace($cmdlineraw, Chr(13) & Chr(10), Chr(26)) IniWrite($file, "CMDtmp", "Value", $cmdlineClean) IniWrite($file, "CMDtmp", "New", 1) EndIf $g_szVersion = "S.n.i.p.p.e.t" If WinExists($g_szVersion) Then Exit ; It's already running EndIf AutoItWinSetTitle($g_szVersion) #NoTrayIcon #include #include #include #include #include Opt("WinTitleMatchMode", 2) Opt("CaretCoordMode", 2) if not ProcessExists("SciTe.exe") Then $Dir = StringInStr(@ScriptDir, "\", 0, -1) $Dir2 = StringLeft(@ScriptDir, $Dir) Run($Dir2 & "\SciTe.exe", $Dir2) EndIf Dim $Dock = 0, $s_State = 1, $x1, $x2, $y1, $y2 Dim $e, $i, $var, $file, $TreeView, $CodeTree, $var2, $TreeView2 Dim $TreeView3, $test1, $varx Dim $var, $file, $x, $sValue, $urlFile Dim $PosX, $PosY, $PosW, $PosH, $tmp_pos[2] Dim $iniKey, $Header, $SectionStrings, $LastModState Global $s_Name _SizeWindow() ;Retrieve pos and size of window from INI WinWaitActive("SciTE", "Source", 30) $SciTE = WinGetHandle("SciTE", "Source") $GUI1 = GUICreate("", $PosW, $PosH, $PosX, $PosY, $WS_THICKFRAME, $WS_EX_MDICHILD, $SciTE) $GUIMenuCMD = GUICtrlCreateMenu("&File") $Insert = GUICtrlCreateMenuitem("Insert Snippet into SCITE", $GUIMenuCMD) GUICtrlCreateMenuitem("", $GUIMenuCMD) $NewSnippet = GUICtrlCreateMenuitem("Add SCITE Code as Snippet", $GUIMenuCMD) $NewHeader = GUICtrlCreateMenuitem("Create a new Category", $GUIMenuCMD) GUICtrlCreateMenuitem("", $GUIMenuCMD) $Backup = GUICtrlCreateMenuitem("Backup Data File", $GUIMenuCMD) GUICtrlCreateMenuitem("", $GUIMenuCMD) $ExitCMD = GUICtrlCreateMenuitem("E&xit", $GUIMenuCMD) $GuiMenuHelp = GUICtrlCreateMenu("&Help") $mnuAbout = GUICtrlCreateMenuitem("A&bout", $GuiMenuHelp) $CodeTree= GUICtrlCreateTreeView(5, 5, $PosW - 10, $PosH - 50) $ContextMenu = GUICtrlCreateContextMenu($CodeTree) $InsertCode = GUICtrlCreateMenuitem("Send to SCITE", $ContextMenu) $PreviewCode = GUICtrlCreateMenuitem("View Snippet", $ContextMenu) GUICtrlCreateMenuitem("", $ContextMenu) $NewSnippetCTX = GUICtrlCreateMenuitem("Add new Snippet Here", $ContextMenu) $Rename = GUICtrlCreateMenuitem("Rename Selection", $ContextMenu) $Delete = GUICtrlCreateMenuitem("Delete Selection", $ContextMenu) _IniGetSectionNames() ;Retrieve Snippet data for display in the TreeView ;Hidden Slide Edit window $GUISlide = GUICreate("Snippet", 622, 506, 192, 125, $WS_CAPTION, -1, $GUI1) $ChildEdit = GUICtrlCreateCheckbox("Edit Snippet", 20, 20, 100, 25) GUICtrlCreateLabel("Snippet Name:", 344, 11, 85, 17) $SnippetName = GUICtrlCreateInput("", 432, 8, 177, 21) GUICtrlCreateLabel("Snippet Category", 344, 41, 85, 17) $Combo1 = GUICtrlCreateCombo("", 432, 38, 177, 150) $Edit1 = GUICtrlCreateEdit("", 8, 70, 601, 371, -1, $WS_EX_CLIENTEDGE) $ChildSave = GUICtrlCreateButton("Save Snippet", 152, 460, 113, 33) $childClose = GUICtrlCreateButton("Cancel", 368, 460, 113, 33) ;End of GUI Slide GUISetState(@SW_HIDE, $GUISlide) GUISetState(@SW_SHOW, $GUI1) _GUICtrlTreeView_Sort($CodeTree) ;~ _GUICtrlTreeView_Sort ($CodeTree) ;Sort the Treeview alphabetically $WinPos = WinGetPos($GUI1) $tmp_pos[0] = $WinPos[0] $tmp_pos[1] = $WinPos[1] _ReduceMemory() While 1 if not ProcessExists("SciTE.exe") then Exit _KeepWindowsDocked($GUISlide, $GUI1, $Dock, $x1, $x2, $y1, $y2) $WinPos = WinGetPos($GUI1) If $WinPos[0] <> $tmp_pos[0] Or $WinPos[1] <> $tmp_pos[1] Then $tmp_pos[0] = $WinPos[0] $tmp_pos[1] = $WinPos[1] _UpdatePos($GUI1, $file) EndIf $ChildModState = GUICtrlRead($ChildEdit) if $ChildModState <> $LastModState Then $LastModState = $ChildModState if $ChildModState = 1 Then GUICtrlSetBkColor($Edit1, 0xFFFFFF) GUICtrlSetState($SnippetName, $GUI_Enable) GUICtrlSetState($Combo1, $GUI_Enable) GUICtrlSetState($ChildSave, $GUI_Enable) Else GUICtrlSetBkColor($Edit1, 0xD4D0C8) GUICtrlSetState($SnippetName, $GUI_DISABLE) GUICtrlSetState($Combo1, $GUI_DISABLE) GUICtrlSetState($ChildSave, $GUI_DISABLE) EndIf EndIf ;Check for any new snippet added to the INI from the Command line $CMDtmp = IniRead($file, "CMDtmp", "New", 0) if $CMDtmp = 1 Then $NewText = IniRead($file, "CMDtmp", "Value", "Unable to Retrieve Text") $CmdClean = StringReplace($NewText, chr(26), chr(13) & Chr(10), 0) _InsertNew("", "", $CmdClean) IniDelete($file, "CMDtmp", "New") IniDelete($file, "CMDtmp", "Value") EndIf $msg = GuiGetMsg($GUI1) Select case $msg = $childClose _ShowWin($GUISlide, $Dock, $s_State) GUICtrlSetData($SnippetName, "", "") GUICtrlSetData($Combo1, "", "") GUICtrlSetData($Edit1, "") GUICtrlSetBkColor($Edit1, 0xFFFFFF) GUICtrlSetState($SnippetName, $GUI_Enable) GUICtrlSetState($Combo1, $GUI_Enable) GUICtrlSetState($ChildSave, $GUI_Enable) ;This will call the About Function to display about information of the Snippet program "Thanks Gary for this Function" Case $msg = $mnuAbout _HelpAbout("About Snippet", $GUI1) ;---------------------------------------------------------------------------------------------- ;This Case will backup the Snippets.ini file into the \Snippet\Backup folder and auto increment ; the Backup file name Case $msg = $Backup if not FileExists(@ScriptDir & "\Backup\") Then DirCreate(@ScriptDir & "\Backup") $Increment = @YEAR & "-" & @MON & "-" & @MDAY For $i = 97 to 122 if not FileExists(@ScriptDir & "\Backup\" & $Increment & Chr($i) & "-Snip.bkp") Then $saveas = FileSaveDialog("Save Backup As:", @ScriptDir & "\Backup", "Backup files (*.bkp)", 18, $Increment & Chr($i) & "-Snip.bkp") if @error Then ExitLoop if FileCopy($file, $saveas, 0) = 1 Then MsgBox(0, "Finished", "The Backup Completed successfully") Else MsgBox(0, "Error", "Unable to create the Backup file " & $saveas) EndIf ExitLoop EndIf Next ;---------------------------------------------------------------------------------------------- ;This Case will create a new Section Name in the Snippets.ini file which will then be ;Read as a new Category in the TreeView Case $msg = $NewHeader $CatRaw = InputBox("New Category", "Please type the new Category Name", "", "", 240, 60) if @error = 0 Then $CatName = $CatRaw & Chr(160) & Chr(160) IniWrite($file, $CatName, "", "") IniDelete($file, $CatName, "") _GUICtrlTreeView_DeleteAll($CodeTree) ;~ _GUICtrlTreeView_DeleteAll($CodeTree) _IniGetSectionNames() _GUICtrlTreeView_Sort($CodeTree) ;~ _GUICtrlTreeView_Sort ($CodeTree) EndIf ;---------------------------------------------------------------------------------------------- ;This Case will add a new Key name and Key Value into the Snippets.ini file ;Any CRLF's that are found will be replaced with a "Substitute" character so they will fit on ; one line in the ini file ;This data will then be read as a new Snippet and added to the TreeView under the proper Category Case $msg = $NewSnippet or $msg = $NewSnippetCTX $Parent = GUICtrlRead(_GUICtrlTreeView_GetParentParam($CodeTree), 1) if $Parent[0] <> "" Then GUICtrlSetState($ChildEdit, $GUI_Checked) _InsertNew($Parent[0], "", "") Else $Selected = GUICtrlRead($CodeTree, 1) if @error = 0 Then GUICtrlSetState($ChildEdit, $GUI_Checked) _InsertNew($Selected[0], "", "") EndIf EndIf ;---------------------------------------------------------------------------------------------------- ;This Case will add a stored snippet into the SciTE Scintilla1 control at the current cursor location ;The INI file is read and the "Substitute" character is replaced with the origional CRLF's and then ; pasted into SciTE Case $msg = $InsertCode or $msg = $Insert $Selected = GUICtrlRead($CodeTree, 1) if $Selected[0] == 0 or StringRight($Selected[0], 2) = Chr(160) & Chr(160) Then MsgBox(0, "Error", "Please select a Snippet") Else $Parent = GUICtrlRead(_GUICtrlTreeView_GetParentParam($CodeTree), 1) $RetrievedRaw = IniRead($file, $Parent[0], $Selected[0], "") $RetrievedClean = StringReplace($RetrievedRaw, chr(26), chr(13) & Chr(10), 0) $ClipSave = ClipGet() ClipPut($RetrievedClean & @CRLF) if ControlFocus("SciTE", "Source", "Scintilla1") == 1 Then Send("^v") Else MsgBox(0, "Error", "Unable to find the Scite Code window") EndIf ClipPut($ClipSave) EndIf ;----------------------------------------------------------------------------------------- ;This Case statement will simply display the current snippet in a messagebox so you ; can verify it is the proper code before inserting it Case $msg = $PreviewCode $Selected = GUICtrlRead($CodeTree, 1) if $Selected[0] == 0 or StringRight($Selected[0], 2) = Chr(160) & Chr(160) Then MsgBox(0, "Error", "Please select a Snippet") Else GUICtrlSetBkColor($Edit1, 0xD4D0C8) GUICtrlSetState($SnippetName, $GUI_DISABLE) GUICtrlSetState($Combo1, $GUI_DISABLE) GUICtrlSetState($ChildSave, $GUI_DISABLE) $Parent = GUICtrlRead(_GUICtrlTreeView_GetParentParam($CodeTree), 1) $RetrievedRaw = IniRead($file, $Parent[0], $Selected[0], "") $RetrievedClean = StringReplace($RetrievedRaw, chr(26), chr(13) & Chr(10), 0) GUICtrlSetState($ChildEdit, $GUI_UNChecked) _InsertNew($Parent[0], $Selected[0], $RetrievedClean) GUISetState($GUISlide, @SW_LOCK) EndIf ;----------------------------------------------------------------------------------------- ;This Case statement is used to rename a snippet or Category ;Note: Unable to rename an Empty Category, must delete it then recreate it Case $msg = $Rename $Selected = GUICtrlRead($CodeTree, 1) if $Selected[0] == 0 Then MsgBox(0, "Error", "Please select a Snippet") Elseif StringRight($Selected[0], 2) = Chr(160) & Chr(160) Then $dtaRename = InputBox("Rename Category", "Please type the new Category Name", $Selected[0], "", 240, 60) if @error == 0 Then MsgBox(0, $Selected[0], $dtaRename) IniRenameSection($file, $Selected[0], $dtaRename, 0) if @error then MsgBox(0, "Error", "Rename Failed") _GUICtrlTreeView_DeleteAll($CodeTree) _IniGetSectionNames() _GUICtrlTreeView_Sort ($CodeTree) EndIf Else $Parent = GUICtrlRead(_GUICtrlTreeView_GetParentParam($CodeTree), 1) $dtaRename = InputBox("Rename Snippet", "Please type the new Snippet Name", $Selected[0], "", 240, 60) if @error == 0 Then $RetrievedRaw = IniRead($file, $Parent[0], $Selected[0], "") IniDelete($file, $Parent[0], $Selected[0]) IniWrite($file, $Parent[0], $dtaRename, $RetrievedRaw) _GUICtrlTreeView_DeleteAll($CodeTree) _IniGetSectionNames() _GUICtrlTreeView_Sort ($CodeTree) EndIf EndIf ;----------------------------------------------------------------------------------------- ;This Case statement is used to delete a snippet or Category Case $msg = $Delete $Selected = GUICtrlRead($CodeTree, 1) if $Selected[0] == 0 Then MsgBox(0, "Error", "Please select a Snippet or Category to Delete") ElseIf StringRight($Selected[0], 2) = Chr(160) & Chr(160) Then $Confirm = MsgBox(52, "Confirm Category Delete", "Are you sure you want to Delete the Category " & $Selected[0]) if $Confirm = 6 Then IniDelete($file, $Selected[0]) _GUICtrlTreeView_DeleteAll($CodeTree) _IniGetSectionNames() _GUICtrlTreeView_Sort ($CodeTree) EndIf Else $Confirm = MsgBox(52, "Confirm Snippet Delete", "Are you sure you want to Delete the Snippet " & $Selected[0]) if $Confirm = 6 Then $Parent = GUICtrlRead(_GUICtrlTreeView_GetParentParam($CodeTree), 1) IniDelete($file, $Parent[0], $Selected[0]) _GUICtrlTreeView_DeleteAll($CodeTree) _IniGetSectionNames() _GUICtrlTreeView_Sort ($CodeTree) EndIf EndIf ;----------------------------------------------------------------------------------------- ;This Case statement will exit the program if the X is clicked or the Escape key is pressed Case $msg = $GUI_EVENT_CLOSE or $msg = $ExitCMD ExitLoop Case $msg = $ChildSave $newName = GUICtrlRead($SnippetName) if $newName <> "" Then $Category = GUICtrlRead($Combo1) if $Category <> "" Then ;ensure the $newName does not overwrite a current snippet if not $s_Name <> "" Then $verifyName = IniReadSection($file, $Category) if not @error Then for $t = 1 to $verifyName[0][0] if $verifyName[$t][0] == $newName & Chr(160) Then MsgBox(0, "Duplicate Name", "This snippet name already exists") ContinueLoop 2 EndIf Next EndIf EndIf ;End overwrite protection section $NewRaw = GUICtrlRead($Edit1) $NewClean = StringReplace($NewRaw, Chr(13) & Chr(10), Chr(26)) IniDelete($file, $Header, $iniKey & Chr(160)) IniWrite($file, $Category, $newName & Chr(160), $NewClean) _GUICtrlTreeView_DeleteAll($CodeTree) _IniGetSectionNames() _GUICtrlTreeView_Sort($CodeTree) _ShowWin($GUISlide, $Dock, $s_State) GUICtrlSetData($SnippetName, "", "") GUICtrlSetData($Combo1, "", "") GUICtrlSetData($Edit1, "") GUICtrlSetBkColor($Edit1, 0xFFFFFF) GUICtrlSetState($SnippetName, $GUI_Enable) GUICtrlSetState($Combo1, $GUI_Enable) Else MsgBox(0, "Error", "Please Select a Category") EndIf Else MsgBox(0, "Error", "Please specify a Snippet Name") EndIf ;----------------------------------------------------------------------------------------- ;This case statement is simply a holder incase something unexpected is read by the GUI Case Else ;;; EndSelect WEnd Exit ;Exit the Script completely ;=================================================================================== ;Function to allow insertion of a snippet and adjust before final saving ; Also will be used to modify a snippet that is currently stored ;=================================================================================== Func _InsertNew($Header, $iniKey, $CurrentText) $Sections = "" $SectionStrings = "" _ShowWin($GUISlide, $Dock, $s_State) $Sections = IniReadSectionNames($file) if not @error Then for $a = 1 to $Sections[0] if $Sections[$a] <> "~xx123Data" Then if $Sections[$a] <> "CMDtmp" Then $SectionStrings = $SectionStrings & "|" & $Sections[$a] EndIf EndIf Next EndIf $s_Name = $iniKey GUICtrlSetData($SnippetName, $iniKey, "") GUICtrlSetData($Combo1, $SectionStrings, $Header) GUICtrlSetData($Edit1, $CurrentText) EndFunc ;Automatically retrieve the selected text in Scite when the Snippet hotkey is pressed again. Func _RetrieveNew() $NewText = ControlCommand("SciTE", "Source", "Scintilla1", "GetSelected", "") if $NewText <> "" Then GUICtrlSetState($ChildEdit, $GUI_Checked) _InsertNew("", "", $NewText) Else MsgBox(0, "Add Snippet", "No text was selected in SciTE") EndIf EndFunc ;=================================================================================== ;Retrieve all section names and key names from the Snippets.ini file ;This will ignore only the ~xx123Data section in the INI ;The data will then be populated into the TreeView in the GUIMain window ;=================================================================================== Func _IniGetSectionNames() $varx = IniReadSectionNames($file) if not @error Then For $x = 1 To $varx[0] if $varx[$x] <> "~xx123Data" Then if $varx[$x] <> "CMDtmp" Then $TreeView2 = GUICtrlCreateTreeViewitem($varx[$x], $CodeTree) $var = IniReadSection($file, $varx[$x]) if not @error Then For $i = 1 To $var[0][0] $TreeView3 = GUICtrlCreateTreeViewItem($var[$i][0], $TreeView2) $sValue = StringSplit($var[$i][1], '|') Next EndIf EndIf EndIf Next EndIf EndFunc ;===================================================================================== ;Retrieve the x,y coords and the width and height ;that has been stored in the Snippets.ini file ;===================================================================================== Func _SizeWindow() $StoredDTA = IniReadSection($file, "~xx123Data") If @Error = 1 Then $PosX = -1 $PosY = -1 $PosW = 140 $PosH = 340 Else $PosX = $StoredDTA[1][1] $PosY = $StoredDTA[2][1] $PosW = $StoredDTA[3][1] $PosH = $StoredDTA[4][1] EndIf EndFunc Func _UpdatePos(ByRef $GUI1, ByRef $file) Local $ExitPOS = WinGetPos($GUI1, "") If IsArray($ExitPOS) Then IniWrite($file, "~xx123Data", "X", $ExitPOS[0] + 1) IniWrite($file, "~xx123Data", "Y", $ExitPOS[1] - 18) IniWrite($file, "~xx123Data", "W", $ExitPOS[2] - 6) IniWrite($file, "~xx123Data", "H", $ExitPOS[3] - 25) Else MsgBox(0, "Error", "Unable to store Position") EndIf EndFunc ;==>_UpdatePos ;=============================================================================== ; Function Name: _HelpAbout() ; Description: Standard Gui interface to dislpay the Help, About screen for a program ; Parameter(s): $HelpTitle - Help About Window Title ; $HelpParentWindow - Handle returned by the main GUIcreate ; Requirement(s): _LaunchBrowser() & _GuiCtrlCreateHyperlink() Functions ; Return Value(s): None ; Author(s): Michael Olson ;=============================================================================== Func _HelpAbout($HelpTitle, $HelpParentWindow) ;Modify the following variables ;$HelpTextDta is the text you want displayed in the Help window ;$HelpPic is the file name of an image to display on the Right side leave "" if not required ;$HelpDevThread is the location on the AutoIT Forum that stores the development stuff. if not filled out it will be hidden $HelpTextDta = @CRLF & @CRLF & "SciTE Custom Snippet holder" & @CRLF & @CRLF & _ "This software allows easy Storage, Organization and Retrieval of code." & @CRLF & @CRLF & _ "Written By: Michael Olson" $HelpPic = @SystemDir & "\clipbrd.exe" $HelpDevThread = "http://www.autoitscript.com/forum/index.php?s=&showtopic=20494&view=findpost&p=141548" $ver = FileGetVersion(@ScriptFullPath) $HelpGUI = GuiCreate($HelpTitle & " " & $ver, 300, 300,(@DesktopWidth-300)/2, (@DesktopHeight-300)/2, -1, -1, $HelpParentWindow) $HelpText = GUICtrlCreateLabel("", 74, 10, 210, 160) GUICtrlSetData($HelpText, $HelpTextDta) $HelpGraphic = GUICtrlCreateIcon($HelpPic, 0, 0, 10, 64, 64) $HelpClose = GuiCtrlCreateButton("Close", 100, 260, 100, 25) if $HelpDevThread <> "" Then $HelpDevLnk = _GuiCtrlCreateHyperlink("Development Info", 100, 230, 100, 20, 0x0000ff, "(AutoITScript.com Forum Thread)") Else $HelpDevLnk = GUICtrlCreateLabel("", 1, 1, 1, 1) EndIf GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $HelpDevLnk _LaunchBrowser($HelpDevThread) GUICtrlSetColor($HelpDevLnk, 0x800080) Case $msg = $GUI_EVENT_CLOSE or $msg = $HelpClose ExitLoop Case Else ;;; EndSelect WEnd GUIDelete($HelpGUI) GUISwitch($HelpParentWindow) EndFunc ;==>_About ;=============================================================================== ; Function Name: _LaunchBrowser() ; Description: Launches the Default browser to a specified web site ; Parameter(s): $URL = The web site you want to browse to ; Requirement(s): None ; Return Value(s): None ; Author(s): Michael Olson ;=============================================================================== Func _LaunchBrowser($URL) $urlFile = @TEMPDir & "\inet.url" IniWrite($urlFile, "InternetShortcut", "URL", $URL) $URLshort = FileGetShortName($urlFile) Run(@comspec & " /c " & $URLshort, "", @SW_HIDE) EndFunc ;=============================================================================== ; Function Name: _GuiCtrlCreateHyperlink() ; Description: Creates a label that acts as a hyperlink ; Parameter(s): $s_Text - Label text ; $i_Left - Label left coord ; [$i_Top] - Label top coord ; [$i_Width] - Label width ; [$i_Height] - Label height ; [$i_Color] - Text Color ; [$s_ToolTip] - Hyperlink ToolTip ; [$i_Style] - Label style ; [$i_ExStyle] - Label extended style ; Requirement(s): None ; Return Value(s): Control ID ; Author(s): Saunders ;=============================================================================== Func _GuiCtrlCreateHyperlink($S_TEXT, $I_LEFT, $I_TOP, _ $I_WIDTH = -1, $I_HEIGHT = -1, $I_COLOR = 0x0000ff, $S_TOOLTIP = '', $I_STYLE = -1, $I_EXSTYLE = -1) Local $I_CTRLID $I_CTRLID = GUICtrlCreateLabel($S_TEXT, $I_LEFT, $I_TOP, $I_WIDTH, $I_HEIGHT, $I_STYLE, $I_EXSTYLE) If $I_CTRLID <> 0 Then GUICtrlSetFont($I_CTRLID, -1, -1, 4) GUICtrlSetColor($I_CTRLID, $I_COLOR) GUICtrlSetCursor($I_CTRLID, 0) If $S_TOOLTIP <> '' Then GUICtrlSetTip($I_CTRLID, $S_TOOLTIP) EndIf EndIf Return $I_CTRLID EndFunc ;==>_GuiCtrlCreateHyperlink ;Function that will slide the Child window either In or Out Func _ShowWin($gui_Edit, $Dock, $show = 1) If $show Then DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui_Edit, "int", 200, "long", 0x00040002);slide in from right GUISetState(@SW_SHOW, $gui_Edit) $Dock = 2 $s_State = 0 Else DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $gui_Edit, "int", 200, "long", 0x00050001);slide out to right GUISetState(@SW_HIDE, $gui_Edit) $s_State = 1 EndIf EndFunc ;==>_ShowPreview ;Function to ensure the two windows remain docked together Func _KeepWindowsDocked(ByRef $GUI1, ByRef $GUI2, ByRef $Dock, ByRef $x1, ByRef $x2, ByRef $y1, ByRef $y2) Local $p_win1 = WinGetPos($GUI1) Local $p_win2 = WinGetPos($GUI2) If (($p_win1[0] <> $x1 Or $p_win1[1] <> $y1) And BitAND(WinGetState($GUI1), 2) Or $Dock = 2) Then $x1 = $p_win1[0] $y1 = $p_win1[1] $x2 = $p_win1[2] + $x1 $y2 = $y1 WinMove($GUI2, "", $x2, $y2) $Dock = 1 ElseIf (($p_win2[0] <> $x2 Or $p_win2[1] <> $y2) And BitAND(WinGetState($GUI2), 2)) Then $x2 = $p_win2[0] $y2 = $p_win2[1] $x1 = $p_win2[0] - $p_win1[2] $y1 = $y2 WinMove($GUI1, "", $x1, $y1) ElseIf ($p_win1[0] <> $x1 Or $p_win1[1] <> $y1) And BitAND(WinGetState($GUI1), 16) Then WinSetState($GUI2, "", @SW_MINIMIZE) ElseIf ($p_win2[0] <> $x2 Or $p_win2[1] <> $y2) And BitAND(WinGetState($GUI2), 16) Then WinSetState($GUI1, "", @SW_MINIMIZE) ElseIf ($p_win1[0] <> $x1 Or $p_win1[1] <> $y1) And BitAND(WinGetState($GUI1), 2) Then WinSetState($GUI2, "", @SW_RESTORE) ElseIf ($p_win2[0] <> $x2 Or $p_win2[1] <> $y2) And BitAND(WinGetState($GUI2), 2) Then WinSetState($GUI1, "", @SW_RESTORE) EndIf EndFunc ;==>_KeepWindowsDocked Func _ReduceMemory($i_PID = -1) If $i_PID <> -1 Then Local $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $i_PID) Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle[0]) DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $ai_Handle[0]) Else Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1) EndIf Return $ai_Return[0] EndFunc;==> _ReduceMemory()