Enabl button on selection only

Discuss and share scripts and script files...
TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Enabl button on selection only

Post by TheQwerty »

SammaySarkar wrote:
highend wrote:Balloon tips aren't supported you'd need an external tool to display them.
winapiexec should fit the bill nicely...
There's also nircmd which makes it incredibly easy:

Code: Select all

run <<<COMMAND
"nircmd.exe" trayballoon "XYplorer" "XYplorer is the best." "<xy>" 5000
COMMAND
  ,, 0, 0;

PeterH
Posts: 2826
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: Enabl button on selection only

Post by PeterH »

SammaySarkar wrote:U_2, the separator is a necessary evil dummy.
Though you can use it to display multiple lines:

Code: Select all

  load <<<#>>>>
"Nothing selected in filelist,|<xyicons>\scheme\crosss.ico" end 1;
"so we TERMINATE." End 1; #>>>>,,s;
 end 1;
By the way: the label(s) should start in column one, I think.

Really a cool idea to use Load this way :appl:

(I prefer the code multiline - but that's just personal)

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: Enabl button on selection only

Post by bdeshi »

PeterH wrote:the label(s) should start in column one, I think.
Apparently the very first label (only) can be indented.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

PeterH
Posts: 2826
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: Enabl button on selection only

Post by PeterH »

SammaySarkar wrote:
PeterH wrote:the label(s) should start in column one, I think.
Apparently the very first label (only) can be indented.
You know my personal style? :biggrin:

Do you want to say
- 'can', i.e. doesn't bring an error (in the moment, at least),
- or 'is allowed', as documented?

Why do I think this way? Sometimes, when creating / changing scripts, the result is "rather strange" - for examples comments are not treated as expected, heredoc, multi script files, or whatever. And then the searching begins... :evil:
In these situations it's at least good, if syntax rules have been followed as close as possible. :biggrin:

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: Enabl button on selection only

Post by bdeshi »

I agree with you. I don't deviate from the normal syntax, but in this case I'm quite sure that's syntactically correct. Logically at least.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

U_2582
Posts: 34
Joined: 05 Oct 2013 10:33

Re: Enabl button on selection only

Post by U_2582 »

PeterH,
The multi-line looks much better than the separator, but why is the second line grayed out?!
Btw, Your code didn't work for me, needed <crlf>

Code: Select all

load <<<#>>>>
"Nothing selected in the file list.|<xyicons>\cross.ico" end 1;
<crlf>"Select something and try again."#>>>>,,s;
end 1;
Maybe its a good idea to add balloon tip to xy wish list :whistle:

Using external resources should be for more important things. (personal opinion)

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: Enabl button on selection only

Post by bdeshi »

U_2582 wrote:but why is the second line grayed out?
needs some command to be active.
Add an end 1; after "Select something and try again."
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Enabl button on selection only

Post by TheQwerty »

HTML with JavaScript redirection after 3 seconds:

Code: Select all

"popup"
  $G_MSG = "Nothing selected!";
  $G_TIMEOUT_SECONDS = 3;

  html(<<<#HTML
<html><body>
<h1>$G_MSG</h1>
<script>window.setTimeout(function() { window.location = 'xys:timeout'; }, $G_TIMEOUT_SECONDS * 1000);</script>
</body></html>
#HTML);

U_2582
Posts: 34
Joined: 05 Oct 2013 10:33

Re: Enabl button on selection only

Post by U_2582 »

TheQwerty wrote:HTML with JavaScript redirection after 3 seconds:

Code: Select all

"popup"
  $G_MSG = "Nothing selected!";
  $G_TIMEOUT_SECONDS = 3;

  html(<<<#HTML
<html><body>
<h1>$G_MSG</h1>
<script>window.setTimeout(function() { window.location = 'xys:timeout'; }, $G_TIMEOUT_SECONDS * 1000);</script>
</body></html>
#HTML);
lol Image

I think multi-line popup menu is best solution for now, although I would like a one item popup menu without a separator and with an icon more.

Thanks all.

PeterH
Posts: 2826
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: Enabl button on selection only

Post by PeterH »

U_2582 wrote:PeterH,
The multi-line looks much better than the separator, but why is the second line grayed out?!
Btw, Your code didn't work for me, needed <crlf>

Code: Select all

load <<<#>>>>
"Nothing selected in the file list.|<xyicons>\cross.ico" end 1;
<crlf>"Select something and try again."#>>>>,,s;
end 1;
One tip exactly as Sammay said: re-add End 1;

I just copied my example from above and pasted it to Try Script :arrow: exactly works as expected, without <crlf>, but with End 1; and blanks in front of line 1 and 4.

klownboy
Posts: 4397
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.7171 at 100% 2560x1440

Re: Enabl button on selection only

Post by klownboy »

I suppose if you don't like the 2 lines or have no need for 2 lines you can always even the message out by having 3 lines (but 3 is not even!). Top and bottom could be blank with the middle line being the message or you could do something like this...
error_message_cap.png
error_message_cap.png (4.1 KiB) Viewed 2283 times

Code: Select all

  $p_selCount = get("selectedItemsNames");
  if ($p_selCount == ""){
  load <<<#>>>>
"-------------------------------";
"    Nothing selected in filelist|:favs" end 1;
"-------------------------------"; #>>>>,,s;
  end 1;}
The fat dot is a BEL character made by holding alt and hitting 007 on the numpad (doesn't show in the pasted code). Thanks again Sammay for a clever trick.

Post Reply