Name
SetIconProperties -- change properties of an icon (V4.5)
Synopsis
SetIconProperties(id, table)
SetIconProperties(file$, type[, tooltypes, deftool$]) (Amiga only)
Function
This function can be used to change the properties of an icon. This is mostly useful for Amiga icons because those contain metadata besides the image data, e.g. icon type, tooltypes, default tool, and so on. This metadata can be modified using SetIconProperties().

There are two ways of using this function: You can either pass the identifier of an icon in the first parameter and a table in the second parameter or you can pass the filename of an icon file in the first parameter and more arguments in the following parameters. Passing a filename to SetIconProperties() is only supported on AmigaOS and compatibles, passing an icon identifier is supported on all platforms however.

If you choose to pass an icon identifier to SetIconProperties(), you have to pass a table in the second argument to specify the actual properties to modify. The following icon properties can currently be modified:

Type:
This tag allows you to set the desired Amiga icon type for the icon. This must be one of the following constants:

#AMIGAICON_DISK:
An icon of a drive (e.g. RAM, HD, CD-ROM, etc.)

#AMIGAICON_DRAWER:
An icon of a drawer.

#AMIGAICON_TOOL:
An icon of a program

#AMIGAICON_PROJECT:
An icon of a project. A project is a data file that can be opened by an other program. The program that should be used to open the project should be passed in the DefaultTool tag (see below).

#AMIGAICON_GARBAGE:
A trashcan icon.

##AMIGAICON_DEVICE:
A device icon.

#AMIGAICON_KICKSTART:
A Kickstart icon.

(V9.0)

IconX:
The icon's x position relative to the top-left corner of the drawer it is stored in. (V9.0)

IconY:
The icon's y position relative to the top-left corner of the drawer it is stored in. (V9.0)

DrawerX:
In case Type is set to a container type like #AMIGAICON_DRAWER, this tag can be used to set the x position of the new window that will be opened when double-clicking the icon. (V9.0)

DrawerY:
In case Type is set to a container type like #AMIGAICON_DRAWER, this tag can be used to set the y position of the new window that will be opened when double-clicking the icon. (V9.0)

DrawerWidth:
In case Type is set to a container type like #AMIGAICON_DRAWER, this tag can be used to set the width of the new window that will be opened when double-clicking the icon. (V9.0)

DrawerHeight:
In case Type is set to a container type like #AMIGAICON_DRAWER, this tag can be used to set the height of the new window that will be opened when double-clicking the icon. (V9.0)

ViewAll:
In case Type is set to a container type like #AMIGAICON_DRAWER, you can set this tag to True to tell Workbench to show all files of the drawer, not just the ones that have an icon. (V9.0)

StackSize:
In case Type is set to #AMIGAICON_TOOL or #AMIGAICON_PROJECT, the desired stack size for the program to be launched. (V9.0)

DefaultTool:
In case Type is set to #AMIGAICON_PROJECT, this can be set to a string containing name (and optionally path) of the program to open the file with. (V9.0)

ToolTypes:
If you want to add tooltypes to the icon, you have to pass a table in the ToolTypes tag. The table must contain a list of subtables, one subtable per tooltype entry. Each subtable can contain the following tags:

Key:
This tag is mandatory. It specifies the name of the tooltype. Tooltype names should use letters of the English alphabet only. They should always be in upper-case format and must not use any SPACE characters. If you want a SPACE, use an underscore instead ("_"). Furthermore, numbers should not be used as the initial characters of a tooltype name.

Value:
This tag is optional. You can use it to assign a value to the tooltype. If you do not set this value, the tooltype will be a boolean one.

Enabled:
This tag is optional. It defaults to True. If you want to add tooltypes that are initially disabled, you can set this tag to False. In that case, the tooltype will be enclosed by parentheses which means that it is disabled.

Alternatively, you can also set tooltypes by using the RawToolTypes tag (see below).

(V9.0)

RawToolTypes:
If you don't want to use the ToolTypes tag for some reason, you can also use RawToolTypes to set them. In contrast to ToolTypes, the RawToolTypes tag doesn't divide tooltypes into their individual constituents (key, value, enabled flag). Instead, the RawToolTypes tag will just copy the tooltypes to the icon without any additional processing. This makes it possible to store custom data in tooltypes as well. If you want to do that, just set RawToolTypes to a table that contains all tooltypes that should be set as simple strings. (V9.0)

To read the properties of an icon, use the GetIconProperties() command.

Inputs
id
syntax 1: identifier of icon to modify
table
syntax 1: table containing icon properties to set
file$
syntax 2: the icon to modify
type
syntax 2: new type for the icon; must be one of the constants from above
tooltypes
syntax 2, optional: a table containing a list of all tooltypes you want to set; each list entry must have at least the Key field set; defaults to {} (empty table)
deftool$
syntax 2, optional: the default tool to set for this icon; will only be set for icons of type #AMIGAICON_PROJECT; defaults to ""
Example
SetIconProperties(1, {
    Type = #AMIGAICON_PROJECT,
    DefaultTool = "Hollywood:System/Hollywood",
    ToolTypes = {
       {Key = "BORDERLESS"},
       {Key = "BACKFILL", Value = "GRADIENT"},
       {Key = "STARTCOLOR", Value = "$000000"},
       {Key = "ENDCOLOR", Value = "$0000ff"},
       {Key = "FIXED", Enabled = False}
    }
})
The code above sets the type of icon 1 to #AMIGAICON_PROJECT, the default tool to "Hollywood:System/Hollywood" and adds some tooltypes.


SetIconProperties("MyCoolScript.hws.info", #AMIGAICON_PROJECT, {
{Key = "BORDERLESS"},
{Key = "BACKFILL", Value = "GRADIENT"},
{Key = "STARTCOLOR", Value = "$000000"},
{Key = "ENDCOLOR", Value = "$0000ff"},
{Key = "FIXED", Enabled = False} }, "Hollywood:System/Hollywood")
The code above sets Hollywood as the default tool for "MyCoolScript.hws". Furthermore, it adds several tooltypes to the script's icon that tell Hollywood what eye candy it should add to the script (e.g. gradient backfill).

Show TOC