ILWIS 3.21 comes with several improvements regarding external commands 1 and extensions to the menu and operation tree/list to make it more convenient for users to open external documents (.doc, .txt etc.) or call external executable files (.exe, .com or .bat files) and include the commands for doing so in the ILWIS menu and operation tree/list.
New in ILWIS 3.21 1. Improved command syntax for external commands - External commands can have Long File Names. This is supported for all the options to call external commands: o The ILWIS command-line o A script o The action.def file (menu, operation tree/list) o The Tools subdirectory (see last paragraph: Already existing functionality ) - External commands for calling an executable file can have parameters. This works for all the options to call external commands with parameters: o The ILWIS command-line o A script o The action.def file (menu, operation tree/list)
2. Improved behavior when executing external commands - For external executable files, ILWIS will wait for them to finish execution before a new command is processed. This option can be disabled if needed (see later in this document). - For MS-DOS executable files, ILWIS will show the MS-DOS window while it is executing. If an error occurs in the MS-DOS program, ILWIS will show the error in a pop-up message.
3. User-made action.def files - ILWIS searches for user-made action.def files in the subfolders of ILWIS. The operations found there are merged to the operations found in the main action.def file.
Improved command syntax for external commands
Supported syntax New in 3.21 Notes !file No It is assumed that file is an executable file with extension .exe !file.ext No Executable files (e.g. .exe) are executed; document files (e.g. .txt) are opened in the appropriate program. !full_path\file.ext No A full path can be included !path_relative_to_ilwis\file.ext Yes For executable files, a path relative to the folder where ILWIS resides can be included. This does not work for document files. !LFN_path_or_file.ext Yes When the path and/or the file consist of a Long File Name, the entire path, file and extension must be quoted by
1 The commands that start with ! and can be document files or executable files, with or without parameters. single quotes. !executable_file.ext parameter1 parameter2 Yes The two parameters are passed to the executable file. !executable_file.ext long parameter Yes The parameter in single quotes is passed as one parameter to the executable. This can e.g. be used for passing LFNs as a parameter.
Examples: Call notepad: !notepad Call notepad and let it open d:\try.txt: !notepad d:\try.txt Call C:\Program Files\gdal\gdal_translate.exe to convert d:\aaa.gif to d:\my files\bbb.tif: !C:\Program Files\gdal\gdal_translate.exe d:\aaa.gif d:\my files\bbb.tif
Notes: - Long File Names, whether as an executable file, a document file, or a parameter, must be quoted by single quotes. Unlike elsewhere in ILWIS, the quote must include the extension. - If no path is given to an external executable file, ILWIS will search for it at several places. Among others, the ILWIS directory, the current directory, the Windows and Windows\System directories and the directories in the PATH environment variable are searched. If the file is not located there, an absolute or relative path must be included. - If no path is given to an external document file, ILWIS will search for it in the current directory (ILWIS catalog). If the file is not located there, an absolute path or a path relative to the current directory must be included. - When files are passed as parameters to an external executable, it is up to the external executable to locate them. - If no extension is given to an external file, ILWIS will append .exe.
Improved behavior when executing external commands
Above commands will force ILWIS to wait for completion, e.g. ILWIS will wait for the user to close notepad, or wait for the conversion of gdal_translate. If this is unwanted, use !!, e.g. !!notepad to execute the external command in non-waiting mode (like in ILWIS versions prior to 3.21).
User-made action.def files
ILWIS will search for more files named action.def in subfolders of the ILWIS folder. With those, the user can add new commands to the ILWIS menu. The syntax is exactly the same as the main action.def file that resides in the ILWIS folder.
action.def files can refer to external commands (starting with !). Note that most likely in an action.def file the doubled !! is more appropriate, as ILWIS should not wait for completion of commands started from the menu or the operation tree/list.
For external commands in the user-made action.def files, one exception is made to the requirement that an absolute or relative path should be included: files in the same folder as the user- made action.def file can be referred to by preceding the file name by the characters .\ (dot-backslash).
Using abovementioned short path notation, here is one way of filling the Command column in a user- made action.def file that resides in the same folder as my editor.exe: !!.\my editor.exe
For user-made action.def files that include .\ before the filename, note the following: it is recommended to always surround the filename and the .\ with single quotes. Strictly speaking, this is only needed when the filename is a Long File Name or when ILWIS is installed in a path using Long File Names (such as Program Files), but quoting will make sure the user-made action.def files will work for other users as well.
Already existing functionality before ILWIS 3.21
The following functionality regarding extension of the menu with user-defined functions already existed in ILWIS versions prior to 3.21, but many users are not aware of it, and therefore the information is repeated here: - At start-up, ILWIS searches for a subfolder named Tools, and includes all files found there in the menu and the operation tree/list, under an entry named Tools. - At start-up, ILWIS searches for a subfolder named Scripts and includes all script (*.isl) files found there in the menu and the operation tree/list, under an entry named Scripts. - The user can add more folders to search for tools and scripts in the FilePreferencesDirectories of ILWIS. When adding multiple folders, they must be separated from each other by ; (semicolons). - The user can bypass the action.def file that resides in the same folder as ilwis30.exe, and have ILWIS use a custom action.def file instead. ILWIS will first look for an action.def file in the Default Startup dir set in the FilePreferencesDirectories. If it is not found there, ILWIS will try to find it in the folder mentioned in the Start in property of the Shortcut to ilwis30.exe. If it is also not found there, the action.def file is taken from the same folder as ilwis30.exe.