Page 1 of 1
Show/Hide POM item depending on number of selected files
Posted: 18 Oct 2023 11:49
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.
Re: Show/Hide POM item depending on number of selected files
Posted: 18 Oct 2023 11:58
by highend
You can at least reduce that list by e.g. displaying "Open Url(s)" and let those scripts handle single / multiple selections...
Re: Show/Hide POM item depending on number of selected files
Posted: 18 Oct 2023 12:15
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.
Re: Show/Hide POM item depending on number of selected files
Posted: 18 Oct 2023 12:22
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.
Re: Show/Hide POM item depending on number of selected files
Posted: 18 Oct 2023 12:40
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
Re: Show/Hide POM item depending on number of selected files
Posted: 18 Oct 2023 14:58
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); }
Re: Show/Hide POM item depending on number of selected files
Posted: 18 Oct 2023 15:57
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);
Re: Show/Hide POM item depending on number of selected files
Posted: 20 Oct 2023 11:36
by highend
A variable that uses multi-script captions? What?
Re: Show/Hide POM item depending on number of selected files
Posted: 20 Oct 2023 12:12
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".
Re: Show/Hide POM item depending on number of selected files
Posted: 20 Oct 2023 12:54
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);
}
Re: Show/Hide POM item depending on number of selected files
Posted: 20 Oct 2023 13:51
by xy123
Because we can have more than 2 things to do.
Thank you very much for your script, that one actually works.