Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* INFO
- NAJEEB SEARCH TEXT UTILITY 2023
- Written by: Najeeb Shah Khan (najeebshahkhan@gmail.com)
- Last Modified: 3-25-2023
- */
- ;#warn
- #NoEnv
- #LTrim
- #SingleInstance, Force
- Process, Priority, , A
- SendMode, Input
- SetBatchLines, -1
- ;#NoTrayIcon
- SetKeyDelay 0 ; In case SendInput is not available
- SetTitleMatchMode RegEx
- SetWorkingDir %A_WorkingDir% ;%A_ScriptDir%
- ;FileSelectFile, SelectedFile, 3, , Open a file
- ;FileRead, FileContents, %SelectedFile%
- ;FileRead, contents, %SelectedFile%
- ;Sort, FileContents
- ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- FileCreateDir, %A_ScriptDir%\DATA
- FileInstall , SEARCH-TEXT4.ahk, %A_ScriptDir%\DATA\SEARCH-TEXT4.ahk, 1
- FileInstall , S12.she, %A_ScriptDir%\DATA\S12.she, 1
- FileInstall , SkinH_EL.dll, %A_ScriptDir%\DATA\SkinH_EL.dll, 1
- FileSetAttrib +HS, %A_ScriptDir%\DATA\S12.she, 2
- FileSetAttrib +HS, %A_ScriptDir%\DATA\SkinH_EL.dll, 2
- FileSetAttrib +HS, %A_ScriptDir%\DATA\SEARCH-TEXT4.ahk, 2
- FileSetAttrib +HS, %A_ScriptDir%\DATA, 2
- ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- SkinForm(Apply, A_ScriptDir . "\DATA\SkinH_EL.dll", A_ScriptDir . "\DATA\S12.she")
- OnExit, GetOut
- Gui, 1: New,, Search in Text Files
- Gui, Color, 091D33, 091D33
- Gui, Font, s16 cDDDDDD, Calibri
- Gui, Add,Text,X50 Y7, ~~~************ NAJEEB SEARCH TEXT UTILITY 2023************~~~
- Gui, Font, s12 cDDDDDD, Calibri
- Gui, Add, Button,gBrowse x616 y40 w90 h30 , Browse
- Gui, Add, Text, x10 y44 h20, Enter the string to search
- Gui, Add, Edit, x186 y40 h30 w425 vQuery gShowResult
- Gui, Add, Edit, vTex x10 y80 w700 h520
- Gui, Add, Button,gClip x616 y610 w90 h30 , Clip Text
- Gui, Show, w720 h650, NAJEEB SEARCH A TEXT
- Return
- ShowResult:
- GuiControlGet, Query
- p := ""
- for k, v in StrSplit(Query, " ")
- (v != "" && p .= "\V*\Q" . v . "\E")
- p .= "\V*\R?"
- text := Query = "" ? "" : RegExReplace(contents, "si).*?(" . p . ")|.*", "$1")
- GuiControl,, Edit2, % text
- Return
- Browse:
- FileSelectFile, SelectedFile, 3, , Open a file
- FileRead, contents, %SelectedFile%
- ;Sort, FileContents
- Return
- ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- GetOut:
- ;GuiClose:
- Gui, Hide
- SkinForm(0)
- ExitApp
- return
- SkinForm(Param1 = "Apply", DLL = "", SkinName = ""){
- if(Param1 = Apply){
- DllCall("LoadLibrary", str, DLL)
- DllCall(DLL . "\SkinH_AttachEx", AStr,SkinName, Str,"mhgd")
- }else if(Param1 = 0){
- DllCall(DLL . "\USkinExit")
- }
- }
- Clip:
- Gui, Submit, NoHide
- Clipboard := Tex
- Return
- ;=-=-=-=-=-=-=-=-=-=- END SCRIPT -=-=-=-=-=-=-=-=-=-=-=-
- #R::Reload
- #S::Suspend
- #P::Pause
- ESC::ExitApp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement