home *** CD-ROM | disk | FTP | other *** search
/ PC User 2002 April / Disc 2 / PCUSER0402D2.iso / software / utils / files / wincron.exe / data1.cab / Sample_Scripts / clip_images.tg < prev    next >
Encoding:
Text File  |  2001-10-20  |  1.7 KB  |  70 lines

  1. ## clip_images.tg
  2. # Read image files (oldest first) from SRC_DIR into IN_FILE
  3. # Then, crop the image and build a new OUT_NAME
  4. # Write the cropped image in OUT_NAME to disk
  5. # Finally, delete the original IN_FILE
  6.  
  7. # clip_images
  8. {
  9.     -name clip_images 
  10.     -start 
  11.  
  12.     ###
  13.     # setup source, destination and temp names
  14.     # You can either uncomment these lines or set these values in your 
  15.     # computer environment.
  16.     -action -set SRC_DIR=c:\pitfight
  17.     -action -set IN_NAME=
  18.     -action -set OUT_NAME=
  19.     
  20.     # set up an error handler for file operations
  21.     -action -onerror file_operation_fail
  22.  
  23.     # supply input mask and output variable name
  24.     -action -set OP=getFile
  25.     -action -print trying to GET oldest file first
  26.     -action -getFile -oldest "%SRC_DIR%\*.bmp" IN_NAME
  27.  
  28.     # read the dib
  29.     -action -set OP=dibRead    
  30.     -action -print Reading DIB %IN_NAME%
  31.     -action -img dibRead handle %IN_NAME%
  32.  
  33.     # crop the dib
  34.     -action -set OP=dibCrop
  35.     -action -print Cropping DIB %IN_NAME%
  36.     -action -img dibCrop handle 640 480
  37.  
  38.     # create new output name in OUT_NAME
  39.     -action -str SplitPath %IN_NAME% drive path fname ext
  40.     -action -str MakePath OUT_NAME %drive% %path% %fname% "dib"
  41.  
  42.     # write the BMP file
  43.     -action -set OP=dibWriteBMP
  44.     -action -print Writing BMP %OUT_NAME%
  45.     -action -img dibWriteBMP handle %OUT_NAME%
  46.     
  47.     # free memory
  48.     -action -set OP=dibRelease
  49.     -action -print Freeing DIB memory
  50.     -action -img dibRelease handle
  51.  
  52.     # delete the input file
  53.     -action -set OP=delete
  54.     -action -print Delete %IN_NAME%
  55.     -action -delete %IN_NAME%
  56.     
  57.     # done!
  58.     -action -print done!
  59.     -action -inc 0 0 0 1
  60. }
  61.  
  62. # file operation failed
  63. {
  64.     -name file_operation_fail
  65.     -action -print file operation %OP% failed
  66.     -action -print will try later
  67.     -action -return break
  68. }
  69.  
  70.