Jump to content

Search the Community

Showing results for tags 'grepwin'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. GrepWin CmdLine Editor to SciTE for those who don't know ! grepWin is a powerful and fast search tool using regular expressions I use it Regularly, so I said to order in AutoIt services more info: https://github.com/stefankueng/grepWin Script does Two Jobs case 1 : Act as editor for grepWin to start SciTE at a specific line in this case for it to work we have to go to the grepWin settings and in the section Editor in Command line to start an editor at a specific line: and give the follow "PathToAutoIt3.exe" "PathToThisScript.au3" |%path%|%line% where "PathToAutoIt3.exe" = the path to AutoIt3.exe "PathToThisScript.au3" = the path of this script |%path%|%line% = as it is main_setting: "C:\Program Files (x86)\AutoIt3\AutoIt3.exe" "D:\i\Pro\.AutoIT\SciTE_PlusBar\SciTE\CMD\GrepWinEditor.au3" |%path%|%line% and check the Only one instance CheckBox case 2 : Get the selected txt from SciTE and set as /searchfor: parameter to grepWin a dialog window opens to choose position / setting to search for which is dynamically updated from GrepWinEditor.ini The searchini , an ini file which contains all the values usually passed on the command line - /searchini:"path/to/inifile" [@ScriptDir], [1 Up], [2 Up] section do not change them, they update dynamically every time [@ScriptDir] = @ScriptDir [1 Up] = @ScriptDir & "\..\" [2 Up] = @ScriptDir & "\..\..\" [Default] = The Default setting if no parameter - do not change the Name the rest act as examples and they can change If you want for example after choose the @ScriptDir button to the search started immediately, without having to click the search button first put in the GrepWinEditor.ini in section [@ScriptDir] the entry execute= Command line parameters for grepWin Tested with grepWin-2.0.13_portable -x86 ; https://www.autoitscript.com/forum/topic/210301-grepwineditor/ ;------------------------------------------------------------------------------ ; Title...........: GrepWinEditor.au3 ; Description.....: GrepWin CmdLine Editor to SciTE ;------------------------------------------------------------------------------ #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=..\ICO\GrepWinEditor.ico #AutoIt3Wrapper_Res_Comment=GrepWin_CmdLine_Editor_Setting: "PathToAutoIt3.exe" "PathToThisScript.au3" |%path%|%line% #AutoIt3Wrapper_Res_Description=GrepWin CmdLine Editor to SciTE #AutoIt3Wrapper_Res_Fileversion=0.0.0.9 #AutoIt3Wrapper_Res_ProductName=GrepWinEditor.au3 #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <FileConstants.au3> #include <EditConstants.au3> #include <MsgBoxConstants.au3> #include <ButtonConstants.au3> #include <SendMessage.au3> #include <File.au3> #include <Array.au3> Global $sGrepWinExe = 'D:\i\Pro\grepWin-x86\grepWin_portable.exe' ;ℹ️ Add your path to grepWin <- Global $iShowGuiCtrlTip = 1 ;ℹ️ Set to 0 to hide the GuiCtrlTip <- Global $MyIni = StringTrimRight(@ScriptFullPath, 4) & ".ini" Global $hSciTE_hWnd = WinGetHandle("[CLASS:SciTEWindow]", "") Global $hScite_Editor_hWnd = ControlGetHandle($hSciTE_hWnd, '', '[CLASS:Scintilla; INSTANCE:1]') Global $iParams, $hGrepWin_hWnd $iParams = $CmdLine[0] If Not $iParams Then Global $SciTE_CurrentFile, $SciTE_SelectetTxt $SciTE_SelectetTxt = _SciTE_GetSelection() ConsoleWrite("- $SciTE_CurrentFile=" & $SciTE_CurrentFile & @CRLF) ConsoleWrite("- $SciTE_SelectetTxt=" & $SciTE_SelectetTxt & @CRLF) _GrepWinGui($SciTE_SelectetTxt) Else $iParams = $CmdLine ;~ _TestGUI($CmdLineRaw) _OpenWithSciTE() EndIf Exit ;---------------------------------------------------------------------------------------- Func _SciTE_GetSelection() ;Return the Current SciTE Selection Local $ClipBack, $sClip $SciTE_CurrentFile = "" $ClipBack = ClipGet() ; backup clip data ;get first the $SciTE_CurrentFile ClipPut("<Empty>") ; <Empty> WinMenuSelectItem($hSciTE_hWnd, "", "&File", "Copy Pat&h") Sleep(50) Local $ScriptFullPath = ClipGet() Sleep(50) ConsoleWrite("--- $ScriptFullPath=" & $ScriptFullPath & @CRLF) If FileExists($ScriptFullPath) Then $SciTE_CurrentFile = $ScriptFullPath EndIf ; and then get the $SciTE_SelectetTxt ClipPut("<Empty>") ; <Empty> _SendMessage($hScite_Editor_hWnd, $WM_COPY) Sleep(100) ; * <- $sClip = ClipGet() ClipPut($ClipBack) ; Restore clip data If $sClip = "<Empty>" Then Return SetError(1, 0, "") Else Return $sClip EndIf EndFunc ;==>_SciTE_GetSelection ;---------------------------------------------------------------------------------------- Func _OpenWithSciTE() ;$CmdLineRaw order and send it to SciTE ; ℹ️ important information ; in GrepWin settings in 'Command line to start an editor at a specific line:' give the follow string ; "PathToAutoIt3.exe" "PathToThisScript.au3" |%path%|%line% ; main:"C:\Program Files (x86)\AutoIt3\AutoIt3.exe" "D:\i\Pro\.AutoIT\SciTE_PlusBar\SciTE\CMD\GrepWinEditor.au3" |%path%|%line% ; ; then '|%path%|%line%' whill transformet to this. and send it to SciTE ; "-open:D:\\i\\Pro\\.AutoIT\\_Test\\_CreateContextMenu\\TrayMsg.au3" -goto:27 Local $aSpl = StringSplit($CmdLineRaw, "|") If $aSpl[0] = 3 Then Local $sCmdStr = '"-open:' & StringReplace($aSpl[2], "\", "\\") & '" -goto:' & $aSpl[3] ConsoleWrite("-- $sCmdStr=" & $sCmdStr & @CRLF) ShellExecute('C:\Program Files (x86)\AutoIt3\SciTE\SciTE.exe', $sCmdStr) EndIf EndFunc ;==>_OpenWithSciTE ;---------------------------------------------------------------------------------------- Func _TestGUI($Str) ; Test GUI Local $hGUI = GUICreate("Test GUI", 400, 151, 17, 552, -1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST, $WS_EX_NOACTIVATE)) GUICtrlCreateInput($Str, 10, 10, 381, 91, $ES_MULTILINE) Local $Button_Ok = GUICtrlCreateButton("OK", 140, 110, 91, 31) GUISetState(@SW_SHOWNORMAL, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $Button_Ok Exit Case Else ; EndSwitch WEnd EndFunc ;==>_TestGUI ;---------------------------------------------------------------------------------------- Func _GrepWinCall($CmdSectionName = Default, $sCmdSearchFor = Default, $sCmdRegex = Default, $sCmdSearchPath = Default) ; ℹ️ important information ; https://tools.stefankueng.com/grepWin_cmd.html ; /searchpath:"path" sets the path to search in ; /searchfor:"regex or text" ; /regex:[yes|no] ; /searchini:"path/to/inifile" ; /name:"sectionname" argument ; main: ; /name:"sectionname" /searchini:"path" ; '/name:"Default" /searchini:"D:\i\Pro\.AutoIT\SciTE_PlusBar\SciTE\CMD\GrepWinEditor.ini"' ; chek if GrepWin is open and close it $hGrepWin_hWnd = WinGetHandle("[TITLE:grepWin; CLASS:#32770]") If WinExists($hGrepWin_hWnd) Then ConsoleWrite("! WinExists($hGrepWin_hWnd)" & @CRLF) ConsoleWrite("- WinClose=" & WinClose($hGrepWin_hWnd) & @CRLF) Sleep(100) EndIf Local $sCmdStr If $CmdSectionName = Default Then $CmdSectionName = "Default" If $sCmdSearchFor = Default Then $sCmdSearchFor = "" If $sCmdRegex = Default Then $sCmdRegex = "" If $sCmdSearchPath = Default Then $sCmdSearchPath = "" $sCmdStr = '/name:"' & $CmdSectionName & '"' $sCmdStr &= ' /searchini:"' & $MyIni & '"' If $sCmdSearchPath Then $sCmdStr &= ' /searchpath:"' & $sCmdSearchPath & '"' If Not $sCmdRegex Then $sCmdRegex = 'no' EndIf If $sCmdSearchFor Then $sCmdStr &= ' /searchfor:"' & $sCmdSearchFor & '"' If Not $sCmdRegex Then $sCmdRegex = 'no' EndIf If $sCmdRegex Then $sCmdStr &= ' /regex:"' & $sCmdRegex & '"' ConsoleWrite("- $sCmdStr=" & $sCmdStr & @CRLF) ShellExecute($sGrepWinExe, $sCmdStr) EndFunc ;==>_GrepWinCall ;---------------------------------------------------------------------------------------- Func _GrepWinGui($sCmdSearchFor = "", $sCmdRegex = "", $sCmdSearchPath = "") ; Ini Read Local $MyGui Local $iniFileExists = FileExists($MyIni) Local $index = 0 Local $aArray[1][3] $aArray[0][0] = $index $aArray[0][1] = "Button_ID" $aArray[0][2] = "SearchPath" #Region ===( Checks if .ini not exists then make one. )=== ; ℹ️ important information ; Make the searchini , an ini file which contains all the values usually passed on the command line ; [@ScriptDir], [1 Up], [2 Up] section do not change them, they update dynamically evry time ; [@ScriptDir] = @ScriptDir ; [1 Up] = @ScriptDir & "\..\" ; [2 Up] = @ScriptDir & "\..\..\" ; [Default] = The Default setting if no parameter - do not change the Name ; the rest act as examples and they can change ; https://tools.stefankueng.com/grepWin_cmd.html ; https://github.com/stefankueng/grepWin/releases/tag/2.0.13 If Not $iniFileExists Then ;Open the file for writing (append to the end of a file) and store the handle to a variable. Local $hFileOpen = FileOpen($MyIni, $FO_APPEND + $FO_UTF8_NOBOM) If $hFileOpen = -1 Then MsgBox($MB_SYSTEMMODAL, "", "An error occurred while writing the " & @CRLF & $MyIni) Exit EndIf Local $spExamples = StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", $STR_NOCASESENSEBASIC, -1) - 1) & "\Examples" Local $spInclude = StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", $STR_NOCASESENSEBASIC, -1) - 1) & "\Include" Local $sTxt = "" $sTxt &= "[@ScriptDir]" & @CRLF $sTxt &= "searchpath=" & @CRLF $sTxt &= "regex=no" & @CRLF $sTxt &= "filemask=*.au3" & @CRLF $sTxt &= "direxcluderegex=BackUp" & @CRLF $sTxt &= "[1 Up]" & @CRLF $sTxt &= "searchpath=" & @CRLF $sTxt &= "regex=no" & @CRLF $sTxt &= "filemask=*.au3" & @CRLF $sTxt &= "direxcluderegex=BackUp" & @CRLF $sTxt &= "[2 Up]" & @CRLF $sTxt &= "searchpath=" & @CRLF $sTxt &= "regex=no" & @CRLF $sTxt &= "filemask=*.au3" & @CRLF $sTxt &= "direxcluderegex=BackUp" & @CRLF $sTxt &= "[Default]" & @CRLF $sTxt &= "searchpath=" & @MyDocumentsDir & @CRLF $sTxt &= "regex=no" & @CRLF $sTxt &= "filemask=*.au3" & @CRLF $sTxt &= "direxcluderegex=BackUp" & @CRLF $sTxt &= "[AutoIt3 -Examples]" & @CRLF $sTxt &= "searchpath=" & $spExamples & @CRLF $sTxt &= "regex=no" & @CRLF $sTxt &= "filemask=*.au3" & @CRLF $sTxt &= "direxcluderegex=BackUp" & @CRLF $sTxt &= "[AutoIt3 -Include]" & @CRLF $sTxt &= "searchpath=" & $spInclude & @CRLF $sTxt &= "regex=no" & @CRLF $sTxt &= "filemask=*.au3" & @CRLF $sTxt &= "direxcluderegex=BackUp" & @CRLF $sTxt &= "[All]" & @CRLF $sTxt &= "searchpath=" & @MyDocumentsDir & "|" & $spExamples & "|" & $spInclude & "|" & @CRLF $sTxt &= "regex=no" & @CRLF $sTxt &= "filemask=*.au3" & @CRLF $sTxt &= "direxcluderegex=BackUp" & @CRLF $sTxt &= "searchfor=search for All" & @CRLF ;Write data to the file using the handle returned by FileOpen. FileWrite($hFileOpen, $sTxt) ;Close the handle returned by FileOpen. FileClose($hFileOpen) Sleep(200) ShellExecute($MyIni) EndIf #EndRegion ===( Checks if .ini not exists then make one. )=== Local $iPosition, $sScriptDir, $sUp1, $sUp2 If $SciTE_CurrentFile Then $iPosition = StringInStr($SciTE_CurrentFile, "\", 0, -1) $sScriptDir = StringLeft($SciTE_CurrentFile, $iPosition - 1) ConsoleWrite("- $sScriptDir=" & $sScriptDir & @CRLF) $sUp1 = $sScriptDir $sUp2 = $sScriptDir $iPosition = StringInStr($SciTE_CurrentFile, "\", 0, -2) If $iPosition Then $sUp1 = StringLeft($SciTE_CurrentFile, $iPosition - 1) ConsoleWrite("- $sUp1=" & $sUp1 & @CRLF) $iPosition = StringInStr($SciTE_CurrentFile, "\", 0, -3) If $iPosition Then $sUp2 = StringLeft($SciTE_CurrentFile, $iPosition - 1) ConsoleWrite("- $sUp2=" & $sUp2 & @CRLF) EndIf ;prepare the @ScriptDir section IniWrite($MyIni, "@ScriptDir", "searchpath", $sScriptDir) IniWrite($MyIni, "1 Up", "searchpath", $sUp1) IniWrite($MyIni, "2 Up", "searchpath", $sUp2) Sleep(200) ;give some time to IniWrite ;Read the INI section names. This will return a 1 dimensional array. Local $aSections = IniReadSectionNames($MyIni) ;Check if an error occurred. If Not @error Then ;Enumerate through the array displaying the section names. For $i = 1 To $aSections[0] ReDim $aArray[UBound($aArray) + 1][3] $index += 1 $aArray[0][0] = $index ; cnt $aArray[$index][0] = $aSections[$i] $aArray[$index][2] = IniRead($MyIni, $aSections[$i], "searchpath", "default") ;SearchPath Next EndIf Local $iElements, $iOffset $iElements = $aArray[0][0] If $iElements > 0 Then $iOffset = 25 $MyGui = GUICreate("SearchFor: " & $sCmdSearchFor, 300, ($iElements * $iOffset) + 1, @DesktopWidth / 3, @DesktopHeight / 4, -1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST)) For $i = 1 To $iElements If $i = 1 Then $aArray[$i][1] = GUICtrlCreateButton($aArray[$i][0], 1, 0, 298, $iOffset, $BS_VCENTER) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") If $iShowGuiCtrlTip Then GUICtrlSetTip(-1, $aArray[$i][2]) Else $aArray[$i][1] = GUICtrlCreateButton($aArray[$i][0], 1, ($i - 1) * $iOffset, 298, $iOffset, $BS_VCENTER) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") If $iShowGuiCtrlTip Then GUICtrlSetTip(-1, $aArray[$i][2]) EndIf Next GUISetState(@SW_SHOW, $MyGui) ;~ _ArrayDisplay($aArray) Local $ID, $sSectionName While 1 $ID = GUIGetMsg() Switch $ID Case $GUI_EVENT_CLOSE Exit Case $aArray[1][1] To $aArray[$aArray[0][0]][1] $sSectionName = $aArray[$ID - 2][0] ConsoleWrite("- $sSectionName=" & $sSectionName & @CRLF) _GrepWinCall($sSectionName, $sCmdSearchFor, $sCmdRegex, $sCmdSearchPath) ExitLoop Case Else ; EndSwitch WEnd GUIDelete($MyGui) EndIf EndFunc ;==>_GrepWinGui ;---------------------------------------------------------------------------------------- Please, leave your comments and experiences here. thank you very much !
×
×
  • Create New...