Search the Community
Showing results for tags 'Resource Manager'.
-
First of all, I would like to thank those who helped me immensely on this script: guinness Edano and as well thank those who's script's I barrowed from: Melba23 guinness BrewManNH (if i missed anyone I apologize) I have learned a great deal in a short amount of time, and I certainly couldn't have without the aid of the members of this forum. I've rarely came upon a forum that had such a great community as this, they truly are gems hidden away in the land of internwebs. I made this (with the help of others, which without it this would be a crap script) to aid me in my work, and I hope it helps you with yours as well. If not then at least it's here to serve as an example for others. ResourceManager.au3 CODE: Installation: Description: This tool is used to create a yourscriptname_res.txt file that is associated with your script. This file contains the file paths of all the resources you plan to use in your script for easy access and insertion. Usage Instructions: Tips & Pointers: Changes I Want to Include in An Update: Update: ResourceManager_v2 (a seperate version, see below) Here's an alternate version that runs from a "Resources" file: CODE: You must create a folder named "ResourceManager_v2" in your "Autoit3" folder, also it assumes that the "Autoit3" folder is in your "Program FIles" folder. If it isn't then for now you'll need to change the $ResFileDir variable and all it's occurences to match, UNTIL I update it to find your "Autoit3" folder wherever it is... likely easy peasy but I'm tired and need sleep. This version gives the user the ability to set their own resource file as well in the settings dialogue... ENJOY! Thank you all, Wombat
- 13 replies
-
So here is a current SciTE tool I'm working on, I need a little help finishing it up. I need to have the main gui read the _res.profile that's associated with the script in the focused tab in SciTE... I need it to enter the selected file path at the insertoin cursor in SciTE... anyone wanna throw in on this one? #region;;;;;;;;;;;;;;;SciTE Resource Manager;;;;;;;;;;;;;;;;;;; ;;;;;created by Wombat with help from Melba23, guinness, and Edano;;;;;; #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <File.au3> #include <SendMessage.au3> #include <Misc.au3> Opt("GUIOnEventMode", 1) #NoTrayIcon #region ;;;GUI starts here;;;; $hGUI_Main = GUICreate("Resource Manager", 448, 603, 192, 124) GUISetOnEvent($GUI_EVENT_CLOSE, "MainGUIClose") GUISetOnEvent($GUI_EVENT_MINIMIZE, "Form1Minimize") GUISetOnEvent($GUI_EVENT_RESTORE, "Form1Restore") $List1 = GUICtrlCreateList("", 0, 0, 446, 565) $Options = GUICtrlCreateButton("SHOW OPTIONS", 5, 568, 305, 33) GUICtrlSetOnEvent(-1, "OptionsClick") $Options = GUICtrlCreateButton("REFRESH", 350, 568, 65, 33) GUICtrlSetOnEvent(-1, "RefreshClick") $cDrop_Dummy = GUICtrlCreateDummy() GUICtrlSetOnEvent(-1, "_On_Drop") Global $aDrop_List Global $List1Data GUISetState(@SW_SHOW) #endregion ;;;;;GUI ends here;;;;;6 #region ;;;These register a user defined function for a known Windows Message ID;;;; GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") GUIRegisterMsg(0x233, "On_WM_DROPFILES");<--- This is how the GUI registers the dropped files #endregion ;;;;;;; #region ;;;This is the startup action that populates the ResourceManager's listbox;;; Global $List1Data Global $WinTitle = WinGetTitle('[CLASS:SciTEWindow]') Local $sFilePath = StringRegExpReplace($WinTitle, '^(\V+)(?:\h[-*]\V+)$', '\1') _FileReadToArray($sFilePath & "_res.txt", $List1Data) $ListDef = _ArrayToString($List1Data) GUICtrlSetData($List1, $ListDef) #endregion ;;;;;;;;;;;; While 1 Sleep(10) WEnd #region ;;;;Functions start here;;;;;; Func MainGUIClose();<---- This exits the script and stops the process Exit EndFunc Func RefreshClick();<----This refreshs the Resource Manager's ListBox GUICtrlSetData($List1, "") Local $sFilePath = StringRegExpReplace($WinTitle, '^(\V+)(?:\h[-*]\V+)$', '\1') _FileReadToArray($sFilePath & "_res.txt", $List1Data) $ListDef = _ArrayToString($List1Data) GUICtrlSetData($List1, $ListDef) EndFunc Func OptionsClick();<---- This calls up another gui which edits the contents of the resource file $hGUI = GUICreate("RM Options", 375, 376, 300, 124, Default, $WS_EX_ACCEPTFILES) GUISetOnEvent($GUI_EVENT_CLOSE, "OptionsClose") GUISetOnEvent($GUI_EVENT_MINIMIZE, "Form1Minimize") GUISetOnEvent($GUI_EVENT_RESTORE, "Form1Restore") Global $List2 = GUICtrlCreateList("", 0, -1, 283, 381, $LBS_EXTENDEDSEL) Global $bDeleteSel = GUICtrlCreateButton("Delete Selection", 285, 40, 89, 33) GUICtrlSetOnEvent(-1, "DelSel") Global $bClearAll = GUICtrlCreateButton("Clear All", 299, 88, 73, 33) GUICtrlSetOnEvent(-1, "ClearAll") Global $bGenerate = GUICtrlCreateButton("Generate", 315, 320, 57, 41) GUICtrlSetOnEvent(-1, "GenerateProf") Global $Label1 = GUICtrlCreateLabel("Edit Resource List", 285, 8, 90, 17) Global $Label2 = GUICtrlCreateLabel("Generate", 320, 264, 48, 17) Global $Label3 = GUICtrlCreateLabel("Resource Profile", 295, 288, 82, 17) Global $cDrop_Dummy = GUICtrlCreateDummy() GUICtrlSetOnEvent(-1, "_On_Drop") Global $aDrop_List GUISetState(@SW_SHOW) EndFunc Func _On_Drop() ;<---- This populates the Options Window's ListBox with the items draged&dropped onto it For $i = 1 To $aDrop_List[0] GUICtrlSetData($List2, $aDrop_List[$i]) Next EndFunc ;==>_On_Drop Func On_WM_DROPFILES($hWnd, $iMsg, $wParam, $lParam);<---- This is how the GUI registers the dropped files ; Credit to ProgAndy for DLL calls #forceref $hWnd, $iMsg, $lParam Local $iSize, $pFileName ; Get number of files dropped Local $aRet = DllCall("shell32.dll", "int", "DragQueryFileW", "hwnd", $wParam, "int", 0xFFFFFFFF, "ptr", 0, "int", 0) ; Reset array to correct size Global $aDrop_List[$aRet[0] + 1] = [$aRet[0]] ; And add item names For $i = 0 To $aRet[0] - 1 $aRet = DllCall("shell32.dll", "int", "DragQueryFileW", "hwnd", $wParam, "int", $i, "ptr", 0, "int", 0) $iSize = $aRet[0] + 1 $pFileName = DllStructCreate("wchar[" & $iSize & "]") DllCall("shell32.dll", "int", "DragQueryFileW", "hwnd", $wParam, "int", $i, "ptr", DllStructGetPtr($pFileName), "int", $iSize) $aDrop_List[$i + 1] = DllStructGetData($pFileName, 1) $pFileName = 0 Next ; Send the count to trigger the drop function in the main loop GUICtrlSendToDummy($cDrop_Dummy, $aDrop_List[0]) EndFunc ;==>On_WM_DROPFILES Func DelSel();<---- This deletes the item selected in the Options Window ListBox Local $a_SelectedItems = _GUICtrlListBox_GetSelItems($List2) For $i = $a_SelectedItems[0] To 1 Step -1 _GUICtrlListBox_DeleteString($List2, $a_SelectedItems[$i]) Next EndFunc Func ClearAll();<---- This clears the contents of the ListBox in the Options Window GUICtrlSetData($List2, "") EndFunc Func GenerateProf();<---- This creates the resource profile $FileCount = _GUICtrlListBox_GetCount($List2) $FileList[$FileCount + 1] For $i = 0 To $FileCount $FileList[$i] = _GUICtrlListBox_GetText($List2, $i) Next _ArrayDelete($FileList, $i) _FileWriteFromArray($sFilePath & "_res.txt", $FileList) EndFunc Func OptionsClose();<----This closes the Options Window leaving the MainGUI open !if Exit is used here it will close both windows! GUIDelete("RM Options") EndFunc Func Form1Minimize() EndFunc Func Form1Restore() EndFunc Func _SciTE_InsertText($sString);<---- This inserts the item double-clicked in the ListBox in the Resource Manager's window $sString = StringReplace($sString, '\', '\\') _SciTE_ReplaceMarcos($sString) Return _SciTE_Send_Command(0, _SciTE_WinGetDirector(), 'insert:' & $sString) EndFunc ;==>_SciTE_InsertText Func _SciTE_ReplaceMarcos(ByRef $sString) $sString = StringReplace($sString, @TAB, '\t') $sString = StringReplace($sString, @CR, '\r') $sString = StringReplace($sString, @LF, '\n') EndFunc ;==>_SciTE_ReplaceMarcos Func _SciTE_WinGetDirector() Return WinGetHandle('DirectorExtension') EndFunc ;==>_SciTE_WinGetDirector Func _SciTE_Send_Command($hHandle, $hSciTE, $sString) Local $ilParam, $tData If StringStripWS($sString, 8) = "" Then Return SetError(2, 0, 0) ; String is blank. EndIf $sString = ":" & Dec(StringTrimLeft($hHandle, 2)) & ":" & $sString $tData = DllStructCreate("char[" & StringLen($sString) + 1 & "]") ; wchar DllStructSetData($tData, 1, $sString) $ilParam = DllStructCreate("ptr;dword;ptr") ; ulong_ptr;dword;ptr DllStructSetData($ilParam, 1, 1) ; $ilParam, 1, 1 DllStructSetData($ilParam, 2, DllStructGetSize($tData)) DllStructSetData($ilParam, 3, DllStructGetPtr($tData)) _SendMessage($hSciTE, $WM_COPYDATA, $hHandle, DllStructGetPtr($ilParam)) Return Number(Not @error) EndFunc ;==>_SciTE_Send_Command Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam);<---- This reads the item that is double-clicked in the ListBox in the Resource Manager's window #forceref $hWnd, $iMsg, $lParam $iIDFrom = BitAND($wParam, 0xFFFF) ; Low Word $iCode = BitShift($wParam, 16) ; Hi Word Switch $iCode Case $LBN_DBLCLK Switch $iIDFrom Case $List1 $QMark= Chr(34) $sData = GUICtrlRead($List1) ; Use the native function _SciTE_InsertText($QMark & $sData & $QMark) EndSwitch EndSwitch EndFunc #endregion ;;;;;Functions End Here;;;;; #endregion CODE updated per release thread in Example Scripts, to keep it consistent...
- 26 replies
-
- Scite Add-on
- SciTE Tools
-
(and 5 more)
Tagged with: