home *** CD-ROM | disk | FTP | other *** search
- /* TextureStudio ARexx script **************************************/
-
- /* Allow commands to return results */
-
- options results
-
- /* On error, goto ERROR:. Comment out this line if you wish to */
- /* perform your own error checking. */
-
- signal on error
-
- /* BEGIN PROGRAM *************************************************/
-
- address "TEXTURESTUDIO"
-
- /* Filename extension used for render files */
-
- FILENAME_EXTENSION = '.ilbm'
-
-
- /* Bring TextureStudio's screen to the front */
-
- SCREEN_FRONT
-
- /* Get the user's texture path */
-
- TEXTUREPATH_GET VAR texture_path
-
- /* Get the user's renderscreen path */
-
- RENDERSCREENPATH_GET VAR renderscreen_path
-
- /* Display multiselect file requester to select texture modules */
-
- REQUEST_MULTIFILE PATHPART '"'texture_path'"' PATTERN '"#?.itx"',
- TITLE '"Select texture file(s)"' STEM 'selected.'
-
- /* Request a destination path for renderscreen files */
-
- REQUEST_DIR PATHPART '"'renderscreen_path'"' TITLE '"Select a destination dir"',
- VAR 'dest_path'
-
-
- /* Stop input to windows */
-
- GUI_BLOCK
-
- /* Loop through each selected texture file and render to screen using current */
- /* user settings, then save out to selected path */
-
- do c = 0 to (selected.files.count - 1)
-
- /* Open texture and flush out all others */
-
- OPEN selected.files.c FLUSH
-
- /* Split source file into filepart and pathpart */
-
- FILE_SPLIT '"'selected.files.c'"' stem 'texture.'
-
- /* Chop off file extension */
- /* e.g. Radar.itx -> Radar */
-
- parse var texture.filepart texture_name '.'
-
- dest_filepart = texture_name
-
- /* Join destination file onto destination path */
-
- FILE_JOIN PATHPART '"'dest_path'"' FILEPART '"'dest_filepart'"',
- VAR 'dest_file'
-
- /* Render to file as ilbm24 */
-
- PREFS_SET FILEFORMAT ILBM24
-
- RENDEROPTIONS_SET TOFILE 1 FILE '"'dest_file'"'
-
- /* Render to screen and file */
-
- RENDER TOBACK
-
- /* Address ImageStudio */
-
- address "IMAGESTUDIO"
-
- /* Open in file */
-
- OPEN '"'dest_file'"'
-
- /* Delete orginal file */
-
- address command 'delete <NIL: >NIL: "'||dest_file||'"'
-
- /* Put filename extension onto texture name */
- /* e.g. Radar -> Radar.ilbm */
-
- dest_filepart = texture_name||FILENAME_EXTENSION
-
- FILE_JOIN PATHPART '"'dest_path'"' FILEPART '"'dest_filepart'"',
- VAR 'dest_file'
-
- /* Reduce to 32 colours with dithering */
-
- COLOURS 32 DITHER "FS"
-
- /* Save as ilbm */
-
- SAVE '"'dest_file'"' FORCE
-
- /* Back to TextureStudio */
-
- address "TEXTURESTUDIO"
-
- end
-
- /* Unblock the windows now */
-
- GUI_UNBLOCK
-
-
- /* END PROGRAM ***************************************************/
-
- exit
-
- /* On ERROR */
-
- ERROR:
-
- /* If we get here, either an error occurred with the command's */
- /* execution or there was an error with the command itself. */
- /* In the former case, rc2 contains the error message and in */
- /* the latter, rc2 contains an error number. SIGL contains */
- /* the line number of the command which caused the jump */
- /* to ERROR: */
-
- if datatype(rc2,'NUMERIC') == 1 then do
- /* See if we can describe the error with a string */
-
- select
- when rc2 == 103 then
- err_string = "ERROR 103, "||,
- "out of memory at line "||SIGL
- when rc2 == 114 then
- err_string = "ERROR 114, "||,
- "bad command template at line "||SIGL
- when rc2 == 115 then
- err_string = "ERROR 115, "||,
- "bad number for /N argument at line "||SIGL
- when rc2 == 116 then
- err_string = "ERROR 116, "||,
- "required argument missing at line "||SIGL
- when rc2 == 117 then
- err_string = "ERROR 117, "||,
- "value after keywork missing at line "||SIGL
- when rc2 == 118 then
- err_string = "ERROR 118, "||,
- "wrong number of arguments at line "||SIGL
- when rc2 == 119 then
- err_string = "ERROR 119, "||,
- "unmatched quotes at line "||SIGL
- when rc2 == 120 then
- err_string = "ERROR 120, "||,
- "line too long at line "||SIGL
- when rc2 == 236 then
- err_string = "ERROR 236, "||,
- "unknown command at line "||SIGL
- otherwise
- err_string = "ERROR "||rc2||" at line "||SIGL
- end
- end
- else if rc2 == 'RC2' then do
- err_string = "ERROR in command at line "||SIGL
- end
- else do
- err_string = rc2||", line "||SIGL
- end
-
- say err_string
-
-
- /* Unblock windows, just incase they are still blocked by the program being */
- /* terminated mid-way */
-
- address "TEXTURESTUDIO"
-
- GUI_UNBLOCK
-
- exit
-