Icons in Scripts

Things you’d like to miss in the future...
Forum rules
:warnred20: :warnred20: :warnred20: :warnred20: :warnred20: READ THIS AND DO IT!!! :warnred20: :warnred20: :warnred20: :warnred20: :warnred20:

:info: Please include the following information:
1) Your XYplorer Version (e.g., v28.00.0801)
2) Your Windows Version (e.g., Win 11)
3) Your Screen Scaling Percentage (e.g., 125%).

:info: We recommend adding your Windows Version and Screen Scaling Percentage to the Location field in your Profile or to your Signature. That way, you only have to type them once.

:info: When attaching an Image, please use the Attachment tab at the bottom of your post and click "Add files".

:warnred20: :warnred20: :warnred20: :warnred20: :warnred20: READ THIS AND DO IT!!! :warnred20: :warnred20: :warnred20: :warnred20: :warnred20:
jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Icons in Scripts

Post by jacky »

Latest additions to scripting sounds pretty cool (thanks for that!), but it's a little buggy as well. Seems that separators don't work after an item got an icon, instead a menu with a "-" as caption is shown, trying to exec script "-;" which obviously fails. Also, and I'm not sure why, but sometimes not only that but the icon isn't even shown, e.g. adding "|notepad" to the first item in one of my script works (except for breaking all my seps) but adding it later down in the menu, and the icon won't even show up (and all it does is break the seps).

Also, I like the whole bold/check thing, very nice! :)
Proud XYplorer Fanatic

admin
Site Admin
Posts: 65245
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Icons in Scripts

Post by admin »

jacky wrote:Latest additions to scripting sounds pretty cool (thanks for that!), but it's a little buggy as well. Seems that separators don't work after an item got an icon, instead a menu with a "-" as caption is shown, trying to exec script "-;" which obviously fails. Also, and I'm not sure why, but sometimes not only that but the icon isn't even shown, e.g. adding "|notepad" to the first item in one of my script works (except for breaking all my seps) but adding it later down in the menu, and the icon won't even show up (and all it does is break the seps).

Also, I like the whole bold/check thing, very nice! :)
I will rewrite the bold/check thing in the next beta, so don't put too much work in it now.

admin
Site Admin
Posts: 65245
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Icons in Scripts

Post by admin »

This separator and Notepad works alright:

Code: Select all

"!Go C:\Temp|C:\Temp" goto "C:\Temp";
"Go Desktop|Desktop" goto "Desktop";
"Go XY exe|<xypath>\XYplorer.exe" goto "<xypath>\XYplorer.exe";
"-"
"Open With Photoshop|Photoshop" openwith "Photoshop";
"Open With Notepad|Notepad" openwith "Notepad";
Please show code that does not work.

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Re: Icons in Scripts

Post by jacky »

Oh, sure, if you do things like that... :P Thing is, AFAIC I don't think I ever put my separators into quotes, so I would have done this:

Code: Select all

"!Go C:\Temp|C:\Temp"
  goto "C:\Temp";
"Go Desktop|Desktop"
  goto "Desktop";
"Go XY exe|<xypath>\<xyexe>"
  goto "<xypath>\<xyexe>";
-
"Open With Photoshop|Photoshop"
  openwith "Photoshop";
"Open With Notepad|Notepad"
  openwith "Notepad";
And sure enough, then it doesn't work...
Proud XYplorer Fanatic

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

Re: Icons in Scripts

Post by TheQwerty »

admin wrote:Please show code that does not work.

Code: Select all

"_noIcons" echo("Hasta la vista, icons! Mwahaha!");
"!Go C:\Temp|C:\Temp" goto "C:\Temp";
"Go Desktop|Desktop" goto "Desktop";
"Go XY exe|<xypath>\XYplorer.exe" goto "<xypath>\XYplorer.exe";
"-"
"Open With Photoshop|Photoshop" openwith "Photoshop";
"Open With Notepad|Notepad" openwith "Notepad";

admin
Site Admin
Posts: 65245
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Icons in Scripts

Post by admin »

admin wrote:I will rewrite the bold/check thing in the next beta, so don't put too much work in it now.
I'm thinking about doing a third binary field Flags for these things:

Code: Select all

"Caption|Iconfile|Flags : Label" Script
where:
Flags 1 = Default
Flags 2 = Checked
Flags 4 = Disabled
It's cleaner, but maybe makes scripts a bit harder to read. Opinions please.

admin
Site Admin
Posts: 65245
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Icons in Scripts

Post by admin »

jacky wrote:Oh, sure, if you do things like that... :P Thing is, AFAIC I don't think I ever put my separators into quotes, so I would have done this:

Code: Select all

"!Go C:\Temp|C:\Temp"
  goto "C:\Temp";
"Go Desktop|Desktop"
  goto "Desktop";
"Go XY exe|<xypath>\<xyexe>"
  goto "<xypath>\<xyexe>";
-
"Open With Photoshop|Photoshop"
  openwith "Photoshop";
"Open With Notepad|Notepad"
  openwith "Notepad";
And sure enough, then it doesn't work...
OK, fixed.

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

Re: Icons in Scripts

Post by TheQwerty »

admin wrote:
admin wrote:I will rewrite the bold/check thing in the next beta, so don't put too much work in it now.
I'm thinking about doing a third binary field Flags for these things:

Code: Select all

"Caption|Iconfile|Flags : Label" Script
where:
Flags 1 = Default
Flags 2 = Checked
Flags 4 = Disabled
It's cleaner, but maybe makes scripts a bit harder to read. Opinions please.
Honestly, I don't like all this overloading of the "Caption : label". We all said that the format of script files is flawed and not ideal anymore, so maybe it's time we considered a more structured approach?

Something that would allow us to use real sub-menus and didn't rely so heavily on white-space.

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Re: Icons in Scripts

Post by jacky »

Thanks TheQwerty, I wasn't sure what made the icons go away.
admin wrote:It's cleaner, but maybe makes scripts a bit harder to read. Opinions please.
Might be easier to read if you add constants, so one can use MNU_CHECKED or something instead of 2. (Plus, allow MNU_CHECKED + MNU_DISABLED of course)
Proud XYplorer Fanatic

admin
Site Admin
Posts: 65245
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Icons in Scripts

Post by admin »

TheQwerty wrote:
admin wrote:Please show code that does not work.

Code: Select all

"_noIcons" echo("Hasta la vista, icons! Mwahaha!");
"!Go C:\Temp|C:\Temp" goto "C:\Temp";
"Go Desktop|Desktop" goto "Desktop";
"Go XY exe|<xypath>\XYplorer.exe" goto "<xypath>\XYplorer.exe";
"-"
"Open With Photoshop|Photoshop" openwith "Photoshop";
"Open With Notepad|Notepad" openwith "Notepad";
OK, fixed as well. (Good bug! Not directly in Script Icons, but only surfaced by means of them!)

admin
Site Admin
Posts: 65245
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Icons in Scripts

Post by admin »

TheQwerty wrote:
admin wrote:
admin wrote:I will rewrite the bold/check thing in the next beta, so don't put too much work in it now.
I'm thinking about doing a third binary field Flags for these things:

Code: Select all

"Caption|Iconfile|Flags : Label" Script
where:
Flags 1 = Default
Flags 2 = Checked
Flags 4 = Disabled
It's cleaner, but maybe makes scripts a bit harder to read. Opinions please.
Honestly, I don't like all this overloading of the "Caption : label". We all said that the format of script files is flawed and not ideal anymore, so maybe it's time we considered a more structured approach?

Something that would allow us to use real sub-menus and didn't rely so heavily on white-space.
Go ahead, today seems to be your structured day! :D

For starters, what about this (new keyword cmd to start a menu command); no more white space or indents necessary thanks to {...}:

Code: Select all

cmd label(caption, icon, flags) {script}

j_c_hallgren
XY Blog Master
Posts: 5826
Joined: 02 Jan 2006 19:34
Location: So. Chatham MA/Clearwater FL
Contact:

Re: Icons in Scripts

Post by j_c_hallgren »

admin wrote:For starters, what about this (new keyword cmd to start a menu command); no more white space or indents necessary thanks to {...}:

Code: Select all

cmd label(caption, icon, flags) {script}
When I see "cmd", I tend to think of the command line and this is something else, so while having a named keyword makes sense, not sure if "cmd" is best one...maybe "menucmd" or "menuopt" or something along those lines?
Still spending WAY TOO much time here! But it's such a pleasure helping XY be a treasure!
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: Icons in Scripts

Post by serendipity »

j_c_hallgren wrote:
admin wrote:For starters, what about this (new keyword cmd to start a menu command); no more white space or indents necessary thanks to {...}:

Code: Select all

cmd label(caption, icon, flags) {script}
When I see "cmd", I tend to think of the command line and this is something else, so while having a named keyword makes sense, not sure if "cmd" is best one...maybe "menucmd" or "menuopt" or something along those lines?
I agree, cmd is not the best.

zer0
Posts: 2676
Joined: 19 Jan 2009 20:11

Re: Icons in Scripts

Post by zer0 »

I'm not in favour of flags, to be honest. Also, I'd prefer symbolic representation of menus, level of boldness etc, not word commands. Symbols (and combinations of) are shorter and thus easier to remember.
Reporting a bug? Have a wish? Got a question? Use search - View roadmap - FAQs: Forum + XY site
Windows 7/10
Always using the latest stable two-decimal build

admin
Site Admin
Posts: 65245
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Icons in Scripts

Post by admin »

j_c_hallgren wrote:
admin wrote:For starters, what about this (new keyword cmd to start a menu command); no more white space or indents necessary thanks to {...}:

Code: Select all

cmd label(caption, icon, flags) {script}
When I see "cmd", I tend to think of the command line and this is something else, so while having a named keyword makes sense, not sure if "cmd" is best one...maybe "menucmd" or "menuopt" or something along those lines?
The obvious other candidate is function.

Post Reply