File icon, and not actual image, as script icon

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
Marco
Posts: 2354
Joined: 27 Jun 2011 15:20

File icon, and not actual image, as script icon

Post 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.
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

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

Post by SkyFrontier »

Thanks for the tip, Marco!
Was overlooking it as if it were a request...
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

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

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

Post 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)

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

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

Post by admin »

Easy, easy.

Next beta you can pass "*.bmp".

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

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

Post 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
To see the attached files, you need to log into the forum.

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

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

Post by admin »

OH, damn. It was a coincidence that it worked here. I upload something better in some minutes...

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

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

Post 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.

binocular222
Posts: 1424
Joined: 04 Nov 2008 05:35
Location: Win11, Win10, 100% Scaling

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

Post by binocular222 »

Not work in PFA (anyway, not important).
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488

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

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

Post 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.

Post Reply