Page 1 of 4

Icons in Scripts

Posted: 16 Sep 2009 15:00
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! :)

Re: Icons in Scripts

Posted: 16 Sep 2009 15:13
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.

Re: Icons in Scripts

Posted: 16 Sep 2009 15:15
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.

Re: Icons in Scripts

Posted: 16 Sep 2009 15:27
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...

Re: Icons in Scripts

Posted: 16 Sep 2009 15:27
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";

Re: Icons in Scripts

Posted: 16 Sep 2009 15:28
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.

Re: Icons in Scripts

Posted: 16 Sep 2009 15:29
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.

Re: Icons in Scripts

Posted: 16 Sep 2009 15:36
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.

Re: Icons in Scripts

Posted: 16 Sep 2009 15:42
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)

Re: Icons in Scripts

Posted: 16 Sep 2009 15:46
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!)

Re: Icons in Scripts

Posted: 16 Sep 2009 16:01
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}

Re: Icons in Scripts

Posted: 16 Sep 2009 16:23
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?

Re: Icons in Scripts

Posted: 16 Sep 2009 16:31
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.

Re: Icons in Scripts

Posted: 16 Sep 2009 16:38
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.

Re: Icons in Scripts

Posted: 16 Sep 2009 17:50
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.