new button for quick search

Features wanted...
yusef88
Posts: 1123
Joined: 28 Jan 2013 03:50
Location: Windows 8.1 32-bit

new button for quick search

Post by yusef88 »

if those commands are in button should perform quick search similar to catalog click and search feature

Code: Select all

/types={:Video}
/types={:Audio} /exclfile=*.mp4

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: new button for quick search

Post by highend »

What is the difference to a script inside the button like this?

Code: Select all

    $options = "/types={:Video};{:Audio} /exclfile=*.mp4";
    goto "<curpath>?$options";
One of my scripts helped you out? Please donate via Paypal

yusef88
Posts: 1123
Joined: 28 Jan 2013 03:50
Location: Windows 8.1 32-bit

Re: new button for quick search

Post by yusef88 »

highend wrote:What is the difference to a script inside the button like this?
simplicity: items are shown in drop menu - easy to edit - no need for command caption nor search caption

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: new button for quick search

Post by highend »

You would still need to edit the button's content for the options...

Code: Select all

    // DO NOT EDIT THIS SCRIPT
    perm $P_QSOptions;

    if (!$P_QSOptions) { $P_QSOptions = "<no options defined>"; }

    $qsCaption = "Quick search!";
    $menu = $P_QSOptions . <crlf> . "-". <crlf> . $qsCaption;
    $selection = popupnested($menu, , , , , , <crlf>, "<::>");
    end !$selection;

    if ($selection UnLikeI $qsCaption) {
        $P_QSOptions = input("Edit quick search options...", "One item per line!", $P_QSOptions, "m", , 250, 400);
    }
    $P_QSOptions = regexreplace($P_QSOptions, "^<no options defined>.*(\r?\n|$)");
    goto "<curpath>?" . regexreplace($P_QSOptions, "\r?\n", " ");
No editing necessary and clicking on an option entry brings up a small edit window for them
You can't split options like /types into multiple ones here but you could add that feature
(auto combining same entries) into the script...
One of my scripts helped you out? Please donate via Paypal

yusef88
Posts: 1123
Joined: 28 Jan 2013 03:50
Location: Windows 8.1 32-bit

Re: new button for quick search

Post by yusef88 »

did I use it correctly?
Capture.PNG
Capture.PNG (22.48 KiB) Viewed 1385 times
BTW, I already have a simple script provides a menu

Code: Select all

$menu = <<<MENU
   Video;/types={:Video}
   Audio;/types={:Audio}
   MENU;
  $s = popupmenu("$menu");if !($s) { end 1==1; };
  goto "?$s";

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: new button for quick search

Post by highend »

You can't split options like /types into multiple ones here
One of my scripts helped you out? Please donate via Paypal

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: new button for quick search

Post by highend »

An advanced script with a simple parser which allows

- multiple same options (must follow each other!)
Example:

Code: Select all

Correct
/types={:Audio}
/types={:Video}

INCORRECT:
/types={:Audio}
/exclfile=*.mp4
/types={:Video}
- accepts paths (local + network), ignores non existing ones
Example:

Code: Select all

C:\ProgramData
D:\Temp
\\server\folder\subfolder
- adds options without a type to the last type (must follow each other!)
Example:

Code: Select all

Correct
/types={:Audio}
*.srt
*.idx

INCORRECT:
/types={:Audio}
D:\Temp
*.srt
E.g.:
quicksearch.png
quicksearch.png (3.61 KiB) Viewed 1368 times

Code: Select all

    // DO NOT EDIT THIS SCRIPT
    perm $P_QSOptions;

    if (!$P_QSOptions) { $P_QSOptions = "<no options defined>"; }

    $qsCaption = "Quick search!";
    $menu = $P_QSOptions . <crlf> . "-". <crlf> . "$qsCaption<::><::>:find";
    $selection = popupnested($menu, , , , , , <crlf>, "<::>");
    end !$selection;

    if ($selection UnLikeI $qsCaption) {
        $P_QSOptions = input("Edit quick search options...", "One item per line!", $P_QSOptions, "m", , 250, 400);
    }
    $P_QSOptions = regexreplace($P_QSOptions, "^<no options defined>.*(\r?\n|$)");

    // Parse options
    $folders = "";
    $options = "";
    foreach($entry, $P_QSOptions, <crlf>, "e") {
        // Is it a known option?
        $optionType = (regexmatches($entry, "^\s*/")) ? trim(gettoken($entry, 1, "=")) : "";

        // Is it a path?
        if (regexmatches($entry, "^\s*([a-z]:|\\\\)")) {
            // Path exists? Add it! Does not exist? Ignore it!
            if (exists(trim($entry)) == 2) { $folders = $folders . ((!$folders) ? $entry : ";" . $entry); }
        // Is it an option?
        } elseif ($optionType) {
            // The same as the last option? Combine!
            if ($optionType LikeI $lastOptionType) { $options = $options . ";" . trim(gettoken($entry, 2, "=")); }
            // A new option?
            else { $options = $options . <crlf> . $entry; }
        // If not, add it to the previous option!
        } else { $options = $options . ";" . $entry; }
        $lastOptionType = $optionType;
    }
    // text "Options:<crlf>$options<crlf 2>Folders:<crlf>$folders";
    goto "$folders?" . regexreplace($options, "\r?\n", " ");
One of my scripts helped you out? Please donate via Paypal

yusef88
Posts: 1123
Joined: 28 Jan 2013 03:50
Location: Windows 8.1 32-bit

Re: new button for quick search

Post by yusef88 »

the script works as I wish thank you
=======================
could I ask for a little help?

Code: Select all

   $g = get("drives");$g = replace("$g", "\", "");
// nested foreach loops
 foreach($token, "$g") {
   foreach($token2, "load", "<crlf>") {
    writefile("%temp%\load.txt", "$token2 $token", "a");
   }
 };
  
I need to write the output as batch file and run it with admin privileges eg:

Code: Select all

load C:
load E:
load F:
Last edited by yusef88 on 19 Jul 2017 16:13, edited 1 time in total.

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: new button for quick search

Post by highend »

I don't get it

What exactly do you want to do?
One of my scripts helped you out? Please donate via Paypal

yusef88
Posts: 1123
Joined: 28 Jan 2013 03:50
Location: Windows 8.1 32-bit

Re: new button for quick search

Post by yusef88 »

return all existing drives
create one text file contain returned drives" line by line":
  • fltmc attach AccessGainDriver C:
    fltmc attach AccessGainDriver D:
then run this written file as windows batch with admin rights?

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: new button for quick search

Post by highend »

Code: Select all

    $batFile = "%TEMP%\~fltmc.bat";
    $drives = get("drives", , <crlf>);
    $drives = regexreplace($drives, "\\$");
    $drives = regexreplace($drives, "^(.)", "fltmc attach AccessGainDriver $1");
    writefile($batFile, $drives);

    $vbsFile = "%TEMP%\~OpenElevatedCMD.vbs";
    $vbsContent = <<<>>>
        Set UAC = CreateObject("Shell.Application")
        UAC.ShellExecute "cmd.exe", "/c ""$batFile""", "", "runas", 1
>>>;

    writefile($vbsFile, $vbsContent);
    run """cscript.exe"" ""$vbsFile"" //nologo", , 0, 0;
One of my scripts helped you out? Please donate via Paypal

yusef88
Posts: 1123
Joined: 28 Jan 2013 03:50
Location: Windows 8.1 32-bit

Re: new button for quick search

Post by yusef88 »

Thank you so much

yusef88
Posts: 1123
Joined: 28 Jan 2013 03:50
Location: Windows 8.1 32-bit

Re: new button for quick search

Post by yusef88 »

Code: Select all

    $names = get("selecteditemsnames", "<crlf>");
    $paths = get(SelectedItemsPathNames, "<crlf>");
Compared to previous script, possible to write each folder name and its path in one line?
Name Path
Name Path

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: new button for quick search

Post by highend »

Code: Select all

text regexreplace(<get "SelectedItemsPathNames" <crlf>>, "(^.*)\\(.*)", "$2 $1");
One of my scripts helped you out? Please donate via Paypal

yusef88
Posts: 1123
Joined: 28 Jan 2013 03:50
Location: Windows 8.1 32-bit

Re: new button for quick search

Post by yusef88 »

it gives the parent path of selected folders
thanks

Post Reply