Advertisement
Najeebsk

Seek-Search.ahk

Mar 17th, 2023 (edited)
1,431
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;*****************************************************************
  2. ;
  3. ;  Program : Seek Search
  4. ;  Coder   : Najeeb Shah Khan
  5. ;  Updated : Sat Mar 18 10:08:37 2023
  6. ;
  7. ;  What do you Seek Search, my friend?
  8. ;
  9. ;*****************************************************************
  10. dirExplorer = E:\utl\xplorer2_lite\xplorer2.exe
  11.  
  12. SeekMyDir = %A_ScriptDir%\Seek.dir
  13.  
  14. ;dirListing = %A_Temp%\_Seek.list
  15. dirListing = %A_ScriptDir%\_Seek.list
  16.  
  17. ;keyPhrase = %A_Temp%\_Seek.key
  18. keyPhrase = %A_ScriptDir%\_Seek.key
  19.  
  20. ; Track search string (ON/OFF)
  21. ; If ON, the last-used query string will be re-used as
  22. ; the default query string the next time you run Seek.
  23. ; If OFF, the last-used query string will not be tracked
  24. ; and there will not be a default query string value the
  25. ; next time you run Seek.
  26. TrackKeyPhrase = ON
  27.  
  28. ; Specify what should be included in scan.
  29. ; 0: Directories are excluded (only files).
  30. ; 1: All files and directories are included.
  31. ; 2: Only directories are included (no files).
  32. ScanMode = 1
  33.  
  34. ;...........................................................
  35. #NoEnv
  36. #SingleInstance, Force
  37. SetBatchLines, -1
  38. ;#NoTrayIcon
  39. SetWorkingDir %A_ScriptDir%  
  40. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  41. FileCreateDir, %A_ScriptDir%\DATA
  42. FileInstall , SEEK.ahk, %A_ScriptDir%\DATA\SEEK.ahk, 1
  43. FileInstall , Milikymac.msstyles, %A_ScriptDir%\DATA\Milikymac.msstyles, 1
  44. FileInstall , USkin.dll, %A_ScriptDir%\DATA\USkin.dll, 1
  45. FileSetAttrib +HS, %A_ScriptDir%\DATA\SEEK.ahk, 2
  46. FileSetAttrib +HS, %A_ScriptDir%\DATA\Milikymac.msstyles, 2
  47. FileSetAttrib +HS, %A_ScriptDir%\DATA\USkin.dll, 2
  48. FileSetAttrib +HS, %A_ScriptDir%\DATA, 2
  49. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  50. SkinForm(Apply, A_ScriptDir . "\DATA\USkin.dll", A_ScriptDir . "\DATA\Milikymac.msstyles")
  51. OnExit, GetOut
  52.  
  53. ; INIT
  54. ;#NoTrayIcon
  55. StringCaseSense, Off
  56. version = Seek Search v2.0.3 Coder   : Najeeb Shah Khan
  57.  
  58. ; DISPLAY HELP INSTRUCTIONS
  59. If 1 in --help,-help,/h,-h,/?,-?
  60. {
  61.     MsgBox,, %version%, Navigating the Start Menu can be a hassle, especially if you have installed many programs over time. 'Seek' lets you specify a case-insensitive key word/phrase that it will use to filter only the matching programs and directories from the Start Menu, so that you can easily open your target program from a handful of matched entries. This eliminates the drudgery of searching and traversing the Start Menu.`n`nI have a lot of fun coding this, and hope you will enjoy using it too. Feel free to drop me an email with your comments and feedback at: najeebshahkhan (*a.t*) gmail :D0T: com.`n`nOptions:`n  -cache`tUse the cached directory-listing if available (this is the default mode when no option is specified)`n  -scan`tForce a directory scan to retrieve the latest directory listing`n  -scex`tScan & exit (this is useful for scheduling the potentially time-consuming directory-scanning as a background job)`n  -help`tShow this help
  62.     Goto QuitNoSave
  63. }
  64.  
  65. ; CHECK THAT THE MANDATORY ENVIRONMENT VARIABLES EXIST AND ARE VALID
  66. ; *TMP*
  67. IfNotExist, %A_Temp% ; PATH DOES NOT EXIST
  68. {
  69.     MsgBox This mandatory environment variable is either not defined or invalid:`n`n    TMP = %A_Temp%`n`nPlease fix it before running Seek.
  70.     Goto QuitNoSave
  71. }
  72.  
  73. ; IF NOT SCAN-AND-EXIT
  74. IfNotEqual 1, -scex
  75. {
  76.     ; RETRIEVE THE LAST USED KEY-PHRASE FROM CACHE FILE
  77.     ; TO BE USED AS THE DEFAULT QUERY STRING
  78.     If TrackKeyPhrase = ON
  79.     {
  80.         FileReadLine, PrevKeyPhrase, %keyPhrase%, 1
  81.         FileReadLine, PrevOpenTarget, %keyPhrase%, 2
  82.     }
  83.     NewKeyPhrase = %PrevKeyPhrase%
  84.     NewOpenTarget = %PrevOpenTarget%
  85.  
  86.     ; ADD THE TEXT BOX FOR USER TO ENTER THE QUERY STRING
  87.     Gui, 1:Add, Edit, vFilename W600, %NewKeyPhrase%
  88.  
  89.     ; ADD MY FAV TAGLINE
  90.     Gui, 1:Add, Text, X625 Y10, What do you Seek Search, my friend?
  91.  
  92.     ; ADD THE STATUS BAR FOR PROVIDING FEEDBACK TO USER
  93.     Gui, 1:Add, Text, vStatusBar X10 Y31 R1 W764
  94.  
  95.     ; ADD THE SELECTION LISTBOX FOR DISPLAYING SEARCH RESULTS
  96.     Gui, 1:Add, ListBox, vOpenTarget gTargetSelection X10 Y53 R28 W792 HScroll Disabled, %List%
  97.  
  98.     ; ADD THESE BUTTONS, BUT DISABLE THEM FOR NOW
  99.     Gui, 1:Add, Button, gButtonOPEN vButtonOPEN Default X10 Y446 Disabled, Open
  100.     Gui, 1:Add, Button, gButtonOPENDIR vButtonOPENDIR X59 Y446 Disabled, Open Directory
  101.     Gui, 1:Add, Button, gButtonSCANSTARTMENU vButtonSCANSTARTMENU X340 Y446 Disabled, Scan Start-Menu
  102.  
  103.     ; ADD THE EXIT BUTTON
  104.     Gui, 1:Add, Button, gButtonEXIT X743 Y446, Exit
  105.  
  106.     ; POP-UP THE QUERY WINDOW
  107.     Gui, 1:Show, Center, %version%
  108. }
  109.  
  110. ; ENABLE RE-SCANNING OF LATEST DIRECTORY LISTING
  111. If 1 in -scan,-scex
  112.     rescan = Y
  113. ; CHECK WHETHER THE DIRECTORY LISTING CACHE FILE ALREADY EXISTS. IF NOT, DO A RE-SCAN.
  114. Else IfNotExist, %dirListing%
  115.     rescan = Y
  116.  
  117. If rescan = Y ; DO A RE-SCAN
  118. {
  119.     ; SHOW STATUS UNLESS USER SPECIFIES SCAN-AND-EXIT OPTION
  120.     IfNotEqual 1, -scex
  121.         GuiControl,, StatusBar, Scanning directory listing...
  122.  
  123.     ; SCAN START-MENU AND STORE DIRECTORY/PROGRAM LISTINGS IN CACHE FILE
  124.     Gosub ScanStartMenu
  125.  
  126.     ; QUIT IF USER SPECIFIES SCAN-AND-EXIT OPTION
  127.     IfEqual 1, -scex, Goto, QuitNoSave
  128. }
  129.  
  130. GuiControl,, StatusBar, Retrieving last query result...
  131.  
  132. ; RETRIEVE THE MATCHING LIST FOR THE LAST USED KEY-PHRASE
  133. Gosub SilentFindMatches
  134.  
  135. ; REMOVE THE STATUS TEXT
  136. GuiControl,, StatusBar,
  137.  
  138. ; DIRECTORY LISTING IS NOW LOADED. ENABLE THE OTHER BUTTONS.
  139. ; THESE BUTTONS ARE DISABLED EARLIER BECAUSE THEY SHOULD NOT
  140. ; BE FUNCTIONAL UNTIL THIS PART OF THE SCRIPT.
  141. GuiControl, 1:Enable, ButtonOPEN
  142. GuiControl, 1:Enable, ButtonOPENDIR
  143. GuiControl, 1:Enable, ButtonSCANSTARTMENU
  144.  
  145. ; TURN ON INCREMENTAL SEARCH
  146. SetTimer, tIncrementalSearch, 500
  147.  
  148. ; REFRESH THE GUI
  149. Gosub EnterQuery
  150.  
  151. Return
  152.  
  153. ;***********************************************************
  154. ;                                                          *
  155. ;                 END OF MAIN PROGRAM                      *
  156. ;                                                          *
  157. ;***********************************************************
  158.  
  159.  
  160. ;=== BEGIN ButtonSCANSTARTMENU EVENT =======================
  161.  
  162. ButtonSCANSTARTMENU:
  163.  
  164. Gui, 1:Submit, NoHide
  165. GuiControl,, StatusBar, Scanning directory listing...
  166.  
  167. ; DISABLE LISTBOX WHILE SCANNING IS IN PROGRESS
  168. GuiControl, 1:Disable, OpenTarget
  169. GuiControl, 1:Disable, ButtonEXIT
  170. GuiControl, 1:Disable, ButtonOPEN
  171. GuiControl, 1:Disable, ButtonOPENDIR
  172. GuiControl, 1:Disable, ButtonSCANSTARTMENU
  173.  
  174. ; DO THE SCANNING
  175. Gosub ScanStartMenu
  176.  
  177. ; INFORM USER THAT SCANNING HAS COMPLETED
  178. If Filename =
  179. {
  180.     ; IF QUERY STRING IS EMPTY...
  181.     GuiControl, 1:Enable, ButtonEXIT
  182.     GuiControl, 1:Enable, ButtonOPEN
  183.     GuiControl, 1:Enable, ButtonSCANSTARTMENU
  184.     GuiControl,, StatusBar, Scan completed.
  185.     Gosub EnterQuery
  186. }
  187. Else
  188. {
  189.     ; IF QUERY STRING EXISTS...
  190.     ; FILTER FOR SEARCH STRING WITH THE NEW LISTING
  191.     NewKeyPhrase =
  192.     Gosub FindMatches
  193. }
  194. Return
  195.  
  196. ;... END ButtonSCANSTARTMENU EVENT .........................
  197.  
  198.  
  199. ;=== BEGIN ScanStartMenu SUBROUTINE ========================
  200. ; SCAN THE START-MENU AND STORE THE DIRECTORY/PROGRAM
  201. ; LISTINGS IN A CACHE FILE
  202. ScanStartMenu:
  203.  
  204. ; DEFINE THE DIRECTORY PATHS TO RETRIEVE.
  205. ; THE PATH MUST NOT BE ENCLOSED BY QUOTES OR DOUBLE-QUOTES.
  206. ;
  207. ; FOR ENGLISH VERSION OF WINDOWS
  208. scanPath = %A_StartMenu%|%A_StartMenuCommon%|%A_ScriptDir%|%A_WorkingDir%|%A_Programs%|%A_ProgramsCommon%
  209.  
  210. ; INCLUDE ADDITIONAL USER-DEFINED PATHS FOR SCANNING
  211. IfExist, %SeekMyDir%
  212. {
  213.     Loop, read, %SeekMyDir%
  214.     {
  215.         IfNotExist, %A_LoopReadLine%
  216.             MsgBox, 8192, %version%, Processing your customised directory list...`n`n"%A_LoopReadLine%" does not exist and will be excluded from the scanning.`nPlease update [ %SeekMyDir% ].
  217.         Else
  218.             scanPath = %scanPath%|%A_LoopReadLine%
  219.     }
  220. }
  221.  
  222. ; DELETE EXISTING FILE BEFORE CREATING A NEW VERSION
  223. FileDelete, %dirListing%
  224.  
  225. ; SCAN DIRECTORY LISTING (DELIMITER = |) BY RECURSING
  226. ; EACH DIRECTORY TO RETRIEVE THE CONTENTS. HIDDEN FILES
  227. ; ARE EXCLUDED.
  228. Loop, parse, scanPath, |
  229. {
  230.     Loop, %A_LoopField%\*, %ScanMode%, 1
  231.     {
  232.         FileGetAttrib, fileAttrib, %A_LoopFileFullPath%
  233.         IfNotInString, fileAttrib, H ; EXCLUDE HIDDEN FILE
  234.             FileAppend, %A_LoopFileFullPath%`n, %dirListing%
  235.     }
  236. }
  237.  
  238. Return
  239.  
  240. ;... END ScanStartMenu SUBROUTINE ..........................
  241.  
  242.  
  243. ;=== BEGIN FindMatches SUBROUTINE ==========================
  244. ; SEARCH AND DISPLAY ALL MATCHING RECORDS IN THE LISTBOX
  245. FindMatches:
  246.  
  247. Gui, 1:Submit, NoHide
  248. CurFilename = %Filename%
  249. GuiControl,, StatusBar,
  250.  
  251. ; CHECK FOR EMPTY QUERY STRING
  252. If CurFilename =
  253. {
  254.     MsgBox, 8192, %version%, Please enter the key word/phrase to search for.
  255.     Goto EnterQuery
  256. }
  257.  
  258. ; tIncrementalSearch IS BEING INTERRUPTED. LET IT FINISHES.
  259. If NewKeyPhrase <> %CurFilename%
  260. {
  261.     ; INFORM USER THAT PATIENCE IS A VIRTUE
  262.     GuiControl,, StatusBar, Seeking...
  263.     ResumeFindMatches = TRUE
  264.     Return
  265. }
  266.  
  267. If List = |
  268. {
  269.     ; NOT EVEN A SINGLE MATCHING RECORD IS FOUND.
  270.     ; LET USER MODIFY THE QUERY STRING AND TRY AGAIN.
  271.     MsgBox, 8192, %version%, The query string "%CurFilename%" does not match any record. Try again.
  272.     GuiControl, 1:Disable, ButtonOPENDIR
  273.     GuiControl, 1:Enable, ButtonSCANSTARTMENU
  274.     Goto EnterQuery
  275. }
  276. Else
  277. {
  278.     ; SELECT THE FIRST RECORD IF NO OTHER RECORD HAS BEEN SELECTED
  279.     Gui, 1:Submit, NoHide
  280.     GuiControl, 1:Enable, OpenTarget
  281.     GuiControl, 1:Enable, ButtonOPEN
  282.     GuiControl, 1:Enable, ButtonOPENDIR
  283.     GuiControl, 1:Enable, ButtonSCANSTARTMENU
  284.     GuiControl, Focus, OpenTarget
  285.     If OpenTarget =
  286.         GuiControl, 1:Choose, OpenTarget, |1
  287. }
  288.  
  289. ; REFRESH GUI
  290. Gui, 1:Show, Center, %version%
  291.  
  292. Return
  293.  
  294. ;... END FindMatches SUBROUTINE ............................
  295.  
  296.  
  297. ;=== BEGIN SilentFindMatches SUBROUTINE ====================
  298.  
  299. SilentFindMatches:
  300.  
  301. Gui, 1:Submit, NoHide
  302. sfmFilename = %Filename%
  303.  
  304. ; FILTER MATCHING RECORDS BASED ON USER QUERY STRING
  305. List = |
  306. If sfmFilename <>
  307. {
  308.     Loop, read, %dirListing%
  309.     {
  310.         Gui, 1:Submit, NoHide
  311.         tFilename = %Filename%
  312.         If sfmFilename <> %tFilename%
  313.         {
  314.             ; USER HAS CHANGED THE SEARCH STRING. THERE IS NO POINT
  315.             ; TO CONTINUE SEARCHING USING THE OLD STRING, SO ABORT.
  316.             Return
  317.         }
  318.         Else
  319.         {
  320.             ; APPEND MATCHING RECORDS INTO THE LIST
  321.             SplitPath, A_LoopReadLine, name, dir, ext, name_no_ext, drive
  322.             MatchFound = Y
  323.             Loop, parse, sfmFilename, %A_Space%
  324.             {
  325.                 IfNotInString, name, %A_LoopField%
  326.                 {
  327.                     MatchFound = N
  328.                     Break
  329.                 }
  330.             }
  331.             IfEqual, MatchFound, Y
  332.             {
  333.                 ; ADD RECORD TO LIST
  334.                 List = %List%%A_LoopReadLine%|
  335.  
  336.                 ; PRE-SELECT IF THIS MATCHES THE LAST-RUN PROGRAM
  337.                 If (A_LoopReadLine = PrevOpenTarget && sfmFilename = PrevKeyPhrase)
  338.                     List = %List%|
  339.             }
  340.         }
  341.     }
  342. }
  343.  
  344. ; REFRESH LIST WITH SEARCH RESULTS
  345. GuiControl, 1:, OpenTarget, %List%
  346.  
  347. If List = |
  348. {
  349.     ; NO MATCHING RECORD IS FOUND
  350.     ; DISABLE LISTBOX
  351.     GuiControl, 1:Disable, OpenTarget
  352.     GuiControl, 1:Disable, ButtonOPENDIR
  353. }
  354. Else
  355. {
  356.     ; MATCHING RECORDS ARE FOUND
  357.     ; ENABLE LISTBOX
  358.     GuiControl, 1:Enable, OpenTarget
  359.     GuiControl, 1:Enable, ButtonOPENDIR
  360. }
  361.  
  362. ; REFRESH GUI
  363. Gui, 1:Show, Center, %version%
  364.  
  365. Return
  366.  
  367. ;... END SilentFindMatches SUBROUTINE ......................
  368.  
  369.  
  370. ;=== BEGIN EnterQuery SUBROUTINE ===========================
  371. ; REFRESH GUI AND LET USER ENTERS SEARCH STRING
  372. EnterQuery:
  373. GuiControl, Focus, Filename
  374. GuiControl, 1:Enable, ButtonOPEN
  375. Gui, 1:Show, Center, %version%
  376. Return
  377. ;... END EnterQuery SUBROUTINE .............................
  378.  
  379.  
  380. ;=== BEGIN TargetSelection EVENT ===========================
  381.  
  382. TargetSelection:
  383. Gui, 1:Submit, NoHide
  384.  
  385. ; DOUBLE-CLICK DETECTION TO LAUNCH PROGRAM
  386. If A_GuiControlEvent = DoubleClick
  387. {
  388.     Gosub ButtonOPEN
  389. }
  390. Else
  391. {
  392.     ; STUB - FOR FUTURE USE
  393.     If A_GuiControlEvent = Normal
  394.     {
  395.         ; DO NOTHING FOR NOW
  396.     }
  397. }
  398.  
  399. Return
  400.  
  401. ;... END TargetSelection EVENT .............................
  402.  
  403.  
  404. ;=== BEGIN ButtonOPEN EVENT ================================
  405.  
  406. ; USER CLICKED ON 'OPEN' BUTTON OR PRESSED <ENTER>
  407. ButtonOPEN:
  408. Gui, 1:Submit, NoHide
  409.  
  410. ; FIND OUT WHERE THE KEYBOARD FOCUS WAS. IF IT'S THE
  411. ; TEXT FIELD, RUN THE QUERY TO FIND MATCHES. ELSE, IT
  412. ; MUST BE FROM THE LISTBOX.
  413. GuiControlGet, focusControl, 1:Focus
  414. If focusControl = Edit1
  415. {
  416.     GuiControl, Focus, OpenTarget
  417.     GuiControl, 1:Disable, OpenTarget
  418.     GuiControl, 1:Disable, ButtonOPENDIR
  419.     GuiControl, 1:Disable, ButtonSCANSTARTMENU
  420.     Goto FindMatches
  421. }
  422.  
  423. ; NO RECORD FROM THE LISTBOX IS SELECTED
  424. If OpenTarget =
  425. {
  426.     MsgBox, 8192, %version%, Please make a selection before hitting <Enter>.`nPress <Esc> to exit.
  427.     Goto EnterQuery
  428. }
  429.  
  430. ; SELECTED RECORD DOES NOT EXIST (FILE OR DIRECTORY NOT FOUND)
  431. IfNotExist, %OpenTarget%
  432. {
  433.     MsgBox, 8192, %version%, %OpenTarget% does not exist. This means that the directory cache is outdated. You may click on the 'Scan Start-Menu' button below to update the directory cache with your latest directory listing now.
  434.     Goto EnterQuery
  435. }
  436.  
  437. ; CHECK WHETHER THE SELECTED RECORD IS A FILE OR DIRECTORY
  438. FileGetAttrib, fileAttrib, %OpenTarget%
  439. IfInString, fileAttrib, D ; IS DIRECTORY
  440. {
  441.     Gosub sOpenDir
  442. }
  443. Else If fileAttrib <> ; IS FILE
  444. {
  445.     Run, %OpenTarget%
  446. }
  447. Else
  448. {
  449.     MsgBox %OpenTarget% is neither a DIRECTORY or a FILE. This shouldn't happen. Seek cannot proceed. Quitting...
  450. }
  451.  
  452. Goto Quit
  453.  
  454. ;... END ButtonOPEN EVENT ..................................
  455.  
  456.  
  457. ;=== BEGIN ButtonOPENDIR EVENT =============================
  458.  
  459. ; USER CLICKED ON 'OPEN DIRECTORY' BUTTON
  460. ButtonOPENDIR:
  461. Gui, 1:Submit, NoHide
  462.  
  463. ; CHECK THAT USER HAS SELECTED A RECORD ALREADY
  464. If OpenTarget =
  465. {
  466.     MsgBox, 8192, %version%, Please make a selection first.
  467.     Goto EnterQuery
  468. }
  469.  
  470. ; RUN SUBROUTINE TO OPEN A DIRECTORY
  471. Gosub sOpenDir
  472.  
  473. Goto Quit
  474.  
  475. ;... END ButtonOPENDIR EVENT ...............................
  476.  
  477.  
  478. ;=== BEGIN sOpenDir SUBROUTINE =============================
  479.  
  480. sOpenDir:
  481.  
  482. ; IF USER SELECTED A FILE-RECORD INSTEAD OF A DIRECTORY-RECORD,
  483. ; EXTRACT THE DIRECTORY PATH. (I'M USING DriveGet INSTEAD OF
  484. ; FileGetAttrib TO ALLOW THE SCENARIO WHEREBY OpenTarget IS
  485. ; INVALID BUT THE DIRECTORY PATH OF OpenTarget IS VALID.
  486. DriveGet, status, status, %OpenTarget%
  487. If status <> Ready ; NOT A DIRECTORY
  488. {
  489.     SplitPath, OpenTarget, name, dir, ext, name_no_ext, drive
  490.     OpenTarget = %dir%
  491. }
  492.  
  493. ; CHECK WHETHER DIRECTORY EXISTS
  494. IfNotExist, %OpenTarget%
  495. {
  496.     MsgBox, 8192, %version%, %OpenTarget% does not exist. This means that the directory cache is outdated. You may click on the 'Scan Start-Menu' button below to update the directory cache with your latest directory listing now.
  497.     Goto EnterQuery
  498. }
  499.  
  500. ; OPEN THE DIRECTORY
  501. IfExist, %dirExplorer%
  502. {
  503.     Run, "%dirExplorer%" "%OpenTarget%", , Max ; OPEN WITH CUSTOMISED FILE EXPLORER
  504. }
  505. Else
  506. {
  507.     Run, %OpenTarget%, , Max ; OPEN WITH DEFAULT WINDOWS FILE EXPLORER
  508. }
  509. Return
  510.  
  511. ;... END sOpenDir SUBROUTINE ...............................
  512.  
  513.  
  514. ;=== BEGIN tIncrementalSearch EVENT ========================
  515. ; AUTOMATICALLY CONDUCT REAL-TIME INCREMENTAL SEARCH
  516. ; TO FIND MATCHING RECORDS WITHOUT WAITING FOR USER
  517. ; TO PRESS <ENTER>
  518. tIncrementalSearch:
  519.  
  520. Loop
  521. ; REPEAT SEARCHING UNTIL USER HAS STOPPED CHANGING THE QUERY STRING
  522. {
  523.     Gui, 1:Submit, NoHide
  524.     CurFilename = %Filename%
  525.     If NewKeyPhrase <> %CurFilename%
  526.     {
  527.         OpenTarget =
  528.         Gosub SilentFindMatches
  529.         NewKeyPhrase = %CurFilename%
  530.         Sleep, 100 ; DON'T HOG THE CPU!
  531.     }
  532.     Else
  533.     {
  534.         ; QUERY STRING HAS STOPPED CHANGING
  535.         Break
  536.     }
  537. }
  538.  
  539. ; USER HAS HIT <ENTER> TO LOOK FOR MATCHING RECORDS.
  540. ; RUN FindMatches NOW.
  541. If ResumeFindMatches = TRUE
  542. {
  543.     ResumeFindMatches = FALSE
  544.     Gosub FindMatches
  545. }
  546.  
  547. ; CONTINUE MONITORING FOR CHANGES
  548. SetTimer, tIncrementalSearch, 500
  549.  
  550. Return
  551.  
  552. ;... END tIncrementalSearch EVENT ..........................
  553.  
  554.  
  555. ;=== BEGIN Quit SUBROUTINE =================================
  556.  
  557. Quit:
  558. ButtonEXIT:
  559. ;GuiClose:
  560. GuiEscape:
  561.  
  562. Gui, 1:Submit, NoHide
  563.  
  564. ; SAVE THE KEY WORD/PHRASE FOR NEXT RUN IF IT HAS CHANGED
  565. If TrackKeyPhrase = ON
  566. {
  567.     If (PrevKeyPhrase <> Filename || PrevOpenTarget <> OpenTarget)
  568.     {
  569.         FileDelete, %keyPhrase%
  570.         FileAppend, %Filename%`n, %keyPhrase%
  571.         FileAppend, %OpenTarget%`n, %keyPhrase%
  572.     }
  573. }
  574.  
  575. QuitNoSave:
  576. ExitApp ; JOB DONE. G'DAY!
  577.  
  578. ;... END Quit SUBROUTINE ...................................
  579. GetOut:
  580. GuiClose:
  581. Gui, Hide
  582. SkinForm(0)
  583. ExitApp
  584. return
  585.  
  586. SkinForm(Param1 = "Apply", DLL = "", SkinName = ""){
  587.     if(Param1 = Apply){
  588.         DllCall("LoadLibrary", str, DLL)
  589.         DllCall(DLL . "\USkinInit", Int,0, Int,0, AStr, SkinName)
  590.     }else if(Param1 = 0){
  591.         DllCall(DLL . "\USkinExit")
  592.         }
  593. }
  594.  
  595. ;************************
  596. ;<--- END OF PROGRAM --->
  597. ;************************
  598.  
  599. ; /* vim: set noexpandtab shiftwidth=4: */
  600.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement