Jump to content
Sign in to follow this  
Wombat

SciTE Resource Manager

Recommended Posts

Wombat

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:


 
#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


 
Installation:
 


[1] acquire the script through either downloading it or copy/paste/save
[2] compile the script as ResourceManager
[3] navigate to the folder that holds your SciTE installation (the one that contains the SciTE.exe)
[4] create a new folder called "ResourceManager" and place the ResourceManager.exe inside this new folder
[5] locate the SciTEGlobal.properties file
[6] add this code to the very bottom of the file (with notepad, notepad++, etc.)
# 44 Resource Manager
command.name.44.*=Resource Manager
command.44.*="$(SciteDefaultHome)\ResourceManager\ResourceManager.exe" $(CurrentSelection)
command.shortcut.44.*=Ctrl+Alt+R

[7]restart SciTE and you should see the newentry inside of "Tools"


 
post-79839-0-95548400-1376011387_thumb.p
 
post-79839-0-64761400-1376011386_thumb.p
 
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:
 


Open the ResourceManager by either clicking on Tools and navigating to ResourceManager or by pressing Ctrl+Alt+R

Press the "SHOW OPTIONS" button to bring up the profile generator.

 
Drag and drop all the files you plan to include in your script onto this window, upon doing so the listbox should populate with the contents you dropped on it. Review the contents and remove any unwated files with the "Delete Selection" button or clear the list and start over with the "Clear All" button.

Once the generator window contains the files you wanna use, press generate, then close the options window and press the REFRESH button on the ResourceManager window.

Now, once you are at a place in your script that you need to insert a filepath, you can simply double-click the item in the ResourceManager and it will add it to the script for you.

 


 
Tips & Pointers:
 


You must keep the "_res.txt" file in the same folder as the script it was made for or it will not be read.
 
To create a new "_res.txt" file you must use the generator with atleast one entry
 
This has been bug tested on Windows XP Professional SP3 32bits, and on Windows 7 Ultimate x64
without any bugs showing up yet / though this does not mean you wont encounter any, and if you do please report them here or to me via pm.

This script is provided as is and with no guarantees, I plan to update it as I get the chance to but I make no promises regarding its use nor do I offer any reperations if it blows up your chihuahua or excites your grandmother... You agree you will not seek reperations from the creator by downloading/copying&pasting said script.


 
Changes I Want to Include in An Update:
 


Add a system that auto-groups the items in the main GUI by filetype

Add a system that provides previews of the files (images show in a hint, other files such as .txt, .ini, etc show in a tooltip)
 
Set the Options/Generator window to allow direct editing of the _res.txt file so that you don't have to generate a new file every time
 
Add a system that will bake me cookies when I have spent too much time in SciTE... I wish :D

Update: ResourceManager_v2 (a seperate version, see below)
 

Here's an alternate version that runs from a "Resources" file:
 
CODE:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <File.au3>
#include <SendMessage.au3>
#include <Misc.au3>
#include <_RecFileListToArray.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("SETTINGS", 5, 568, 305, 33)
GUICtrlSetOnEvent(-1, "OptionsClick")
$Options = GUICtrlCreateButton("REFRESH", 350, 568, 65, 33)
GUICtrlSetOnEvent(-1, "RefreshClick")
Global $QMark = Chr(34)
Global $ResFileDir = @ProgramFilesDir & "\Autoit3\ResourceManager_v2\ResFileDir.txt"
Global $DefPath
Global $List1Data
GUISetState(@SW_SHOW)
#endregion ;;;GUI starts here;;;;
;Dbl Clk read/insert;;;;;;;;;;;;;;;;;;;;;;
GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

DirCreate(@ProgramFilesDir & "\Autoit3\Resources\")
If Not FileExists(@ProgramFilesDir & "\Autoit3\ResourceManager_v2\ResFileDir.txt") Then
 Do
  FileWrite(@ProgramFilesDir & "\Autoit3\ResourceManager_v2\ResFileDir.txt", @ProgramFilesDir & "\Autoit3\Resources\")
 Until FileExists(@ProgramFilesDir & "\Autoit3\ResourceManager_v2\ResFileDir.txt")
EndIf
If Not FileExists(@ProgramFilesDir & "\Autoit3\Resources\Example.txt") Then
 Do
  FileWrite(@ProgramFilesDir & "\Autoit3\Resources\Example.txt", "This is an example")
 Until FileExists(@ProgramFilesDir & "\Autoit3\Resources\Example.txt")
EndIf
Sleep(10)
$DefPath = FileRead($ResFileDir)
$aRes = _RecFileListToArray($DefPath, "*", 1, 0, 0, 2)
$ListDef = _ArrayToString($aRes)
GUICtrlSetData($List1, $ListDef)

While 1
 Sleep(10)
WEnd
Func MainGUIClose()
 Exit
EndFunc   ;==>MainGUIClose
Func RefreshClick()
 GUICtrlSetData($List1, "")
 $DefPath = FileRead($ResFileDir)
 $aRes = _RecFileListToArray($DefPath, "*", 1, 0, 0, 2)
 $ListDef = _ArrayToString($aRes)
 GUICtrlSetData($List1, $ListDef)
EndFunc   ;==>RefreshClick
Func OptionsClick()
 Global $Options = GUICreate("Settings", 302, 99, 192, 124)
 GUISetOnEvent($GUI_EVENT_CLOSE, "OptionsClose")
 Global $Label1 = GUICtrlCreateLabel("Default Resource Folder:", 24, 8, 200, 17)
 Global $Button1 = GUICtrlCreateButton("Default", 24, 64, 73, 25)
 GUICtrlSetOnEvent(-1, "OptionsButton1Click")
 Global $Button2 = GUICtrlCreateButton("...", 112, 64, 33, 25)
 GUICtrlSetOnEvent(-1, "OptionsButton2Click")
 Global $Input1 = GUICtrlCreateInput($DefPath, 24, 32, 257, 21, 0x0800)
 GUICtrlSetOnEvent(-1, "OptionsInput1Change")
 GUISetState(@SW_SHOW)
EndFunc   ;==>OptionsClick
#region ;;;;Options Functions begin here;;;;;
Func OptionsClose()
 GUIDelete("RM Options")
 RefreshClick()
EndFunc   ;==>OptionsClose
Func OptionsButton1Click()
 FileDelete($ResFileDir)
 Sleep(10)
 FileWrite(@ProgramFilesDir & "\Autoit3\ResourceManager_v2\ResFileDir.txt", @ProgramFilesDir & "\Autoit3\Resources\")
 GUICtrlSetData($Input1, "")
 Sleep(5)
 Global $DefPath = FileRead($ResFileDir)
 GUICtrlSetData($Input1, $DefPath)
 ToolTip("Your Resource File Has Been Reset", Default, Default, "ResourceManager_v2")
 Sleep(750)
 ToolTip("")
EndFunc   ;==>OptionsButton1Click
Func OptionsButton2Click()
 Local $NewPath = FileSelectFolder("Choose A File", "C:\", 7)
 If IsString($NewPath) Then
  FileDelete($ResFileDir)
  FileWrite(@ProgramFilesDir & "\Autoit3\ResourceManager_v2\ResFileDir.txt", $NewPath)
  GUICtrlSetData($Input1, $NewPath)
  ToolTip("Your Resource File Has Been Changed To:" & $NewPath, Default, Default, "ResourceManager_v2")
  Sleep(750)
  ToolTip("")
 EndIf
EndFunc   ;==>OptionsButton2Click
Func OptionsInput1Change()
EndFunc   ;==>OptionsInput1Change
Func Form1Minimize()
EndFunc   ;==>Form1Minimize
Func Form1Restore()
EndFunc   ;==>Form1Restore
;Insert Dbl Clkd String into SciTE>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Func _SciTE_InsertText($sString)
 $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
#endregion ;;;;Options Functions begin here;;;;;
;;;;dbl click read;;;
Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)
 #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
     $sData = GUICtrlRead($List1) ; Use the native function
     _SciTE_InsertText($QMark & $sData & $QMark)
   EndSwitch
 EndSwitch
EndFunc   ;==>_WM_COMMAND


 
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

Edited by Wombat
  • Like 1

Just look at us.
Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner


The internet is our one and only hope at a truly free world, do not let them take it from us...

Share this post


Link to post
Share on other sites
Edano

wombat take a look at your other script i fixed it :)

  • Like 1

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites
mLipok

Is the report you can add the output of these three functions

FileGetSize
FileGetTime
FileGetVersion

Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2018-03-17

Share this post


Link to post
Share on other sites
Wombat

 

Is the report you can add the output of these three functions

FileGetSize
FileGetTime
FileGetVersion

 

 

to the items in the list? or to the script active in SciTE?

also I understand english is not the primary language of most no this forum, so let me apologize upfront, but what do you mean by "report", again I apologize for having trouble understanding what you mean.

 

Edited by Wombat

Just look at us.
Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner


The internet is our one and only hope at a truly free world, do not let them take it from us...

Share this post


Link to post
Share on other sites
Wombat

Quick Update:

Cleaned up the code in the first post, it's edited to provide information for beginners (like myself) that need to know what items in the code do.


Just look at us.
Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner


The internet is our one and only hope at a truly free world, do not let them take it from us...

Share this post


Link to post
Share on other sites
guinness

A couple of updates for you to  consider...

#include <Constants.au3>
#include <SendMessage.au3>
#include <WindowsConstants.au3>

Func _SciTE_Send_Command($hWnd, $hSciTE, $sString)
    If StringStripWS($sString, $STR_STRIPALL) = '' Then
        Return SetError(2, 0, 0) ; String is blank.
    EndIf
    $sString = ':' & Dec(StringTrimLeft($hWnd, 2)) & ':' & $sString
    Local $tData = DllStructCreate('char[' & StringLen($sString) + 1 & ']') ; wchar
    DllStructSetData($tData, 1, $sString)

    Local Const $tagCOPYDATASTRUCT = 'ptr;dword;ptr' ; ';ulong_ptr;dword;ptr'
    Local $tCOPYDATASTRUCT = DllStructCreate($tagCOPYDATASTRUCT)
    DllStructSetData($tCOPYDATASTRUCT, 1, 1)
    DllStructSetData($tCOPYDATASTRUCT, 2, DllStructGetSize($tData))
    DllStructSetData($tCOPYDATASTRUCT, 3, DllStructGetPtr($tData))
    _SendMessage($hSciTE, $WM_COPYDATA, $hWnd, DllStructGetPtr($tCOPYDATASTRUCT))
    Return Number(Not @error)
EndFunc   ;==>_SciTE_Send_Command
Func GenerateProf()
    $FileCount = _GUICtrlListBox_GetCount($List2)
    If $FileCount Then ; If there are items in the ListView then generate the file.
        Global $FileList[$FileCount + 1]
        For $i = 0 To $FileCount
            $FileList[$i] = _GUICtrlListBox_GetText($List2, $i)
        Next
        _ArrayDelete($FileList, $i)
        _FileWriteFromArray($sFilePath & "_res.txt", $FileList)
    EndIf
EndFunc   ;==>GenerateProf
; Place at the top of your script. This is if you're using WinAPIEx or the AutoIt betas (v3.3.9.4+)
#include <APIConstants.au3>
#include <WinAPIEx.au3>

Global $__aDropFiles = 0

; Then use this function.
Func WM_DROPFILES($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $lParam
    Switch $iMsg
        Case $WM_DROPFILES
            Local Const $aReturn = _WinAPI_DragQueryFileEx($wParam)
            If UBound($aReturn) Then
                $__aGUIDropFiles = $aReturn
            Else
                Local Const $aError[1] = [0]
                $__aGUIDropFiles = $aError
            EndIf
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_DROPFILES

; And create an event for your GUI to monitor $GUI_EVENT_DROPPED.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
guinness

Also declaring Global variables in functions is not a good idea, unless you know what the consequences really are. It's best to declare Global variables at the start of your script.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
Wombat

Also declaring Global variables in functions is not a good idea, unless you know what the consequences really are. It's best to declare Global variables at the start of your script.

 

I try to do this when possible, the functions that contain Global variables are from the scripts I borrowed from. Except for the options window which is called up via the options button ( i know this can be done by simply defining the options ctrls and gui then just having the function call it to show.

In my next update this will likely be changed. I saw your Autoit best coding practices and am studying it closely.


Just look at us.
Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner


The internet is our one and only hope at a truly free world, do not let them take it from us...

Share this post


Link to post
Share on other sites
Wombat

 

A couple of updates for you to  consider...

#include <Constants.au3>
#include <SendMessage.au3>
#include <WindowsConstants.au3>

Func _SciTE_Send_Command($hWnd, $hSciTE, $sString)
    If StringStripWS($sString, $STR_STRIPALL) = '' Then
        Return SetError(2, 0, 0) ; String is blank.
    EndIf
    $sString = ':' & Dec(StringTrimLeft($hWnd, 2)) & ':' & $sString
    Local $tData = DllStructCreate('char[' & StringLen($sString) + 1 & ']') ; wchar
    DllStructSetData($tData, 1, $sString)

    Local Const $tagCOPYDATASTRUCT = 'ptr;dword;ptr' ; ';ulong_ptr;dword;ptr'
    Local $tCOPYDATASTRUCT = DllStructCreate($tagCOPYDATASTRUCT)
    DllStructSetData($tCOPYDATASTRUCT, 1, 1)
    DllStructSetData($tCOPYDATASTRUCT, 2, DllStructGetSize($tData))
    DllStructSetData($tCOPYDATASTRUCT, 3, DllStructGetPtr($tData))
    _SendMessage($hSciTE, $WM_COPYDATA, $hWnd, DllStructGetPtr($tCOPYDATASTRUCT))
    Return Number(Not @error)
EndFunc   ;==>_SciTE_Send_Command
Func GenerateProf()
    $FileCount = _GUICtrlListBox_GetCount($List2)
    If $FileCount Then ; If there are items in the ListView then generate the file.
        Global $FileList[$FileCount + 1]
        For $i = 0 To $FileCount
            $FileList[$i] = _GUICtrlListBox_GetText($List2, $i)
        Next
        _ArrayDelete($FileList, $i)
        _FileWriteFromArray($sFilePath & "_res.txt", $FileList)
    EndIf
EndFunc   ;==>GenerateProf

added, will be in the next update, thank you

; Place at the top of your script. This is if you're using WinAPIEx or the AutoIt betas (v3.3.9.4+)
#include <APIConstants.au3>
#include <WinAPIEx.au3>

Global $__aDropFiles = 0

; Then use this function.
Func WM_DROPFILES($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $lParam
    Switch $iMsg
        Case $WM_DROPFILES
            Local Const $aReturn = _WinAPI_DragQueryFileEx($wParam)
            If UBound($aReturn) Then
                $__aGUIDropFiles = $aReturn
            Else
                Local Const $aError[1] = [0]
                $__aGUIDropFiles = $aError
            EndIf
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_DROPFILES

; And create an event for your GUI to monitor $GUI_EVENT_DROPPED.

 

I dont have WinAPIEx.au3, I will be making a version of the script that uses it but I plan to keep both for those that don't have iteither.

Edited by Wombat

Just look at us.
Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner


The internet is our one and only hope at a truly free world, do not let them take it from us...

Share this post


Link to post
Share on other sites
guinness

Don't overcomplicate yourself, if you don't use it then fine. Just remember that when the beta versions hit stable, then my code will be valid for all.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
Edano

wombat, you opened two threads with the same title (SciTE Resource Manager), one in help and one in example scripts. could you reword one of them, because i follow both and cannot distinguish them ;) thx E.


[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites
Wombat

wombat, you opened two threads with the same title (SciTE Resource Manager), one in help and one in example scripts. could you reword one of them, because i follow both and cannot distinguish them ;) thx E.

 

Not sure I can.. if so, I definitely tried and failed


Just look at us.
Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner


The internet is our one and only hope at a truly free world, do not let them take it from us...

Share this post


Link to post
Share on other sites
Wombat

Here's an alternate version that runs from a "Resources" file:
 
CODE:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <File.au3>
#include <SendMessage.au3>
#include <Misc.au3>
#include <_RecFileListToArray.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("SETTINGS", 5, 568, 305, 33)
GUICtrlSetOnEvent(-1, "OptionsClick")
$Options = GUICtrlCreateButton("REFRESH", 350, 568, 65, 33)
GUICtrlSetOnEvent(-1, "RefreshClick")
Global $QMark = Chr(34)
Global $ResFileDir = @ProgramFilesDir & "\Autoit3\ResourceManager_v2\ResFileDir.txt"
Global $DefPath
Global $List1Data
GUISetState(@SW_SHOW)
#endregion ;;;GUI starts here;;;;

;Dbl Clk read/insert;;;;;;;;;;;;;;;;;;;;;;
GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


DirCreate(@ProgramFilesDir & "\Autoit3\Resources\")

If Not FileExists(@ProgramFilesDir & "\Autoit3\ResourceManager_v2\ResFileDir.txt") Then
    Do
        FileWrite(@ProgramFilesDir & "\Autoit3\ResourceManager_v2\ResFileDir.txt", @ProgramFilesDir & "\Autoit3\Resources\")
    Until FileExists(@ProgramFilesDir & "\Autoit3\ResourceManager_v2\ResFileDir.txt")
EndIf

If Not FileExists(@ProgramFilesDir & "\Autoit3\Resources\Example.txt") Then
    Do
        FileWrite(@ProgramFilesDir & "\Autoit3\Resources\Example.txt", "This is an example")
    Until FileExists(@ProgramFilesDir & "\Autoit3\Resources\Example.txt")
EndIf

Sleep(10)

$DefPath = FileRead($ResFileDir)
$aRes = _RecFileListToArray($DefPath, "*", 1, 0, 0, 2)
$ListDef = _ArrayToString($aRes)
GUICtrlSetData($List1, $ListDef)


While 1
    Sleep(10)
WEnd

Func MainGUIClose()
    Exit
EndFunc   ;==>MainGUIClose

Func RefreshClick()
    GUICtrlSetData($List1, "")
    $DefPath = FileRead($ResFileDir)
    $aRes = _RecFileListToArray($DefPath, "*", 1, 0, 0, 2)
    $ListDef = _ArrayToString($aRes)
    GUICtrlSetData($List1, $ListDef)
EndFunc   ;==>RefreshClick

Func OptionsClick()
    Global $Options = GUICreate("Settings", 302, 99, 192, 124)
    GUISetOnEvent($GUI_EVENT_CLOSE, "OptionsClose")
    Global $Label1 = GUICtrlCreateLabel("Default Resource Folder:", 24, 8, 200, 17)
    Global $Button1 = GUICtrlCreateButton("Default", 24, 64, 73, 25)
    GUICtrlSetOnEvent(-1, "OptionsButton1Click")
    Global $Button2 = GUICtrlCreateButton("...", 112, 64, 33, 25)
    GUICtrlSetOnEvent(-1, "OptionsButton2Click")
    Global $Input1 = GUICtrlCreateInput($DefPath, 24, 32, 257, 21, 0x0800)
    GUICtrlSetOnEvent(-1, "OptionsInput1Change")
    GUISetState(@SW_SHOW)
EndFunc   ;==>OptionsClick

#region ;;;;Options Functions begin here;;;;;
Func OptionsClose()
    GUIDelete("RM Options")
    RefreshClick()
EndFunc   ;==>OptionsClose

Func OptionsButton1Click()
    FileDelete($ResFileDir)
    Sleep(10)
    FileWrite(@ProgramFilesDir & "\Autoit3\ResourceManager_v2\ResFileDir.txt", @ProgramFilesDir & "\Autoit3\Resources\")
    GUICtrlSetData($Input1, "")
    Sleep(5)
    Global $DefPath = FileRead($ResFileDir)
    GUICtrlSetData($Input1, $DefPath)
    ToolTip("Your Resource File Has Been Reset", Default, Default, "ResourceManager_v2")
    Sleep(750)
    ToolTip("")
EndFunc   ;==>OptionsButton1Click

Func OptionsButton2Click()
    Local $NewPath = FileSelectFolder("Choose A File", "C:\", 7)
    If IsString($NewPath) Then
        FileDelete($ResFileDir)
        FileWrite(@ProgramFilesDir & "\Autoit3\ResourceManager_v2\ResFileDir.txt", $NewPath)
        GUICtrlSetData($Input1, $NewPath)
        ToolTip("Your Resource File Has Been Changed To:" & $NewPath, Default, Default, "ResourceManager_v2")
        Sleep(750)
        ToolTip("")
    EndIf
EndFunc   ;==>OptionsButton2Click

Func OptionsInput1Change()

EndFunc   ;==>OptionsInput1Change

Func Form1Minimize()

EndFunc   ;==>Form1Minimize

Func Form1Restore()

EndFunc   ;==>Form1Restore

;Insert Dbl Clkd String into SciTE>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Func _SciTE_InsertText($sString)
    $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
#endregion ;;;;Options Functions begin here;;;;;

;;;;dbl click read;;;
Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)

    #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
                    $sData = GUICtrlRead($List1) ; Use the native function

                    _SciTE_InsertText($QMark & $sData & $QMark)
            EndSwitch
    EndSwitch

EndFunc   ;==>_WM_COMMAND


 
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!
 
Updated the first post as well


Just look at us.
Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner


The internet is our one and only hope at a truly free world, do not let them take it from us...

Share this post


Link to post
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
Sign in to follow this  

  • Similar Content

    • FrancescoDiMuro
      By FrancescoDiMuro
      Good evening everyone
      I was trying to insert function header to the functions of my script, but, in the SciTE console, this appears:
      Function or struct definition not found, unable to insert header. @Jos Any suggestion?
      Thanks in advance.

      Best Regards.
    • cheeroke
      By cheeroke
      Hi I am not sure how to call it properly, but for those of you who use SciTE, when you typing built in function and about to pass parameters to it you can see popup with all the ones which can be passed.
      Question: how to create something like that for my own functions?
       
      Thanks
    • therks
      By therks
      Does SciTE have string or number ids for the recent file menu items?
      I was hoping to add shortcuts (using the user.shortcuts properties) to the most recent item, but the documentation doesn't list any id's for those items (unless I overlooked?).
      Also, did anyone else notice that the index listing for the SciTE doc doesn't work properly?
      It appears it's linking to this: mk:@MSITStore:C:\Program%20Files\AutoIt3\SciTE\Scite4AutoIt3.chm::/SciTEDocumentation.html
      When it should be this? mk:@MSITStore:C:\Program%20Files\AutoIt3\SciTE\Scite4AutoIt3.chm::/Scitedoc/SciTEDoc.html
    • BrewManNH
      By BrewManNH
      I was looking for a toolbar modification for SciTE and I was checking various versions of SciTE that were available on the internet. They all had some problems for how I wanted to use the editor, so I looked here to see if there were any toolbar modifications for Scite. I found one very old script by YogiBear (Volly) from 2006 that looked promising, though there were issues with it. I decided to see what I could do to modify this script, and make some improvements to it if possible. This script is the result of that work.

      It's not perfect and definitely could use some tweaking, but I thought that it had matured enough, and was mostly stable enough to release the updated version.

      Changelog:
      Version 2.0.1
      Minor update to remove all the old Obfuscator directives and replaced them with #Au3Stripper directives instead. I also corrected a minor bug that only showed up for me on one computer I tried this on, and caused the tool bar to crash for others as well.
      SciTE toolbar version 2.0
      Changed the settings values to use constants instead of 'magic numbers' The icons on the toolbar weren't lining up with the separator characters or with the toolbar GUI because they weren't set with the resize setting for the icons, only for the separators. Changed to using arrays for everything, it makes it a lot easier to loop through the controls Added a line to use an alternate path to the SciTE program, so you can start it using, for example, the portable version instead of installed version for those that don't install AutoIt and/or SciTE4AutoIt3. It will accept a commmand line parameter that points to the SciTE executable. Removed a lot of Global variables by moving the GUI creation and monitoring to the Main function and passing variables from it. I embedded the icon files into the script so that there isn't a separate download of the icon files used here. Saves download time and makes the package smaller. Modification of tools is easier because the icon names, tooltip text, and SciTE command codes are saved in the INI file upon first start up. These can be modified after the script has been run once, even after it's been compiled, by changing the ini file information, you can modify this script to automate it, or you can change it manually in any text editor. The icon files are now using, in just my opinion, better looking icons, after all it's been 7 years and icon files have matured. I have included a file with all of the constants that SciTE uses for its menu commands which comes from the SciTE source file "scite.h", so you can use this file to help you modify the commands that the toolbar works with, by figuring out what each of these values represent in SciTE. The core of the script is pretty much the same, I've just fixed a couple of issues that it had, tweaked a few things, added some new functionality and "prettied" it up a bit.

      If anyone has any suggestions as to improvements, bugs/bugfixes, etc. please let me know.

       
      scitetoolbar.zip
    • Aguilucho
      By Aguilucho
      Greetings to the AutoIt community.
      I hope that nobody considers my question insulting but I searched 'SciTEConfig.exe' and I did not find it anywhere;
      although it is mentioned, it seems like a myth, I can not see if it exists.
      On the other hand, I have downloaded the compressed archive (from ... autoit-script-editor/downloads) 'SciTEConfig_Source.zip'
      Does not contain any .exe either but does have a 'SciteConfig.au3' which, I suppose, has replaced the .exe because on the internet I only find it as malware.
      My problem is: My applications to unzip .zip archives, they can see what files SciTEConfig_Source.zip have but they can not unzip it: 'Unknown method' says WinRar.
          I have downloaded it again, in case it had been damaged but the result is always the same.

      My question is: Is the archive 'SciTEConfig_Source.zip' damaged or does it have any other method of compression?
      I need it to learn how to configure SciTE (lite).
      Thankful to the developers of AutoIt and to the community.
      Regards
       
×