Icofx Scripts (Business/Site License Only)

Using icofx scripts you can create scripts to automate certain tasks. Scripts can be created using the Script Editor.

Script Editor

Using the script editor you can automate certain tasks. You can access the script editor using the "Tools/Run Script..." menu item.

Script Editor
The script editor dialog

The "Run Script" dialog will provide you with an editor that lets you write your icofx scripts and run them. It provides standard editing feature you will expect from an editor. Additionally it provides syntax highlighting for easier editing. It also provides error highlighting. If a command has invalid syntax it will be underlined and will provide a tooltip on mouse hover about the error.

On the toolbar of the dialog you have the following buttons:

  • New - Will create a new script.
  • Open - Will open an existing script.
  • Save - Will save the script.
  • Undo - Undo the last editing. Multiple undo steps are available.
  • Redo - Redo the editing.
  • Run - Executes the current script.
  • Theme - Using this combobox you can change the color theme of the editor.
  • Help - Opens this help page.

The editor provides a list of helpful shortcuts:

  • Ctrl+N - new script
  • Ctrl+O - open a script
  • Ctrl+S - save the script
  • Ctrl+Z - undo
  • Ctrl+Y - redo
  • Ctrl+C - copy
  • Ctrl+V - paste
  • Ctrl+X - cut
  • Ctrl+/ - comment the selected lines or the current line
  • Ctrl+L - delete the current line
  • F1 - help

When a script is running you can see the output and progress on the result dialog. Using the cancel button you can cancel the execution of the script. The result dialog is not displayed if the log command is used to redirect the output to a log file.

Result dialog
The script editor dialog
↑ Top of PageContent

Script Files

Icofx stores the scripts created using the script editor in a script file. These are plain text files with the extension .fxs. A script file contains a series of commands that will be executed by icofx. The commands are executed in the order they appear in the script (top to bottom). Anything after a slash (/) character is considered a comment and will not be executed.

You can automatically execute script files by giving them as a command line argument when icofx is started. Icofx will open and execute the script file it was given as an argument. If you give more than one script file as argument then only the first one will be opened and executed, the rest will be ignored.

↑ Top of PageContent

Commands

Icofx script consists of commands. The syntax of a command is:

command
  input_file1
  "input file2"
  -name1 value1
  -name1 value2, value3

Each command starts with a command name. Some commands have a list of input file names that will be used by the command. Finally a list of command parameters follows. Some parameters are optional. Some parameters can contain multiple values.

If a filename contains spaces it must be surrounded by double quotes ("). File names can contain wild card characters like "*" and "?". When the command will be executed all the wild crads will be expanded to the matching files. For example if a command has "d:\images\*.png" as input file then this will be expanded so that the command receives all png files from the d:l\images folder.

↑ Top of PageContent

Command List

extract

The extract command will extract the icons and/or cursors from the files given as input parameter.

Input files:

It can extract from from EXE, DLL and OCX Windows binary files, and Mac Binary, AppleSingle and AppleDouble Macintosh binary files.

Parameters:

Name Optional Values Description
-output No folder name The output folder
-type Yes ico, cur The resource type to extract. Default value is ico.

Example:

/ extract all icons and cursors from icofx.exe to c:\tmp\
extract
  "C:\Program Files (x86)\icofx3\icofx3.exe"
  -type ico, cur
  -output c:\tmp\

↑ Top of PageContent

image

The image command allows you to extract the image files from ifx, icon or cursor file. Each image format inside the icon will be a separate image file. You can even export animated cursors (*.ani) to animations like gif or apng

Input files:

It can extract images from ico, cur, ifx, ani and icns files.

Parameters:

Name Optional Values Description
-output No folder name The output folder
-type Yes png, bmp, gif, xpm, ifx, jpg, jp2, tif, apng The file type of the output image. Default value is png.

Example:

/ extract all images to jpeg files from the icofx and icofx2 icons
image
  "C:\icofx3\icofx.ico"
  "C:\icofx3\icofx2.ico"
  -type jpg
  -output c:\tmp\

↑ Top of PageContent

action

The action command applies a given action to the input images. You can read more about actions here.

Input files:

Image, icon or cursor files. If you process icons or other images that contain multiple images and you want to apply the action on all images then make sure that the "Options/Apply Adjustments to All Layers/images" option is checked. If it is not checked then the action will be applied only to the first image.

Parameters:

Name Optional Values Description
-output No folder name The output folder
-action No name The name of the action to apply.
-fg Yes file name File name of the foreground image. The foreground image will be merged on the icon image as an overlay.
-bg Yes file name File name of the background image. The background image will be merged behind the icon image.
-del Yes file name File name of the mask image. The mask image will be deleted from the image.

Example:

/ apply the "Hot Image" action to all png files from the normal folder and save them to the hot folder
action
  "C:\images\normal\*.png"
  -action "Hot Image"
  -output C:\images\hot\

↑ Top of PageContent

group

The group command will group images with similar names to icons. You can read more about grouping here.

Input files:

Image files.

Parameters:

Name Optional Values Description
-output No folder name The output folder
-type Yes ico, icns The output icon type. For Windows icons uses ico, for Mac icons use icns. Default value is ico.

Example:

/ group similar named png files from the images folder to Windows icons and save them to the icons folder
group
  "C:\images\*.png"
  -output C:\icons\

↑ Top of PageContent

create

Using the create command you can create icons or cursors from images. The input images will be converted to cursors or icons and will contain all the recommended image formats. It can also convert icons to icons. You can use this mode to convert Macintosh icons to Windows icons or vice versa.

Input files:

Image, icon and cursor files.

Parameters:

Name Optional Values Description
-output No folder name The output folder
-type Yes ico, icns, cur, aniThe output icon or cursor type. For Windows icons uses ico, for Mac icons use icns. Default value is ico.
-fg Yes file name File name of the foreground image. The foreground image will be merged on the icon image as an overlay.
-bg Yes file name File name of the background image. The background image will be merged behind the icon image.
-sharpen Yes number from 0 to 3 The sharpen level that will be applied to the icon images. Default is 0 (off).
-formats Yes list of formats The image formats to add to the icon/cursor. If not specified all the recommended image formats will be added. If specified only the given formats will be added. ex 16x16-32, 16x16-8, 32x32-32
-hotspotUnitYes pixel, percent Specifies the cursor hotspot unit. Default value is pixel.
-hotspotX Yes number The X hotspot of the cursor. Can be a pixel value or a percent depending on the -hotspotUnit parameter. Default value is 0.
-hotspotY Yes number The Y hotspot of the cursor. Can be a pixel value or a percent depending on the -hotspotUnit parameter. Default value is 0.

Example:

/ convert all png files from the images folder to icons using sharpening
create
  "C:\images\*.png"
  -sharpen 2
  -output C:\icons\

↑ Top of PageContent

addResource

With the help of the addResource command you can add icons or cursors to your exe, dll, icon/cursor library files.

Input files:

Icon or cursor files. After the file name you can optionally specify the resource name, resource language, and for icon/cursor libraries also an icon /cursor name separated by the "|" character. The resource name can be a string like ICON1 or a numeric ID. For numeric IDs use the # prefix ex. #100. If you leave the resource name empty icofx will calculate a unique resource name for you. The resource language id is a numeric value representing the language number. If you leave it empty 0 (language neutral) will be used. The name of icons/cursors can also be defined. If left empty the filename will be used as name.

Parameters:

Name Optional Values Description
-output No file name The output file to which the icons/cursors will be added.
-type Yes ico, cur The resource type to add. Choose ico if you want to add icons, cur for adding cursors. Default value is ico.

Example:

/ add icons to the icons.icl icon library
addResource
  "C:\icons\main\main.ico" / res name will be autocalculated, language is 0, name will be main
  "C:\icons\main\main.ico|MAINICON|0|mainicon" / res name will be MAINICON, language is 0, name will be mainicon
  "C:\icons\*.ico"||1033 / res name will be autocalculated, language is 1033, name will be the file name
  -type ico
  -output C:\icons\icons.icl

↑ Top of PageContent

delResource

Using the delResource command you can delete resources (icons or cursors) from exe, dll or icon/cursor library files.

Input files:

None

Parameters:

Name Optional Values Description
-names No name list Comma separated list of resource names to delete. You can also specify a language ID after the name using the "|" charachrer. If no language ID is specified 0 (language independent) will be used.
-output No file name The output file from which the resources will be deleted.
-type Yes ico, cur The resource type to delete. Choose ico if you want to delete icons, cur for deleting cursors. Default value is ico.

Example:

/ delete the icon resources MAINICON, icon2 and icon3 with language ID 0 and icon1 with ID 1033
delResource
  -names MAINICON|0, icon1|1033, icon2, icon3
  -output C:\icons\icons.icl

↑ Top of PageContent

exit

Exits icofx. You will be prompted to save all unsaved work. No input files or parameters are expected.

Example:

exit

↑ Top of PageContent

terminate

Exits icofx immediately. You will not be prompted to save your work. All unsaved images will be lost. No input files or parameters are expected.

Example:

terminate

↑ Top of PageContent

echo

Writes a message to the result window or to the log file.

Input files:

None.

Parameters:

Name Optional Values Description
-msg No text The message to write out.

Example:

echo -msg "This is a message!"

↑ Top of PageContent

log

Output is redirected to a log file. the result window will not be displayed, and because of that the command execution cannot be canceled.

Input files:

None.

Parameters:

Name Optional Values Description
-output No file name The name of the log file where the output will be written.

Example:

log -output "d:\tmp\icofx log.txt"

↑ Top of PageContent