Page 2 of 5
Re: style = 512 for inputselect()
Posted: 05 Jul 2018 11:51
by highend
Most of the logic already exists in popupmenu (to handle the Caption|Data|Icon logic).
A bit of copy and paste and minimal refactoring should be able to handle this.
The good thing: XY could be a superb program starter (because it's filterable!) as well...
I'd even provide a script for it

Re: style = 512 for inputselect()
Posted: 05 Jul 2018 11:57
by admin
The logic is fine. But this is not a case for copy and paste.
Well, anyway, what is that "Data" field supposed to do?
Re: style = 512 for inputselect()
Posted: 05 Jul 2018 12:02
by highend
Caption = What to display in the inputselect() window
Data = What to return for the selected item (if Data is not used, return from Caption instead)
Icon = If not provided, return from Data (and if Data is not used, return from Caption)
I thought I've explained it within the example script on post #14?
viewtopic.php?p=160211#p160211
Re: style = 512 for inputselect()
Posted: 05 Jul 2018 12:21
by admin
Data = What to return for the selected item (if Data is not used, return from Caption instead)
I expected that but it was not totally clear from that other post. Better ask twice.
OK, I'm on it. It might work out...

Re: style = 512 for inputselect()
Posted: 05 Jul 2018 12:25
by highend
Great, then I can finally close my 7 year old "user configurable icon for inputselect()" request:
viewtopic.php?f=5&t=6839

Re: style = 512 for inputselect()
Posted: 05 Jul 2018 14:11
by zakhar
Re: style = 512 for inputselect()
Posted: 05 Jul 2018 14:36
by admin
zakhar wrote:
Yes, you will get your thing as well. Flag 2048.

Re: style = 512 for inputselect()
Posted: 05 Jul 2018 15:18
by highend
Very cool, thanks for adding this stuff. Lots of usecases here...
One small bug:
Code: Select all
$list = <<<>>>
Audacity||D:\Tools\@Shortcuts\Audacity [Portable].lnk
>>>;
text inputselect("Test: Caption|Data|Icon", $list, <crlf>, 1 + 1024);
It should return Audacity, not "<empty>". Rule: If "Data" isn't populated at all, return "Caption"
The icon is displayed correctly btw.
Re: style = 512 for inputselect()
Posted: 05 Jul 2018 15:27
by admin
This is not a missing field but an empty field. IMO it's correct to return nothing in this case.
Re: style = 512 for inputselect()
Posted: 05 Jul 2018 15:55
by zakhar
admin wrote:zakhar wrote:
Yes, you will get your thing as well. Flag 2048.

I am happy!
Thank you very much!

Re: style = 512 for inputselect()
Posted: 05 Jul 2018 16:03
by highend
IMO it's correct to return nothing in this case.
Ok, I can live with that.
What I'd like to see supported though: XY internal icons...
E.g.
Code: Select all
$list = <<<>>>
7-Zip|7-Zip Selected|:del
>>>;
text inputselect("Test: Caption|Data|Icon", $list, <crlf>, 1 + 1024);
doesn't show the icon for :del
Re: style = 512 for inputselect()
Posted: 05 Jul 2018 16:39
by admin
highend wrote:IMO it's correct to return nothing in this case.
Ok, I can live with that.
In the meantime I rethought it. What could be the use of returning nothing? Well, I cannot see much there. I will silently change the behavior with the next release. I will update the last change log accordingly already now.
Re: style = 512 for inputselect()
Posted: 05 Jul 2018 17:53
by admin
highend wrote:What I'd like to see supported though: XY internal icons...
Coming...
Re: style = 512 for inputselect()
Posted: 05 Jul 2018 20:36
by highend
@zakhar
Code: Select all
end compare(<xyver>, "19.00.0302", "v") == -1, "This script requires at least v19.00.0302, terminating now!";
$sepID = "<sep>";
$sepIcon = ":queue";
$subLocations = <<<>>>
%USERPROFILE%\Desktop\1
%USERPROFILE%\Desktop\2
%USERPROFILE%\Desktop\3
>>>;
$sep = strrepeat("-", 46) . "x";
$listOfLinks = "";
foreach($subLocation, $subLocations, <crlf>, "e") {
if (exists($subLocation) == 2) {
$links = quicksearch(".lnk", $subLocation);
if ($links) { $listOfLinks .= $links . <crlf> . "$sep|$sepID|$sepIcon" . <crlf>; }
}
}
$listOfLinks .= quicksearch(".lnk /n", "%USERPROFILE%\Desktop");
// Build "Caption|Data|Icon"
$listOfLinks = regexreplace($listOfLinks, "^(.+\\)(.*?)(?=\r?\n|$)", "$2|$1$2|$1$2");
// Remove (.exe).lnk in "Caption"
$listOfLinks = regexreplace($listOfLinks, "^(.+?)(\.exe)?\.lnk\|", "$1|");
// Sel + execute item
$selected = inputselect("", $listOfLinks, <crlf>, 1+1024, , 400, 700);
if ($selected == $sepID) { status "No valid entry selected, aborted!", "8B4513", "stop"; end true; }
open $selected;
Sure, this could be done with style = 2048 as well but I personally don't want to see any ".exe.lnk" extensions...
Re: style = 512 for inputselect()
Posted: 05 Jul 2018 21:47
by zakhar
Some hours ago I have switched to v19.00.0301

and my script looks now like this (very simple):
Code: Select all
$qs1 = quicksearch(".lnk","C:\Users\User\Desktop\1");
$qs2 = quicksearch(".lnk","C:\Users\User\Desktop\2");
$qs3 = quicksearch(".lnk","C:\Users\User\Desktop\3");
$qs4 = quicksearch(".lnk /n","C:\Users\User\Desktop");
$d = "--------------------------------------------x";
$qs1 = "$qs1<crlf>$d<crlf>$qs2<crlf>$d<crlf>$qs3<crlf>$d<crlf>$qs4";
$a = inputselect("","$qs1","<crlf>",1+2048,0,400,700,"",);
if($a == "" || $a == $d){
$a = 0;
}
end $a == 0;
open "$a";
It works fine!
What I would like to have changed is the representation of $d - in the dialog window it has a "gray question" icon but I think that is not
a problem as I can simulate this separator element by a link to a renamed icon file. Its name would then be something like this
"--------------------------------------------x.lnk". Clicking it will end the script.
To day I would not use regexp elements ("^(.+\\)(.*?)(?=\r?\n|$)" and others) while I am not familiar with them.
I understand what they do, but not now. May be later. Therefore .lnk tail will stay a while.