home *** CD-ROM | disk | FTP | other *** search
/ Visual FX for Image FX / VisualFX for Image FX 3.adf / Files / SetUp / 03 / 07.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1997-09-10  |  7.3 KB  |  317 lines

  1. /*
  2.                                  Visual FX
  3.                                     For
  4.                                  Image FX
  5.                                SetUp Script
  6.                            Written By J.L. White
  7.  
  8.                          (C)1997 Merlin's Software
  9.  
  10. */
  11.  
  12. parse arg Num Frames
  13. options results
  14. address "IMAGEFX.1"
  15. ReDraw On
  16. Quotes = '22'X
  17.  
  18.     RequestResponse "Do You Need Instructions?"
  19.     if rc = 0 then do
  20.         call Docs()
  21.         end    
  22.  
  23. if exists("libs:flyer.library") then do
  24.     if (POS('PROJECT_REXX_PORT',SHOW('Ports')) =0) then do
  25.         RequestNotify 'Flyer Must Be Running First!'
  26.         exit
  27.         end
  28.     call OpenFlyStuff()
  29.  
  30.  
  31.     Gadget.1 = 'D/110/22/120/ImageA Type/4/FLYER CLIP/FLYER STILL/FRAME/SEQUENCE'
  32.     ComplexRequest  '"Visual FX  SetUp Options"' 1 Gadget 250 60
  33.     if rc ~= 0 then do
  34.         call CloseStuff()
  35.         exit 0
  36.         end
  37.     else do
  38.         IAType = RESULT.1
  39.            end
  40.  
  41.     call GetA()
  42. end
  43. else do
  44.     Gadget.1 = 'D/110/22/120/ImageA Type/2/FRAME/SEQUENCE'
  45.     ComplexRequest  '"Visual FX  SetUp Options"' 1 Gadget 250 60
  46.     if rc ~= 0 then do
  47.         call CloseStuff()
  48.         exit 0
  49.         end
  50.     else do
  51.         IAType = RESULT.1+2
  52.            end
  53.  
  54.     call GetA()
  55. end
  56.  
  57. if FlyOn = 1 then
  58.     call CloseStuff()
  59.  
  60.  
  61.  
  62.  
  63.  
  64.     call LoadA()
  65.     GetMain
  66.     parse var result Name Width Height Blah
  67.     CropAnswer = "None"
  68.     RequestResponse "Does Image Need To Be Cropped?"
  69.     if rc = 0 then do
  70.         call CropPic()
  71.         end    
  72.  
  73.     LoadBuffer "VFXIFX:Images/Pics/Templates.Pic" Force
  74.     RequestNotify "Look At Examples For FileName Then Click "Quotes"Okay"Quotes""
  75.  
  76.     RequestFile '"Select File To Use For Template!" "VFXIFX:Images/Templates" ""'
  77.     Template = result
  78.  
  79.     LoadBuffer Template Force
  80.     Scale Width Height
  81.     KillBrush
  82.     call PickBox()
  83.  
  84. call open TempFile,"VFXIFX:TempDrawer/"strip(Num),W
  85. call writeln TempFile,PicAName
  86. call writeln TempFile,Start
  87. call writeln TempFile,End
  88. call writeln TempFile,IAType
  89. call writeln TempFile,Template
  90. call writeln TempFile,WindowType
  91. call writeln TempFile,CropAnswer
  92. call close TempFile
  93. exit
  94.  
  95.  
  96.  
  97. CropPic:
  98.     Learn "RAM:VFX" NoHeader Quiet Force
  99.     Crop
  100.     Learn Stop Quiet Force
  101.  
  102.     call open TempFile,"RAM:VFX.ifx",R
  103.     do until eof(TempFile)
  104.         line = readln(TempFile)
  105.         parse var line StartLine" "RestOfLine
  106.         if StartLine = "Crop" then CropAnswer = line
  107.         end
  108.     call close TempFile
  109.     address command "Delete >NIL: Ram:VFX.ifx"
  110.  
  111. return
  112.  
  113. GetFile:
  114.     parse Arg Title, Path
  115.     Address FLY_1 SetString Path
  116.     Address FLY_1 GetFileNameNT Title
  117. return result
  118.  
  119. GetFileName: procedure  
  120.    ARG CompleteName
  121.    c = lastpos("/",CompleteName)
  122.    if c = 0 then c = lastpos(":",CompleteName)
  123.    return substr(CompleteName, c + 1)
  124.  
  125.  
  126. GetA:
  127.  if IAType = 0 then do
  128.     call Switcher(TOSW)
  129.     PicAName = GetFile("Select Flyer Clip For ImageA!  ",DriveName)
  130.     Name = GetFileName(PicAName)
  131.     if Name = "" then do
  132.         Address FLY_1 OK_TEXT " OK "
  133.         Title = "You Must Enter A Valid Clip Name To Use!"
  134.         Address FLY_1 FYINT Title
  135.         Address FLY_1 Quit
  136.         call Switcher(TOWB)
  137.         exit
  138.         end
  139.     Address FLY_1 SetFileName PicAName
  140.     Address FLY_1 GetClipLength PicAName
  141.     End = result
  142.     Start = 0
  143.     Address FLY_1 Program "5"
  144.     Address FLY_1 StartNum Start
  145.     Address FLY_1 EndNum End
  146.     Address FLY_1 CurrentNum "0"
  147.     Address FLY_1 GetTimeNT "Select A Range Of Frames To Process!"
  148.     Start = word(result,1)*2
  149.     End = word(result,2)*2
  150.     Start  = Start + 1
  151.     End = End +2
  152.     call addlib('PROJECT_REXX_PORT' , 0)
  153.     call addlib(TOASTERLIB,0)
  154.     call Switcher(TOWB)
  155.     address command "C:Wait 1"
  156.     ScreenToFront
  157.     end
  158.    if IAType = 1 then do
  159.     RequestFile '"Select Flyer Still For ImageA!"' DriveName ' '
  160.     PicAName = result
  161.     Name = GetFileName(PicAName)
  162.     if Name = "" then do
  163.         Title = "You Must Enter A Valid Name To Use!"
  164.         RequestNotify Title
  165.         if FlyOn = 1 then Address FLY_1 Quit
  166.         exit
  167.         end
  168.     RequestNumber '"Enter Number Of Frames To Process!"' Frames
  169.     End = result
  170.     Start = 1
  171.     end
  172.    if IAType = 2 then do
  173.     RequestFile '"Select FileName For ImageA!"' 'SYS:' ' '
  174.     PicAName = result
  175.     Name = GetFileName(PicAName)
  176.     if Name = "" then do
  177.         Title = "You Must Enter A Valid Name To Use!"
  178.         RequestNotify Title
  179.         if FlyOn = 1 then Address FLY_1 Quit
  180.         exit
  181.         end
  182.     RequestNumber '"Enter Number Of Frames To Process!"' Frames
  183.     End = result
  184.     Start = 1
  185.     end
  186.    if IAType = 3 then do
  187.     RequestFile '"Select BaseName For ImageA! "' 'SYS:' ' '
  188.     PicAName = result
  189.     Name = GetFileName(PicAName)
  190.     if Name = "" then do
  191.         Title = "You Must Enter A Valid Name To Use!"
  192.         RequestNotify Title
  193.         if FlyOn = 1 then Address FLY_1 Quit
  194.         exit
  195.         end
  196.     RequestNumber '"Enter Number Of Frames To Process!"' Frames
  197.     End = result
  198.     Start = 1
  199.     end
  200. return
  201.  
  202. CloseStuff:
  203.     Address FLY_1 Quit
  204.     call remlib('ToasterARexx.port')
  205.     call remlib('PROJECT_REXX_PORT')
  206. return
  207.  
  208.  
  209. OpenFlyStuff:
  210.     FlyOn = 1
  211.     address command "run VFXIFX:FLY" 
  212.     do while (POS('FLY_1',SHOW('Ports')) = 0)
  213.         address command "wait 1"
  214.         end
  215.     TOASTERLIB="ToasterARexx.port"
  216.     call remlib('ToasterARexx.port')
  217.     call remlib('PROJECT_REXX_PORT')
  218.     call addlib('PROJECT_REXX_PORT' , 0)
  219.     call addlib(TOASTERLIB,0)
  220.     DriveName = FindDrive()
  221. return
  222.  
  223.  
  224. FindDrive:
  225.     address command "C:Info >RAM:DriveList"
  226.     call open TempFile,"RAM:DriveList",R
  227.     do until eof(TempFile)
  228.         line = readln(TempFile)
  229.         parse var line Drive" "Rest
  230.         if Drive = "FA0:" then 
  231.             FlyVolume = word(Rest,7)":"
  232.     end
  233.     call close TempFile
  234.     address command "Delete >NIL: RAM:DriveList"
  235. return FlyVolume
  236.  
  237.  
  238.  
  239. LoadA:
  240.     if IAType = 0 then do
  241.         LoadBuffer PicAName Force Start
  242.         end
  243.     if IAType = 1 then do
  244.         LoadBuffer PicAName Force 1
  245.         end
  246.     if IAType = 2 then do
  247.         LoadBuffer PicAName Force
  248.         end
  249.     if IAType = 3 then do
  250.         LoadBuffer PicAName""right(Start,3,'0') Force
  251.         end
  252. return
  253.  
  254. PickBox:
  255.     KillBrush
  256.     Menu ToolBox
  257.     RequestNotify "Draw Rectangle Where You Want Image Placed!"
  258.     DrawTool Box
  259.     HidePanel
  260.     Undo On
  261.     WaitFor SELECTDOWN
  262.     parse var result X1 Y1
  263.     WaitFor SELECTUP
  264.     parse var result X2 Y2
  265.     Undo
  266.     ShowPanel
  267.     Undo Off
  268.     X1 = strip(X1)
  269.     Y1 = strip(Y1)
  270.     X2 = strip(X2)-X1
  271.     Y2 = strip(Y2)-Y1
  272.     RequestResponse "Is The Box You Selected Correct?"
  273.     if rc ~= 0 then call PickBox()
  274.  
  275.     WindowType = X1" "Y1" "X2" "Y2
  276.  
  277. return
  278.  
  279.  
  280.  
  281.  
  282. Docs:
  283.  
  284.     text1 = '"This effect takes an image & allows you to scale it into"'
  285.     text2 = '"a smaller image inside a template image. For example,"'
  286.     text3 = '"we have a template of a Picture Frame hanging on a brick"'
  287.     text4 = '"wall. The script asks you to draw a box at the place you"'
  288.     text5 = '"want your clip to appear, in this case you would draw the"'
  289.     text6 = '"box inside the frame. You can use any picture you want"'
  290.     text7 = '"as a Template, we supply a handful to choose from."'
  291.     text8 = '" "'
  292.     text9 = '"The Crop Image option is there for Flyer Users. The clip"'
  293.     text10 = '"may have garbage on the edges, that are not seen because"'
  294.     text11 = '"of overscan but when scaled to the center, you can see it."'
  295.     text12 = '"This allows you to crop the garbage first, then it will"'
  296.     text13 = '"scale it back to the correct size."'
  297.  
  298.     Gadget.1  = 'TEXT LE=10 TE=4 LB='text1' '
  299.     Gadget.2  = 'TEXT LE=10 TE=14 LB='text2' '
  300.     Gadget.3  = 'TEXT LE=10 TE=24 LB='text3' '
  301.     Gadget.4  = 'TEXT LE=10 TE=34 LB='text4' '
  302.     Gadget.5  = 'TEXT LE=10 TE=44 LB='text5' '
  303.     Gadget.6  = 'TEXT LE=10 TE=54 LB='text6' '
  304.     Gadget.7  = 'TEXT LE=10 TE=64 LB='text7' '
  305.     Gadget.8  = 'TEXT LE=10 TE=74 LB='text8' '
  306.     Gadget.9  = 'TEXT LE=10 TE=84 LB='text9' '
  307.     Gadget.10  = 'TEXT LE=10 TE=94 LB='text10' '
  308.     Gadget.11  = 'TEXT LE=10 TE=104 LB='text11' '
  309.     Gadget.12  = 'TEXT LE=10 TE=114 LB='text12' '
  310.     Gadget.13  = 'TEXT LE=10 TE=124 LB='text13' '
  311.     Gadget.14 = 'END'
  312.     NewComplexRequest  '"Instructions For Effect #07"' Gadget 420 136
  313.  
  314. return
  315.  
  316.  
  317.