Chapitre précédentRetour au sommaireChapitre suivant

VISION Documentation

Last update : 12/28/21


16. SCRIPTING

 


Starting with version 4.6a, VISION features script commands. This enables advances automation from a script: for example you can create a script that will automatically load images into VISION, modify them and save them.
Please use the latest VISION version to make sure all the commands below are supported.
SCRIPT folder contains all script examples to be used as a starting point for creating scripts. Of course, image locations are for my environment, you have to accomodate them for yours.
An optional parameter is marked as [<parameter>].
Commands are not case sensitive.

Scripting commands:

Command Group
Command Name
Parameters
Description
Sample in SCRIPTS folder
File



open
<filename>
Opens a file just like File->Open from menu.
Can be any image file, catalog file, script, slide-show.
buggy.vcs
clip.vcs
clip_loop.vcs
clip_paste.vcs
ddualton.vcs
ibrowser.vcs
img_prio.vcs
ldv.vcs
ldvcnt.vcs
ldvini.vcs
lloopfol.vcs
loadloop.vcs
main.vcs
muchram.vcs
muchram2.vcs
opnsav.vcs
s0.vcs
s1.vcs
spec512.vcs
close
<filename> [nosave]
Closes an open file just like File->Close from menu.
Optional parameter "nosave" can be used to avoid a prompt to confirm saving in case image has been modified.
buggy.vcs
clip.vcs
clip_loop.vcs
clip_paste.vcs
ddualton.vcs
img_prio.vcs
lloopfol.vcs
loadloop.vcs
main.vcs
muchram.vcs
muchram2.vcs
s0.vcs
s1.vcs
spec512.vcs
save
<filename> <filename for saving> [<options>]
Saves an open window to an image file with possibly a different name and saving options (format and format options)
The image format to use will be picked either from the options list (default) or from the file extension given by <filename for saving>.
options is a list of possible image options separated by ';':
Possible options:
fmt=<3 letter file extension>
quality=<0 to 100> (only applies to JPEG format)
flipflop=<0 to 3> (only applies to TARGA, bit#0: X-Axis, bit#1: Y-Axis)
byteorder=<intel or motorola> (only applies to TIFF format)
compression=<lzw or packbits or none> (only applies to TIFF format)
predictor=<rle or none> (only applies to TIFF format)
Any invalid option will be ignored (log file will mention it) and won't prevent saving.
e.g.:
save H:\IMGTEST\IMGTEST\MARBLES.TIF H:\IMGTEST\\mtest.tif compression=lzw;byteorder=intel
save H:\IMGTEST\MARBLES.TIF H:\IMGTEST\mtest2.tga quality=80;flipflop=2;byteorder=motorola
clip.vcs
clip_loop.vcs
clip_paste.vcs
ddualton.vcs
opnsav.vcs
bconv_do
<ini file>
Starts a Batch conversion with parameters passe through an INI file.
See bconv.ini for an example and description of INI parameters.
bcon.vcs
bconv.ini
Control










;
None
Comment; everything on the line after this command is ignored by script parser
All .vcs files
quit or exit
None
Request VISION to exit, just like File->Quit from menu
None
sleep or wait
<sleep_ms>
Script is halted for the given number of milliseconds. Don't expect much precision here.
ddualton.vcs
lloopfol.vcs
loop
<loop_number>
Starts a loop in the script for a fixed number of rounds. Every line between loop/end_loop is to be repeated this number of rounds.
A maximum of 4 loops can be nested.
ddualton.vcs
lloopfol.vcs
end_loop
None
Decrements current loop counter for the given loop sequence.

loop_folder
<Folder to parse> [<mask>] [recurse]
Starts a loop on a folder to pick every file:
<Folder to parse>: full path of the folder to loop on
[<mask>]: optional mask for files to pick, e.g. *.jpg; if not specified *.* is assumed
[recurse]: optional flag to use when a folder recursion is wanted
Inside the loop:
Current file is accessible via $LFCurrentFile global variable
Start folder (parameter#1 of Loop_Folder) is accessible via $LFStartFolder global variable
Global function LFAdjustDest(<start_folder,file,dest_folder>) allows to build destination file in such a way that it respect original folder hierachy, e.g.:
$LFStartFolder=H:\IMAGES
$LFCurrentFile=H:\IMAGES\BYPLANES\32\TC32.JPG
LFAdjustDest($LFStartFolder,$LFCurrentFile,H:\OPTIMAL) will be H:\OPTIMAL\BYPLANES\32
clip_loop.vcs
ddualton.vcs
ldvopt.vcs
lloopfol.vcs

endloop_folder
None Go to next file of the folder and update $LFCurrentFile accordingly clip_loop.vcs
ddualton.vcs
ldvopt.vcs
lloopfol.vcs
run_script
<.vcs script filename>
Runs a child script before returning cntrol to current script.
.vcs script filename can be a full filename or a relative one.
None
form_silent
< 0 or 1>
If set to 1, VISION will not display any message unless it requires user's choice. Typically all error/warnings won"t be displayed but will be logged to log file.
If no parameter is passed, 1 is assumed, i.e. no message to display.
This is very useful when looping on a folder, some images may fail to load and script would prompt for user to acknowledge the message, which could be annoying.
lloopfol.vcs

prog_silent
< 0 or 1> If set to 1, VISION will not display progress windows.
If no parameter is passed, 1 is assumed, i.e. no progress window.
This is very useful when looping on a folder, progress windows are displayed bt default and this may lead to some un-necessary flickering.
lloopfol.vcs

iprio_set or imgprio_set
<p1,p2,p3,...>
List of image module types listing the ones to try, p1,p2,p3 can be the following vales:.
1: VISION's internal module
2: zView image module
3: Image View module
4: zView SLB module (un-supported at this time)
Example: 2,3,1 means to load an image, VISION will first try a zView image module then an Image View and then an internal module
Default: 1,3,2
buggy.vcs
img_prio.vcs
loadloop.vcs
spec512.vcs
Image Catalog




cat_create
<filename of catalog file>
Create an empty catalog file. If .vic extension is not specified, it will be forced.
For next calls, filename is the reference to communicate with this catalog.
buggy.vcs
img_prio.vcs
main.vcs
muchram.vcs
muchram2.vcs
s0.vcs
s1.vcs
cat_addfile
<filename of catalog file> <image filename to add> Adds an image to an existing catalog (which could have been created by cat_create or open).
main.vcs
s0.vcs
cat_addfolder
<filename of catalog file> <folder to add with mask> [recurse]
Adds imaged from a folder with a mask to an existing catalog (which could have been created by cat_create or open).
e.g.: cat_addfolder H:\catalog\stimg12.vic H:\IMAGES\*.* recurse
buggy.vcs
img_prio.vcs
main.vcs
muchram.vcs
muchram2.vcs
s1.vcs
cat_openwicon
<filename of catalog file> Displays in a window icons of an existing catalog (which could have been created by cat_create or open) buggy.vcs
img_prio.vcs
main.vcs
muchram.vcs
muchram2.vcs
s0.vcs
s1.vcs
cat_setini
<filename of catalog file> <INI filename> Associates an INI file to an existing catalog (which could have been created by cat_create or open) in order to attach categories based on folder names.
See an example of such an INI file: photos.ini
main.vcs
photos.ini
Image Browser
ibrw_open
<filename>
Opens an image from a file into the Image Browser. All images from this folder can then be displayed using the next two commands.
ibrowser.vcs
main.vcs
ibrw_next
None
Opens the next image of the folder in the Image Browser
ibrowser.vcs
main.vcs
ibrw_prev
None
Opens the previous image of the folder in the Image Browser ibrowser.vcs
main.vcs
LDV

ldv_do
<filename or -f:filename> <ldv filename><parameters for this LDV...>
filename is the window image previously loaded with open. The LDV will operate on this image loaded into current number of planes.
-f:filename is an exisitng file. In this case, the LDV will not apply on the image loaded in the current number of planes but on its natve number of planes, image won't be displayed but can be saved to disk.
Each specific LDV parameter must be separated by a space.

Examples:
ldv_do $LFCurrentFile dither.ldv 4 -1 0
--> Will apply dither LDV on window previously open with parameters 4 (dither to dual-tone), -1 (auto threshold for dual-tone), 0 (current number of planes for output). This is done for each member of the loop folder. Image being loaded inot current number of planes.
ldv_do -f:H:\IMGTEST\rgb.tif optimg.ldv H:\IMGTEST\_rgb.tif Falcon
--> Will apply LDV optimg to file H:\IMGTEST\rgb.tif to generate H:\IMGTEST\_rgb.tif using Falcon profile. Faclon profile is defined in LDV\optimg.ini
ldv_do -f:H:\IMGTEST\TGA\MARBLES.TGA cntcol.ldv 1 H:\marbles1.txt. LDV operating on the original number of planes of the image.
--> Will apply LDV cntcol (count colors) on file H:\IMGTEST\TGA\MARBLES.TGA with algorithm 1 and generate outcome in H:\marbles1.txt LDV operating on the original number of planes of the image.
ddualton.vcs
dfixpal.vcs
ldv.vcs
ldvcnt.vcs
ldvcntf.vcs
ldvf.vcs
ldvopt.vcs
ldvopt256c.vcs

ldv_doip
<filename or -f:filename> <ldv filename><INI parameter file> Similar to previous command but more complete:
INI file can include block to use to apply LDV on, it is defined by keys x1,x2,y1,y2 and parameters can be passed through INI file with keys Parameter1, Pameter2, etc.
If % is used, this means that the percentage of  image size is used (e.g. percentage of width, heigth,...).
Example of INI file (for rotate LDV):
[LDVParams]
x1=40%
x2=60%
y1=40%
y2=60%

Parameter1=45
ldvini.vcs
pinvert.ini
plight.ini
ppuzzle.ini
protate.ini


Clipboard

clip_sel
<filename> <x> <y> <w> <h>
Selects a block (x,y,w,h) into a previously loaded image identified by its filename.
clip.vcs
clip_loop.vcs
clip_paste.vcs
clip_copy
None
Copies current selection into clipboard.
clip.vcs
clip_loop.vcs
clip_paste.vcs
clip_cut
None
Cuts current selection into clipboard.
None
clip_paste
<filename> <x> <y> Pastes clipboard into a previously loaded image identified by its filename at postion x,y. clip.vcs
clip_loop.vcs
clip_paste.vcs
clip_pasteN
<filename> Pastes clipboard into a new image identified by its filename. clip.vcs
clip_loop.vcs






Global variables:


Variable Name
Description
$LFStartFolder The initial folder (parameter#1 of Loop_Folder) for
$LFCurrentFile The current file for the LoopFolder section. Does not exist outside such a loop.



Global functions:


Function Name
Description
LFAdjustDest Syntax: LFAdjustDestLFAdjustDest(<start_folder,filename,dest_folder>)
Returns an adjusted filename to accomodate a location relative to a source and destination folder. Very useful to create files with regards to original folder hierachy, e.g.:
$LFStartFolder=H:\IMAGES
$LFCurrentFile=H:\IMAGES\BYPLANES\32\TC32.JPG
LFAdjustDest($LFStartFolder,$LFCurrentFile,H:\OPTIMAL) will be H:\OPTIMAL\BYPLANES\32





Chapitre précédentRetour au sommaireChapitre suivant

VISION Documentation

Last update : 12/28/21


16. SCRIPTING