X++ tips, tricks and notes

X++: Export all Dynamics AX 2012 embedded icons

X++: Export all Dynamics AX 2012 embedded icons

Have you ever wanted a folder containing all the icons in AX2012?

Then I think you have also searched for a folder somewhere on the server containing the icons and pictures?

Search no more! Since I couldn’t find this folder or a piece of code that exports all the icons, I wrote the job below based on the code in the SysImageResources form.

All the job does is find all the embedded resources and stores their numbers. Then it loads each resource and saves it on the disk.

It saves all icons as png format. The image name is the number used on a button or menu item when the NormalImage property is set to EmbeddedResource.

It takes a while to execute, but when it is done, it will leave you thousands of images in a folder:

iconsAx2012

If you print all the images with Windows (35 images per page), you will have 86 pages filled with icons.

Have fun exporting the system icons!

//Tina van der Vyver
//tinavandervyver.com
static void ExportEmbeddedImages(Args _args)
{
    #Define.MaxNumOfResources(60000)
    
    int i, noOfRes, a[,1];
    Image image;

    new InteropPermission(InteropKind::ClrInterop).assert();

    for (i=1; i<#MaxNumOfResources; i++)
    {
        if (Image::validResource(i))
        {
            noOfRes++;
            a[noOfRes] = i;
        }
    }

    for (i=1; i<=noofRes; i++)
    {
        image = new Image();

        image.loadResource(a[i]);
        image.saveImage(strFmt(@"c:\images\%1.png", a[i]),4);
    }

    CodeAccessPermission::revertAssert();
}


2 thoughts on “X++: Export all Dynamics AX 2012 embedded icons”

Leave a Reply

Your email address will not be published. Required fields are marked *