|
|
On this pages some simple scripts for the search (Alt+F7), are presented.
| Title | FindTemplate |
| File Name | FindTemplate.txt |
| Description | Start search with one click or one key. Notify when the search is complete |
| Author | Vochomurka |
| Parameters | "Saved search", "how to notify", "start now" |
| Plugins Called | vec, ini, win, childwin, miscplugin, osd |
| Version | 2.1 |
| Updated on | 09.06.2008 |
args Key, Sig, Now
local i, Temp
local INIfile = "path\wincmd.ini"
local Mess = "Search complete"
local Class = "c=TFindFile"
local AllKeys = ini.enum_keys(INIfile, "Searches")
local Total = line(AllKeys, 0)
local Counter = 0
for(i = 1; i <= Total; i++)
Temp = line(AllKeys, i)
if(index(Temp, "_SearchFor") != 0)
Counter++
endfor
v = vec.create(Counter)
if(v == 0) do
messagebox("ok error", "Vector not created", "VEC plugin error")
quit
endif
Counter = 0
for(i = 1; i <= Total; i++)
Temp = line(AllKeys, i)
if(index(Temp, "_SearchFor") != 0) do
v[Counter] = Temp
Counter++
endif
endfor
vec.sort(v)
Counter = vec.binsearch(v, Key ++ "_SearchFor")
vec.destroy(v)
vec.unload
*keys %{f7}+{tab}{right 3}{tab}{down}
for(i = 1; i <= Counter; i++)
*keys {down}
endfor
*keys {tab}{enter}
if(not Now)
quit
*keys {enter}
wait.for(activewindow(Class))
wait.for(win.handle(Class))
local Hand = win.handle(Class)
wait.for(childwin.handle(Hand, 71))
wait.for(win.gettext(childwin.handle(Hand, 71)) == "&Start search")
if(index(Sig, "b"))
miscplugin.balloontip(1, "INFORMATION", Mess, "title=FindTemplate Script")
if(index(Sig, "o"))
osd.show(Mess, "3000", "30", "Arial", "-1", "255 000 000")
if(index(Sig, "m"))
messagebox("ok information", Mess, "FindTemplate Script")
If you frequently perform a specific search, it is convenient to save this search as a template. To call the saved search you have to do the following:
Present script allows to do the same by just one mouse click or one hotkey. The same is provided with the LOADSEARCH command introduced in Total Commander 7.
In the simplest case the script requires one parameter being the name of the saved search, for example: runfile.FindTemplate("HTMLtext").
Some search progress can last several minutes or even hours. During this time, the user can concentrate on other job, but wants to be notfied about the process termination.
Second script parameter allows to notify the user when the search is finished. Three letters: "m", "o" and "b" (lower case only, in any order) provide notification through message box, on-screen message, and balloon tip, respectively.
Finally, the third script parameter, if present and equal to "1", provides that the search should be started immediately. If the saved search requires entering some additional data (text to find in files, for example), then the third parameter should be "0" or absent.
For example, FindTemplate("Duplicates", "om", "1") starts searching duplicates according to the "Duplicates" saved search (of course, if there is one), and when the process is finished, tells about it through on-screen message and balloon tip.
This one-line script performs search of file whose name is copied to the clipboard before calling the script. Please do not confuse it with cm_CutToClipboard and cm_CopyToClipboard commands! They copy not the file name, but its location. Further, the cm_CopyNamesToClip copies the name of file under cursor to the clipboard. For example, to find in one panel the current file from another panel, first execute the cm_CopyNamesToClip command (or one similar to it, there are five of them), and then go to another panel and call the script. The name of file to find can be likewise copied from Lister, text editor, web page, etc.
Script finds file(s) containing text from the clipboard.
*keys %{f7}{del}{tab 5}{space}+{ins}{enter}
*keys %{f7}{del}+{tab}{right}{tab 3}{space}{tab 2}{up 2}+{tab}
The "Find file" window is prepared to find a file with the size entered by user.
|
Main Page |
|
Total Commander |
|
PowerPro |
|
|