Jump to content

Scite Add-on of custom script


Recommended Posts

Hi, i have a script that works just fine, but i thought it would be perfect if i could incorporate it into SciTE somehow, just like "SciTE Jump".

My script reads .au3 files and detects all variables, and shows the unique variables in a ini file.

The idea is that these unique variables were probably left behind and forgotten, not being used anymore, and so i can make this scan and delete them,

taking care to not delete any constants that are external to my script, this is why i have to search each one manualy.

But my idea is to make this process more automated, idealy, from the SciTe editor, calling this function, and highlighting the found words.

Is this possible at all? Or is it hardcoded? Even being able to call the script from the tools menu would be a great improvment in QOL.

#Region ;Wrapper
#pragma compile(UPX, false)
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_UseX64=n
#AutoIt3Wrapper_Run_Tidy=y
#AutoIt3Wrapper_Res_SaveSource=y
#AutoIt3Wrapper_Icon=Var.ico
#AutoIt3Wrapper_Res_Icon_Add=Var.ico
;#AutoIt3Wrapper_Outfile=
;#AutoIt3Wrapper_Res_Comment=
;#AutoIt3Wrapper_Res_Description=
#AutoIt3Wrapper_Res_Fileversion=1.0
#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7
#EndRegion ;Wrapper
;=============================================================================
#Region ;FileInstall
FileInstall("Var.ico", @ScriptDir & "\Var.ico")
#EndRegion ;FileInstall
;=============================================================================
#include <Array.au3>
Local $File, $FileOpen, $FileRead
If FileExists(@ScriptDir & '\SearchVars.ini') Then FileDelete(@ScriptDir & '\SearchVars.ini')
$File = FileOpenDialog('Au3 Var Searcher', @ScriptDir, 'Au3Files (*.au3)')
$FileOpen = FileOpen($File)
$FileRead = FileRead($FileOpen)
FileClose($FileOpen)
Search()
Func Search()
    Local $aArray = StringRegExp($FileRead, '(\$\w+)\W', 3) ;(\$[A-Za-z0-9_]+)[^A-Za-z0-9_] ;(\$[[:alnum:]_]+)[^[:alnum:]_]
    Local $aArray2 = _ArrayUnique($aArray, 0, 0)
    For $i = 1 To $aArray2[0]
        $aArray = StringRegExp($FileRead, '(\' & $aArray2[$i] & '+)\W', 3)
        If UBound($aArray, 1) = 1 Then
            IniWrite(@ScriptDir & '\SearchVars.ini', 'Vars', $i, $aArray[0])
            ConsoleWrite($i & ' - ' & $aArray[0] & ' - ' & @MSEC & @CRLF)
        EndIf
    Next
    ShellExecute(@ScriptDir & '\SearchVars.ini')
EndFunc   ;==>Search
;=============================================================================

 

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to post
Share on other sites
  • Developers

Just add a function to your SciTEUser.properties. Something like:

command.49.$(au3)="$(SciteDefaultHome)\..\AutoIt3.exe" "c:\path-to-your-script\scriptname.au3" "$(FilePath)"
command.name.49.$(au3)=findvariables
command.subsystem.49.$(au3)=0
command.save.before.49.$(au3)=1
command.shortcut.49.$(au3)=Ctrl+Shift+x

and add this to your script:

If $cmdline[0] > 0 And FileExists($cmdline[1]) Then
    $File = $cmdline[1]
Else
    $File = FileOpenDialog('Au3 Var Searcher', @ScriptDir, 'Au3Files (*.au3)')
EndIf

Then select a scriptfile and press Ctrl+Shift+x and your script should run with the current file as input. :) 

JOs

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to post
Share on other sites

Hi Jos, many thanks for the reply, i had an issue before, but it was just the fact that i was messing with the file with the same name in the C:\Program Files (x86)\AutoIt3\SciTE directory instead of %userprofile%\AppData\Local\AutoIt v3\SciTE.

Many thanks again, btw, do you have any thoughts on how i could highlight a word in the scite window? a word in the script?

Edited by careca
Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to post
Share on other sites
  • Developers
43 minutes ago, careca said:

Many thanks again, btw, do you have any thoughts on how i could highlight a word in the scite window? a word in the script?

This is an example to jump to the first found variable:

; *** Start added by AutoIt3Wrapper ***
#include <WindowsConstants.au3>
; *** End added by AutoIt3Wrapper ***
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=Var.ico
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0
#AutoIt3Wrapper_Res_SaveSource=y
#AutoIt3Wrapper_Add_Constants=n
#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7
#AutoIt3Wrapper_Run_Tidy=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#Region ;Wrapper
#pragma compile(UPX, false)
#AutoIt3Wrapper_Res_Icon_Add=Var.ico
;#AutoIt3Wrapper_Outfile=
;#AutoIt3Wrapper_Res_Comment=
;#AutoIt3Wrapper_Res_Description=
#EndRegion ;Wrapper
;=============================================================================
#Region ;FileInstall
FileInstall("Var.ico", @ScriptDir & "\Var.ico")
#EndRegion ;FileInstall
;=============================================================================
#include <Array.au3>
Local $File, $FileOpen, $FileRead
If FileExists(@ScriptDir & '\SearchVars.ini') Then FileDelete(@ScriptDir & '\SearchVars.ini')
If $cmdline[0] > 0 And FileExists($cmdline[1]) Then
    $File = $cmdline[1]
Else
    $File = FileOpenDialog('Au3 Var Searcher', @ScriptDir, 'Au3Files (*.au3)')
EndIf
$FileOpen = FileOpen($File)
$FileRead = FileRead($FileOpen)
FileClose($FileOpen)
Search()
Func Search()
    Local $FirstVar = ""
    Local $aArray = StringRegExp($FileRead, '(\$\w+)\W', 3) ;(\$[A-Za-z0-9_]+)[^A-Za-z0-9_] ;(\$[[:alnum:]_]+)[^[:alnum:]_]
    Local $aArray2 = _ArrayUnique($aArray, 0, 0)
    For $i = 1 To $aArray2[0]
        ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $aArray2[$i] = ' & $aArray2[$i] & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
        If UBound($aArray, 1) = 1 Then
            If $FirstVar = "" Then $FirstVar = $aArray[0]
            IniWrite(@ScriptDir & '\SearchVars.ini', 'Vars', $i, $aArray[0])
            ConsoleWrite($i & ' - ' & $aArray[0] & ' - ' & @MSEC & @CRLF)
        EndIf
    Next
    ;ShellExecute(@ScriptDir & '\SearchVars.ini')
    If $FirstVar <> "" Then SendSciTE_Command("find:" & $FirstVar)
EndFunc   ;==>Search
;=============================================================================

Func SendSciTE_Command($sCmd)
    Local $My_Hwnd = WinGetHandle("[ACTIVE]")
    Local $SciTE_hwnd = WinGetHandle("DirectorExtension")
    Local $CmdStruct = DllStructCreate('Char[' & StringLen($sCmd) + 1 & ']')
    DllStructSetData($CmdStruct, 1, $sCmd)
    Local $COPYDATA = DllStructCreate('Ptr;DWord;Ptr')
    DllStructSetData($COPYDATA, 1, 1)
    DllStructSetData($COPYDATA, 2, StringLen($sCmd) + 1)
    DllStructSetData($COPYDATA, 3, DllStructGetPtr($CmdStruct))
    DllCall('User32.dll', 'None', 'SendMessageA', 'HWnd', $SciTE_hwnd, _
            'Int', $WM_COPYDATA, 'HWnd', $My_Hwnd, _
            'Ptr', DllStructGetPtr($COPYDATA))
    ConsoleWrite('-->' & $sCmd & @CRLF)
EndFunc   ;==>SendSciTE_Command

Another idea could be that you display an warning in the SciTEconsole with the Linenumber and the Variable ( more or less like au3check does) and then you could simply click on those warning lines. 

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to post
Share on other sites

Amazing! I like that idea, im gonna try to see if i can discover au3check code on that.

Also gonna check that code. Many thanks!

PS got another idea which is to loop through the list, and using F3 + paste text in to the search window at every iteration.

This would highlight the word itself, which is what im after. Not as "backgroundish" as i intend, but it probably works reliably.

Edited by careca
Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to post
Share on other sites
  • Developers
8 minutes ago, careca said:

Amazing! I like that idea, im gonna try to see if i can discover au3check code on that.

Just do a consolewrite() with this format for each line/col variable you have a warning for:

"input filename"(line,column): your text

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to post
Share on other sites

Ah! sweet! Thank you so much! Now i just need to do a couple changes in order to get the line where the variable was found, and hopefuly all will go smoothly.

 

Edited by careca
Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to post
Share on other sites
#Region ;Wrapper
#pragma compile(UPX, false)
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_UseX64=n
#AutoIt3Wrapper_Run_Tidy=y
#AutoIt3Wrapper_Res_SaveSource=y
#AutoIt3Wrapper_Icon=Var.ico
#AutoIt3Wrapper_Res_Icon_Add=Var.ico
;#AutoIt3Wrapper_Outfile=
;#AutoIt3Wrapper_Res_Comment=
;#AutoIt3Wrapper_Res_Description=
#AutoIt3Wrapper_Res_Fileversion=1.0
#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7
#EndRegion ;Wrapper
;=============================================================================
#Region ;FileInstall
FileInstall("Var.ico", @ScriptDir & "\Var.ico")
#EndRegion ;FileInstall
;=============================================================================
#include <File.au3>
#include <Array.au3>
#include <Misc.au3>
#include <WinAPISysWin.au3>
#include <GuiListView.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <TrayConstants.au3>
#include <ListViewConstants.au3>
Opt("TrayMenuMode", 3)
Opt("TrayIconHide", 1)
Opt("GUIResizeMode", 1)
Opt("TrayIconDebug", 1)
Opt("TrayAutoPause", 0)
Opt("MouseCoordMode", 2)
Opt("GUIOnEventMode", 1)
Opt("MustDeclareVars", 1)
Opt("GUIEventOptions", 1)
Opt("TrayOnEventMode", 0)
Opt("ExpandEnvStrings", 1)
Opt("SendKeyDelay", 0) ;5 milliseconds
Opt("WinDetectHiddenText", 1)
Opt("WinTitleMatchMode", 2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase
Local $whdl = WinGetHandle('SciTE')
Local $Gui = GUICreate('Variables', 200, 300, @DesktopWidth - 200, @DesktopHeight / 2 - 150, $WS_SYSMENU, BitAND($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW), $whdl)
Local $LView = GUICtrlCreateListView('Vars', 3, 3, 197, 297)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 190)
GUISetOnEvent($GUI_EVENT_CLOSE, "Quit")
GUISetState(@SW_SHOW, $Gui)
Local $File, $FileOpen, $FileRead, $Window, $SearchCursorInfo, $GetLTLV, $GetItemTxt, $FRL, $StrLoc, $LVCount
Local $hDLL = "user32.dll"
If $cmdline[0] > 0 And FileExists($cmdline[1]) Then
    $File = $cmdline[1]
Else
    $File = FileOpenDialog('Au3 Var Searcher', @ScriptDir, 'Au3Files (*.au3)')
EndIf
If FileExists($File) Then
    Search()
Else
    MsgBox(64 + 262144, '', 'File Not Found')
    Exit
EndIf
;=============================================================================
Func Search()
    $FileOpen = FileOpen($File)
    $FileRead = FileRead($FileOpen)
    Local $aArray = StringRegExp($FileRead, '(\$\w+)\W', 3) ;(\$[A-Za-z0-9_]+)[^A-Za-z0-9_] ;(\$[[:alnum:]_]+)[^[:alnum:]_]
    If $aArray <> '' Then
        Local $aArray2 = _ArrayUnique($aArray, 0, 0)
        If $aArray2 <> '' Then
            For $i = 1 To $aArray2[0]
                $aArray = StringRegExp($FileRead, '(\' & $aArray2[$i] & '+)\W', 3)
                If UBound($aArray, 1) = 1 Then
                    If $i = $aArray2[0] Then
                        GUICtrlCreateListViewItem($aArray2[$i], $LView)
                    EndIf
                EndIf
            Next
        EndIf
    EndIf
    ;=============================================================================
    Local $LVCount = _GUICtrlListView_GetItemCount($LView)
    If $LVCount <> 0 Then
        Local $Count = _FileCountLines($File)
        For $v = 1 To $LVCount
            For $l = 1 To $Count
                $FRL = FileReadLine($FileOpen, $l)
                $StrLoc = StringInStr($FRL, _GUICtrlListView_GetItemText($LView, $v - 1, 0), 1, 1)
                If $StrLoc <> 0 Then
                    ConsoleWrite($File & '(' & $l & ', ' & $StrLoc & ') : Vars' & @CRLF)
                EndIf
            Next
        Next
    EndIf
    FileClose($FileOpen)
EndFunc   ;==>Search
;=============================================================================
Do ;Main
    Sleep(100)
Until GUIGetMsg() = $GUI_EVENT_CLOSE
;=============================================================================
Func Quit()
    Exit
EndFunc   ;==>Quit
;=============================================================================

Alright, this is the end result, it's very nice, but still, to be closer to perfection, it should be able to highlight the word.

Is there a way to do this? Im sorry for being annoying.

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to post
Share on other sites

HI, i left the gui there mainly for a visual on the found variables, but, as you can see,

im actually then using the items in that listview to search the script file, line by line

to get the line and position of the word.

So yes, when all is said and done, im using the consolewrite line you kindly provided.

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to post
Share on other sites

Hi, today i worked to include and combine what i previously had, with the function @Jos provided which sends a find command to scite on a listviewitem double click.

While it does seem to find, because the window scrolls to the word position, it doesn't highlight the word, any ideas on how to highlight the found word?

#Region ;Wrapper
#pragma compile(UPX, false)
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_UseX64=n
#AutoIt3Wrapper_Run_Tidy=y
#AutoIt3Wrapper_Res_SaveSource=y
#AutoIt3Wrapper_Icon=Var.ico
#AutoIt3Wrapper_Res_Icon_Add=Var.ico
;#AutoIt3Wrapper_Outfile=
;#AutoIt3Wrapper_Res_Comment=
;#AutoIt3Wrapper_Res_Description=
#AutoIt3Wrapper_Res_Fileversion=1.0
#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7
#EndRegion ;Wrapper
;=============================================================================
#Region ;FileInstall
FileInstall("Var.ico", @ScriptDir & "\Var.ico")
#EndRegion ;FileInstall
;=============================================================================
#include <File.au3>
#include <Array.au3>
#include <Misc.au3>
#include <WinAPISysWin.au3>
#include <GuiListView.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <TrayConstants.au3>
#include <ListViewConstants.au3>
Opt("TrayMenuMode", 3)
Opt("TrayIconHide", 1)
Opt("GUIResizeMode", 1)
Opt("TrayIconDebug", 1)
Opt("TrayAutoPause", 0)
Opt("MouseCoordMode", 2)
Opt("GUIOnEventMode", 1)
Opt("MustDeclareVars", 1)
Opt("GUIEventOptions", 1)
Opt("TrayOnEventMode", 0)
Opt("ExpandEnvStrings", 1)
Opt("SendKeyDelay", 0)
Opt("WinDetectHiddenText", 1)
Opt("WinTitleMatchMode", 2)
Local $whdl = WinGetHandle('SciTE')
Local $Gui = GUICreate('Variables', 200, 300, @DesktopWidth - 200, @DesktopHeight / 2 - 150, $WS_SYSMENU, BitAND($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW), $whdl)
Local $LView = GUICtrlCreateListView('Vars', 3, 3, 197, 297)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 190)
GUISetOnEvent($GUI_EVENT_CLOSE, "Quit")
GUISetState(@SW_SHOW, $Gui)
Local $File, $FileOpen, $FileRead, $Window, $SearchCursorInfo, $GetLTLV, $GetItemTxt, $FRL, $StrLoc, $LVCount, $CursorInfo, $StrExp
Local $hDLL = "user32.dll"
If $cmdline[0] > 0 And FileExists($cmdline[1]) Then
    $File = $cmdline[1]
Else
    $File = FileOpenDialog('Au3 Var Searcher', @ScriptDir, 'Au3Files (*.au3)')
EndIf
If FileExists($File) Then
    Search()
Else
    MsgBox(64 + 262144, '', 'File Not Found')
    Exit
EndIf
;=============================================================================
Func Search()
    $FileOpen = FileOpen($File)
    $FileRead = FileRead($FileOpen)
    Local $aArray = StringRegExp($FileRead, '(\$\w+)\W', 3) ;(\$[A-Za-z0-9_]+)[^A-Za-z0-9_] ;(\$[[:alnum:]_]+)[^[:alnum:]_]
    If $aArray <> '' Then
        Local $aArray2 = _ArrayUnique($aArray, 0, 1)
        If $aArray2 <> '' Then
            For $i = 1 To $aArray2[0]
                $StrExp = StringRegExp($FileRead, '(\' & $aArray2[$i] & '+)\W', 3)
                If UBound($StrExp, 1) = 1 Then
                    GUICtrlCreateListViewItem($aArray2[$i], $LView)
                EndIf
            Next
        EndIf
    EndIf
    ;=============================================================================
    Local $LVCount = _GUICtrlListView_GetItemCount($LView)
    If $LVCount <> 0 Then
        Local $Count = _FileCountLines($File)
        For $v = 1 To $LVCount
            For $l = 1 To $Count
                $FRL = FileReadLine($FileOpen, $l)
                $StrLoc = StringInStr($FRL, _GUICtrlListView_GetItemText($LView, $v - 1, 0), 1, 1)
                If $StrLoc <> 0 Then
                    ConsoleWrite($File & '(' & $l & ', ' & $StrLoc & ') : Vars' & @CRLF)
                EndIf
            Next
        Next
    EndIf
    FileClose($FileOpen)
EndFunc   ;==>Search
;=============================================================================
Do ;Main
    $Window = WinGetState($Gui)
    If BitAND($Window, 8) Then
        If _IsPressed("01", $hDLL) = True Then
            $CursorInfo = GUIGetCursorInfo($Gui)
            If $CursorInfo[4] = $LView Then
                $GetLTLV = _GUICtrlListView_GetNextItem($LView, -1, 0, 8)
                If $GetLTLV <> -1 Then
                    $GetItemTxt = _GUICtrlListView_GetItemText($LView, $GetLTLV, 0)
                    SendSciTE_Command("find:" & $GetItemTxt)
                EndIf
            EndIf
        EndIf
    EndIf
    Sleep(100)
Until GUIGetMsg() = $GUI_EVENT_CLOSE
;=============================================================================
Func SendSciTE_Command($sCmd)
    Local $My_Hwnd = WinGetHandle("[ACTIVE]")
    Local $SciTE_hwnd = WinGetHandle("DirectorExtension")
    Local $CmdStruct = DllStructCreate('Char[' & StringLen($sCmd) + 1 & ']')
    DllStructSetData($CmdStruct, 1, $sCmd)
    Local $COPYDATA = DllStructCreate('Ptr;DWord;Ptr')
    DllStructSetData($COPYDATA, 1, 1)
    DllStructSetData($COPYDATA, 2, StringLen($sCmd) + 1)
    DllStructSetData($COPYDATA, 3, DllStructGetPtr($CmdStruct))
    DllCall('User32.dll', 'None', 'SendMessageA', 'HWnd', $SciTE_hwnd, _
            'Int', $WM_COPYDATA, 'HWnd', $My_Hwnd, _
            'Ptr', DllStructGetPtr($COPYDATA))
    ConsoleWrite('-->' & $sCmd & @CRLF)
EndFunc   ;==>SendSciTE_Command
;=============================================================================
Func Quit()
    Exit
EndFunc   ;==>Quit
;=============================================================================

Thanks in advance.

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to post
Share on other sites
  • Developers

Something like this? :

#Region ;Wrapper
#pragma compile(UPX, false)
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_UseX64=n
#AutoIt3Wrapper_Run_Tidy=y
#AutoIt3Wrapper_Res_SaveSource=y
#AutoIt3Wrapper_Icon=Var.ico
#AutoIt3Wrapper_Res_Icon_Add=Var.ico
;#AutoIt3Wrapper_Outfile=
;#AutoIt3Wrapper_Res_Comment=
;#AutoIt3Wrapper_Res_Description=
#AutoIt3Wrapper_Res_Fileversion=1.0
#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7
#EndRegion ;Wrapper
;=============================================================================
#Region ;FileInstall
FileInstall("Var.ico", @ScriptDir & "\Var.ico")
#EndRegion ;FileInstall
;=============================================================================
#include <File.au3>
#include <Array.au3>
#include <Misc.au3>
#include <WinAPISysWin.au3>
#include <GuiListView.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <TrayConstants.au3>
#include <ListViewConstants.au3>
Opt("TrayMenuMode", 3)
Opt("TrayIconHide", 1)
Opt("GUIResizeMode", 1)
Opt("TrayIconDebug", 1)
Opt("TrayAutoPause", 0)
Opt("MouseCoordMode", 2)
Opt("GUIOnEventMode", 1)
Opt("MustDeclareVars", 1)
Opt("GUIEventOptions", 1)
Opt("TrayOnEventMode", 0)
Opt("ExpandEnvStrings", 1)
Opt("SendKeyDelay", 0)
Opt("WinDetectHiddenText", 1)
Opt("WinTitleMatchMode", 2)
Local $whdl = WinGetHandle('SciTE')
Local $Gui = GUICreate('Variables', 200, 300, @DesktopWidth - 200, @DesktopHeight / 2 - 150, $WS_SYSMENU, BitAND($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW), $whdl)
Local $LView = GUICtrlCreateListView('Vars', 3, 3, 197, 297)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 190)
GUISetOnEvent($GUI_EVENT_CLOSE, "Quit")
GUISetState(@SW_SHOW, $Gui)
Local $File, $FileOpen, $FileRead, $Window, $SearchCursorInfo, $GetLTLV, $GetItemTxt, $FRL, $StrLoc, $LVCount, $CursorInfo, $StrExp
Local $hDLL = "user32.dll"
If $cmdline[0] > 0 And FileExists($cmdline[1]) Then
    $File = $cmdline[1]
Else
    $File = FileOpenDialog('Au3 Var Searcher', @ScriptDir, 'Au3Files (*.au3)')
EndIf
If FileExists($File) Then
    Search()
Else
    MsgBox(64 + 262144, '', 'File Not Found')
    Exit
EndIf
;=============================================================================
Func Search()
    $FileOpen = FileOpen($File)
    $FileRead = FileRead($FileOpen)
    Local $aArray = StringRegExp($FileRead, '(\$\w+)\W', 3) ;(\$[A-Za-z0-9_]+)[^A-Za-z0-9_] ;(\$[[:alnum:]_]+)[^[:alnum:]_]
    If $aArray <> '' Then
        Local $aArray2 = _ArrayUnique($aArray, 0, 1)
        If $aArray2 <> '' Then
            For $i = 1 To $aArray2[0]
                $StrExp = StringRegExp($FileRead, '(\' & $aArray2[$i] & '+)\W', 3)
                If UBound($StrExp, 1) = 1 Then
                    GUICtrlCreateListViewItem($aArray2[$i], $LView)
                EndIf
            Next
        EndIf
    EndIf
    ;=============================================================================
    Local $LVCount = _GUICtrlListView_GetItemCount($LView)
    If $LVCount <> 0 Then
        Local $Count = _FileCountLines($File)
        For $v = 1 To $LVCount
            For $l = 1 To $Count
                $FRL = FileReadLine($FileOpen, $l)
                $StrLoc = StringInStr($FRL, _GUICtrlListView_GetItemText($LView, $v - 1, 0), 1, 1)
                If $StrLoc <> 0 Then
                    ConsoleWrite($File & '(' & $l & ', ' & $StrLoc & ') : Vars' & @CRLF)
                EndIf
            Next
        Next
    EndIf
    FileClose($FileOpen)
EndFunc   ;==>Search
;=============================================================================
Do ;Main
    $Window = WinGetState($Gui)
    If BitAND($Window, 8) Then
        If _IsPressed("01", $hDLL) = True Then
            $CursorInfo = GUIGetCursorInfo($Gui)
            If $CursorInfo[4] = $LView Then
                $GetLTLV = _GUICtrlListView_GetNextItem($LView, -1, 0, 8)
                If $GetLTLV <> -1 Then
                    $GetItemTxt = _GUICtrlListView_GetItemText($LView, $GetLTLV, 0)
                    WinActivate("[CLASS:SciTEWindow]")
                    SendSciTE_Command("find:" & $GetItemTxt)
                EndIf
            EndIf
        EndIf
    EndIf
    Sleep(100)
Until GUIGetMsg() = $GUI_EVENT_CLOSE
;=============================================================================
Func SendSciTE_Command($sCmd)
    Local $My_Hwnd = WinGetHandle("[CLASS:SciTEWindow]")
    Local $SciTE_hwnd = WinGetHandle("DirectorExtension")
    Local $CmdStruct = DllStructCreate('Char[' & StringLen($sCmd) + 1 & ']')
    DllStructSetData($CmdStruct, 1, $sCmd)
    Local $COPYDATA = DllStructCreate('Ptr;DWord;Ptr')
    DllStructSetData($COPYDATA, 1, 1)
    DllStructSetData($COPYDATA, 2, StringLen($sCmd) + 1)
    DllStructSetData($COPYDATA, 3, DllStructGetPtr($CmdStruct))
    DllCall('User32.dll', 'None', 'SendMessageA', 'HWnd', $SciTE_hwnd, _
            'Int', $WM_COPYDATA, 'HWnd', $My_Hwnd, _
            'Ptr', DllStructGetPtr($COPYDATA))
    ConsoleWrite('-->' & $sCmd & @CRLF)
EndFunc   ;==>SendSciTE_Command
;=============================================================================
Func Quit()
    Exit
EndFunc   ;==>Quit
;=============================================================================

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to post
Share on other sites

Totally forgot about the window focus!

Many thanks! It is perfect now.

 

 

Edited by careca
Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...