13.0.46 adds support (see below for release notes) for extracting icons. I can get the internal icon method to work with e.g: dlg.control("static1").label = "#ziptoolkit"; but I am struggling to use LoadImage to extract from a DLL e.g: dlg.control("static1").label = DOpus.Loadimage("C:/Windows/System32/zipfldr.dll"); Is my syntax incorrect?
Scripting: Scripts can now extract icons from DLLs and EXEs using the standard LoadImage functions
Scripting: Scripts can now access internal icon images; pass the icon name prefixed with # (e.g. #copy). By default the large size is returned; use #0:name for the small size. You can also specify a particular set using #set:icon or #0:set:icon.
Maybe that's what you expected, but there are some problems with that.
dll
function OnClick(clickData)
{
if (!DOpus.version.AtLeast("13.0.46"))
{
DOpus.Output("This script requires version 13 and above!");
return
}
var cmd = clickData.func.command;
var image = DOpus.LoadImage("C:/Windows/System32/shell32.dll,15", 16, 16);
//image.SetClip(); // Throw error
DOpus.Output(image.SetClip() + image.width); // The image was copied to the clipboard, but image.width was not the specified 16
cmd.RunCommand('Clipboard PASTE=png AS "D:\\icon.png"') // Image size is 32x32
}
png
function OnClick(clickData)
{
if (!DOpus.version.AtLeast("13.0.46"))
{
DOpus.Output("This script requires version 13 and above!");
return
}
var cmd = clickData.func.command;
var image = DOpus.LoadImage("D:\\Test.png", 300);
//image.SetClip(); // Throw error
DOpus.Output(image.SetClip() + image.width); // The image was copied to the clipboard, but image.width was not the specified 300
cmd.RunCommand('Clipboard PASTE=png AS "D:\\icon.png"') // Image size is 500x808
}
You'll also lose the icon's transparency if the image is saved via the clipboard (since clipboard image data has no alpha channel by convention).
There are lots of tools for extracting icons from DLL/EXE files already though, if that's what you need to do. Those can give you the full .ico file with all sizes and depths.