Advertisement
Najeebsk

SEARCH-TEXT4.ahk

Apr 17th, 2023
1,541
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*   INFO
  2.    NAJEEB SEARCH TEXT UTILITY 2023
  3.    Written by: Najeeb Shah Khan (najeebshahkhan@gmail.com)
  4.    Last Modified: 3-25-2023
  5. */
  6. ;#warn
  7. #NoEnv
  8. #LTrim
  9. #SingleInstance, Force
  10. Process, Priority, , A
  11. SendMode, Input
  12. SetBatchLines, -1
  13. ;#NoTrayIcon
  14. SetKeyDelay 0    ; In case SendInput is not available
  15. SetTitleMatchMode RegEx
  16. SetWorkingDir %A_WorkingDir% ;%A_ScriptDir%
  17. ;FileSelectFile, SelectedFile, 3, , Open a file
  18. ;FileRead, FileContents, %SelectedFile%
  19. ;FileRead, contents, %SelectedFile%
  20. ;Sort, FileContents
  21. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  22. FileCreateDir, %A_ScriptDir%\DATA
  23. FileInstall , SEARCH-TEXT4.ahk, %A_ScriptDir%\DATA\SEARCH-TEXT4.ahk, 1
  24. FileInstall , S12.she, %A_ScriptDir%\DATA\S12.she, 1
  25. FileInstall , SkinH_EL.dll, %A_ScriptDir%\DATA\SkinH_EL.dll, 1
  26. FileSetAttrib +HS, %A_ScriptDir%\DATA\S12.she, 2
  27. FileSetAttrib +HS, %A_ScriptDir%\DATA\SkinH_EL.dll, 2
  28. FileSetAttrib +HS, %A_ScriptDir%\DATA\SEARCH-TEXT4.ahk, 2
  29. FileSetAttrib +HS, %A_ScriptDir%\DATA, 2
  30. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  31. SkinForm(Apply, A_ScriptDir . "\DATA\SkinH_EL.dll", A_ScriptDir . "\DATA\S12.she")
  32. OnExit, GetOut
  33. Gui, 1: New,, Search in Text Files
  34. Gui, Color, 091D33, 091D33
  35. Gui, Font, s16 cDDDDDD, Calibri
  36. Gui, Add,Text,X50 Y7, ~~~************ NAJEEB SEARCH TEXT UTILITY 2023************~~~
  37. Gui, Font, s12 cDDDDDD, Calibri
  38. Gui, Add, Button,gBrowse x616 y40 w90 h30 , Browse
  39. Gui, Add, Text, x10 y44 h20, Enter the string to search
  40. Gui, Add, Edit, x186 y40 h30 w425 vQuery gShowResult
  41. Gui, Add, Edit, vTex x10 y80 w700 h520
  42. Gui, Add, Button,gClip x616 y610 w90 h30 , Clip Text
  43. Gui, Show, w720 h650, NAJEEB SEARCH A TEXT
  44. Return
  45. ShowResult:
  46.   GuiControlGet, Query
  47.    p := ""
  48.    for k, v in StrSplit(Query, " ")
  49.       (v != "" && p .= "\V*\Q" . v . "\E")
  50.    p .= "\V*\R?"
  51.    text := Query = "" ? "" : RegExReplace(contents, "si).*?(" . p . ")|.*", "$1")
  52.    GuiControl,, Edit2, % text
  53.    Return
  54. Browse:
  55. FileSelectFile, SelectedFile, 3, , Open a file
  56. FileRead, contents, %SelectedFile%
  57. ;Sort, FileContents
  58. Return
  59. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  60. GetOut:
  61. ;GuiClose:
  62. Gui, Hide
  63. SkinForm(0)
  64. ExitApp
  65. return
  66.  
  67. SkinForm(Param1 = "Apply", DLL = "", SkinName = ""){
  68.     if(Param1 = Apply){
  69.         DllCall("LoadLibrary", str, DLL)
  70.         DllCall(DLL . "\SkinH_AttachEx", AStr,SkinName, Str,"mhgd")
  71.     }else if(Param1 = 0){
  72.         DllCall(DLL . "\USkinExit")
  73.         }
  74. }
  75. Clip:
  76. Gui, Submit, NoHide
  77.  Clipboard := Tex
  78. Return
  79. ;=-=-=-=-=-=-=-=-=-=- END SCRIPT -=-=-=-=-=-=-=-=-=-=-=-
  80. #R::Reload
  81. #S::Suspend
  82. #P::Pause
  83. ESC::ExitApp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement