Show/Hide POM item depending on number of selected files

Features wanted...
Post Reply
xy123
Posts: 214
Joined: 17 Sep 2017 11:46
Location: Win10 64-bit, @100%

Show/Hide POM item depending on number of selected files

Post by xy123 »

Some POM items I only use when multiple files are selected and others only when single file is selected.

For example, I don't want to see "Open Multiple Urls" when single .url file is selected or "Copy Url" when multiple files are selected (because this script doesn't work with multiple files).

Something like a new variable "=1" or ">=2" or "=2" (default would be >=1), so you never see menu items you can't or won't use.

highend
Posts: 14672
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Show/Hide POM item depending on number of selected files

Post by highend »

You can at least reduce that list by e.g. displaying "Open Url(s)" and let those scripts handle single / multiple selections...
One of my scripts helped you out? Please donate via Paypal

xy123
Posts: 214
Joined: 17 Sep 2017 11:46
Location: Win10 64-bit, @100%

Re: Show/Hide POM item depending on number of selected files

Post by xy123 »

And what should I do with "Everything Rename" item which is >=3 (show only when 3 or more files are selected). Also user shouldn't remember that "Open Url(s)" means "Copy Url" when single file is selected.

xy123
Posts: 214
Joined: 17 Sep 2017 11:46
Location: Win10 64-bit, @100%

Re: Show/Hide POM item depending on number of selected files

Post by xy123 »

I admit, this feature is from FileMenu Tools, but I want to stop using FT, because XY has POM. BUT Show/Hide menu item depending on number of selected files is a killer feature, so I still can't.

highend
Posts: 14672
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Show/Hide POM item depending on number of selected files

Post by highend »

No clue why on one item it's Copy URL but not Open URL but that's probably just your brain...

You could use multi-purpose scripts and only two entries (Single selected item, Multiple selected items), the possibilities are endless...

I'm out
One of my scripts helped you out? Please donate via Paypal

xy123
Posts: 214
Joined: 17 Sep 2017 11:46
Location: Win10 64-bit, @100%

Re: Show/Hide POM item depending on number of selected files

Post by xy123 »

highend wrote: 18 Oct 2023 12:40 the possibilities are endless...
So are you saying somescript.xys like this is possible?

Code: Select all

    $count = get("CountSelected");
    if     ($count == 1) { POM_Item_Label="Copy Url"; $url = getkey("URL", "InternetShortcut", "<curitem>"); copytext $url; }
    elseif ($count >= 2) { POM_Item_Label="Open Multiple Urls"; $url = getkey("URL", "InternetShortcut", <pfaitem>); run lax(firefox.exe -new-tab $url); }

xy123
Posts: 214
Joined: 17 Sep 2017 11:46
Location: Win10 64-bit, @100%

Re: Show/Hide POM item depending on number of selected files

Post by xy123 »

I came up with this, but there isn't a variable which will use multi-script caption, is it?

In CFA:

Code: Select all

|"<Hmmm>" url>::if (get('CountSelected') == 1) { load "MyPOM.xys", "Copy Url"; } elseif (get('CountSelected') >=2) { load "MyPOM.xys", "Open Multiple Urls"; } ;
In MyPOM.xys:

Code: Select all

"Copy Url"
    $url = getkey("URL", "InternetShortcut", "<curitem>");
    copytext $url;
"Open Multiple Urls"
    $url = getkey("URL", "InternetShortcut", <pfaitem>);
    run lax("C:\Program Files\Firefox\firefox.exe" -new-tab $url);

highend
Posts: 14672
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Show/Hide POM item depending on number of selected files

Post by highend »

A variable that uses multi-script captions? What?
One of my scripts helped you out? Please donate via Paypal

xy123
Posts: 214
Joined: 17 Sep 2017 11:46
Location: Win10 64-bit, @100%

Re: Show/Hide POM item depending on number of selected files

Post by xy123 »

Forget about multi-script captions.

I thought something like "Dynamic Menu Item Caption/Label".

If single file is selected menu item label is "Caption A" and if multiple files are selected "Caption B".

highend
Posts: 14672
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Show/Hide POM item depending on number of selected files

Post by highend »

Why should captions be necessary? You have 2 things to do with urls, either if one is selected OR if more than one is selected...

|"Url(s)" url>::e|load "MyPOM.xys";

MyPOM.xys:

Code: Select all

$cnt = get("CountSelected");
    if ($cnt == 1) {
        $url = getkey("URL", "InternetShortcut", <pfaitem>);
        copytext $url;
    } elseif ($cnt >=2) {
        $urls = "";
        foreach($file, <pfaitems>, , "e") {
            $url   = getkey("URL", "InternetShortcut", $file);
            $urls .= "-new-tab -url " . quote($url) . " ";
        }
        run lax("C:\Program Files\Firefox\firefox.exe" $urls);
    }
One of my scripts helped you out? Please donate via Paypal

xy123
Posts: 214
Joined: 17 Sep 2017 11:46
Location: Win10 64-bit, @100%

Re: Show/Hide POM item depending on number of selected files

Post by xy123 »

Because we can have more than 2 things to do.

Thank you very much for your script, that one actually works.

Post Reply