Page 1 of 1

File icon, and not actual image, as script icon

Posted: 25 Jul 2015 15:20
by Marco
I have a script with this caption

Code: Select all

"1|<xypath>\..\Dexpot\Wallpaper 1.bmp"
and the resulting icon was the usual system .bmp icon. Then with the changes in

Code: Select all

v15.20.0202 - 2015-05-26 13:24
    + Scripting: Now you can also use image files of the following formats to 
      define the icons in multi-script menus:
        PNG, JPG, GIF, BMP, TIF
      XY variables and environment variables are supported. The path defaults to 
      the XY icon path <xyicons>.
      Example:
        "Katy|Katy.png"
          echo 'hello';
        "Betty|Betty.jpg"
          echo 'hello';
        "Thumbs Up|t-up.ico"
          echo 'hello';
I get the actual image as icon. Which is cool, but I'd rather get back to the plain old icon. So here's what I did, I changed the path to the icon file into

Code: Select all

%SystemRoot%\system32\imageres.dll / 66
Hope this helps people who want to get back to the old behaviour.

Re: File icon, and not actual image, as script icon

Posted: 26 Jul 2015 00:44
by SkyFrontier
Thanks for the tip, Marco!
Was overlooking it as if it were a request...

Re: File icon, and not actual image, as script icon

Posted: 10 Sep 2015 17:03
by TheQwerty
I think this should be easier to achieve.

Don, could you add special treatment for icons starting with * such that it makes use of CFI/shell icons?

Then using the icon for any specific extension could be done using *.ext (in Marco's example *.bmp).
This could also make use of the special CFI patterns:
*. = Files without an extension.
*? = Unknown file type.
*\ = Generic folder icon.
**\ = Generic folder icon in selected state.

This would make it much easier to use "generic" icons without having to ensure files actually exist - and it allows for the icons to change based on user/system configuration without modifying the script or icon files it references.

Even more fun... we can abuse this to manage script icons within CFI:

Code: Select all

"Script One|*.FAKE_EXT.itemOne" Echo 1;
"Script Two|*.FAKE_EXT.itemTwo" Echo 2;
CFI:

Code: Select all

+*.FAKE_EXT.itemOne><xy>
+*.FAKE_EXT.itemTwo><xy>
You can define CFIs that will likely never match anything, but when XY attempts to resolve the script's icons it should detect the match in CFI and use that. 8)

Re: File icon, and not actual image, as script icon

Posted: 10 Sep 2015 17:37
by admin
Easy, easy.

Next beta you can pass "*.bmp".

Re: File icon, and not actual image, as script icon

Posted: 10 Sep 2015 20:07
by TheQwerty
This does not work in a fresh v15.70.0113 here.

Using the sample in the change log via Scripting > Run Script:
2015-09-10 140417.png
Various Info wrote:XYplorer: 15.70.0113 (Pro Edition - Lifetime License Pro)
Loaded in: 547 ms at 9/10/2015 2:02:18 PM
Uptime: 42 secs
Memory Usage: 31,524 KB, Virtual Memory Size: 15,716 KB

OS: Windows 7 Professional (Service Pack 1), 64-bit (6.1)
OS Uptime: 1 week, 2 days, 21 hrs, 28 mins, 35 secs
UTC Offset: --04:00
User Role: User
Themes: Yes (Aero) RealSystem32: Yes

System Locale ID: 1033 (en-US)
Thread Locale ID: 1033 (en-US)
Default ANSI Code Page: 1252 (ANSI - Latin I)
Active Code Page: 1252 (ANSI - Latin I)
DBCS Code Page: No

DblClick Time: 550 ms
Screen: 1920x1080, 2, Virtual: (0, 0) - (3200, 1080), Work: (0, 0) - (1920, 1040)
Screen DPI: 96 (100%), twx: 15, stretch: 1
Screen Color Depth: 32
UseDPIAwareIconSizes: No, Yes
Icon Size: small=16, large=32
Icon Size Recommended: small=16, large=32

Re: File icon, and not actual image, as script icon

Posted: 10 Sep 2015 20:59
by admin
OH, damn. It was a coincidence that it worked here. I upload something better in some minutes...

Re: File icon, and not actual image, as script icon

Posted: 10 Sep 2015 21:20
by TheQwerty
v15.70.0114 works, but only for registered extensions.
I sort of expected unregistered extensions to use the generic file icon - but maybe no icon is okay.

Hint: '*\' works for an open folder.

Re: File icon, and not actual image, as script icon

Posted: 11 Sep 2015 05:05
by binocular222
Not work in PFA (anyway, not important).

Re: File icon, and not actual image, as script icon

Posted: 11 Sep 2015 09:25
by admin
TheQwerty wrote:v15.70.0114 works, but only for registered extensions.
I sort of expected unregistered extensions to use the generic file icon - but maybe no icon is okay.
I think you are right. I change it. Also CFI was not yet in effect here.