home *** CD-ROM | disk | FTP | other *** search
/ Visual FX for Image FX / VisualFX for Image FX 3.adf / Files / SetUp / 03 / 08.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1997-08-07  |  9.6 KB  |  426 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/132/22/120/Base Image Type/4/FLYER CLIP/FLYER STILL/FRAME/SEQUENCE'
  32.     ComplexRequest  '"Visual FX  SetUp Options"' 1 Gadget 270 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/132/22/120/Base Image Type/2/FRAME/SEQUENCE'
  45.     ComplexRequest  '"Visual FX  SetUp Options"' 1 Gadget 270 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.  
  58.  
  59.     RequestNumber '"Enter Number Of Layers To Add!"' 1
  60.     CompTotal = result
  61.  
  62.     do i = 1 to CompTotal
  63.  
  64.  
  65.         if exists("libs:flyer.library") then do
  66.  
  67.             Gadget.1 = 'D/127/22/120/Layer #'right(i,2,'0')' Type/4/FLYER CLIP/FLYER STILL/FRAME/SEQUENCE'
  68.             ComplexRequest  '"Visual FX  SetUp Options"' 1 Gadget 270 60
  69.             if rc ~= 0 then do
  70.                 call CloseStuff()
  71.                 exit 0
  72.                 end
  73.             else do
  74.                 IAType.i = RESULT.1
  75.                    end
  76.  
  77.             call GetALL()
  78.         end
  79.         else do
  80.             if i = 1 then DriveName = "RAM:"
  81.             else DriveName = GetPathName(PicName.i-1)
  82.             Gadget.1 = 'D/127/22/120/Layer #'right(i,2,'0')' Type/2/FRAME/SEQUENCE'
  83.             ComplexRequest  '"Visual FX  SetUp Options"' 1 Gadget 270 60
  84.             if rc ~= 0 then do
  85.                 call CloseStuff()
  86.                 exit 0
  87.                 end
  88.             else do
  89.                 IAType.i = RESULT.1+2
  90.                    end
  91.         
  92.             call GetALL()
  93.         end
  94.  
  95.         NumA = 1
  96.         NumB = 100
  97.         NumC = 50
  98.         RequestSlider '"Enter Amount To Blend Image!"' NumA NumB NumC
  99.         Blend.i = result
  100.  
  101.  
  102.         Gadget.1 = ' Select Entry Mode! '
  103.         Gadget.2 = ' ON From Start '
  104.         Gadget.3 = ' Fade In '
  105.         ListRequest 3 Gadget
  106.         InType.i = 0
  107.         if result = 2 then InType.i = 0
  108.         if result = 3 then InType.i = 1
  109.  
  110.         FadeIn.i = 0
  111.         if InType.i = 1 then do
  112.             FNum = ((End-Start)+1)%4
  113.             if FNum > 30 then FNum = 30
  114.             RequestSlider '"Enter Amount Of Frames To Fade In!"' 1 (End-Start)+1 FNum
  115.             FadeIn.i = Result
  116.             end
  117.  
  118.  
  119.         Gadget.1 = ' Select Exit Mode! '
  120.         Gadget.2 = ' ON To End '
  121.         Gadget.3 = ' Fade Out '
  122.         ListRequest 3 Gadget
  123.         OutType.i = 0
  124.         if result = 2 then OutType.i = 0
  125.         if result = 3 then OutType.i = 1
  126.  
  127.         FadeOut.i = 0
  128.         if OutType.i = 1 then do
  129.             FNum = ((End-Start)+1)%4
  130.             if FNum > 30 then FNum = 30
  131.             RequestSlider '"Enter Amount Of Frames To Fade Out!"' 1 (End-Start)+1 FNum
  132.             FadeOut.i = Result
  133.             end
  134.  
  135.  
  136.     end
  137.  
  138. call open TempFile,"VFXIFX:TempDrawer/"strip(Num),W
  139. call writeln TempFile,PicAName
  140. call writeln TempFile,Start
  141. call writeln TempFile,End
  142. call writeln TempFile,IAType
  143. call writeln TempFile,CompTotal
  144. do i = 1 to CompTotal
  145.     call writeln TempFile,PicName.i
  146.     call writeln TempFile,Start.i
  147.     call writeln TempFile,End.i
  148.     call writeln TempFile,IAType.i
  149.     call writeln TempFile,Blend.i
  150.     call writeln TempFile,InType.i
  151.     call writeln TempFile,OutType.i
  152.     call writeln TempFile,FadeIn.i
  153.     call writeln TempFile,FadeOut.i
  154.     end
  155.  
  156. call close TempFile
  157.  
  158. ActiveColor 1
  159.  
  160. if FlyOn = 1 then
  161.     call CloseStuff()
  162.  
  163.  
  164. exit
  165.  
  166.  
  167.  
  168. GetFile:
  169.     parse Arg Title, Path
  170.     Address FLY_1 SetString Path
  171.     Address FLY_1 GetFileNameNT Title
  172. return result
  173.  
  174. GetFileName: procedure  
  175.    ARG CompleteName
  176.    c = lastpos("/",CompleteName)
  177.    if c = 0 then c = lastpos(":",CompleteName)
  178.    return substr(CompleteName, c + 1)
  179.  
  180. GetPathName: procedure  
  181.    ARG CompleteName
  182.    c = lastpos("/",CompleteName)
  183.    if c = 0 then c = lastpos(":",CompleteName)
  184.    return left(CompleteName,c)
  185.  
  186.  
  187. GetA:
  188.  if IAType = 0 then do
  189.     call Switcher(TOSW)
  190.     PicAName = GetFile("Select Flyer Clip For ImageA!  ",DriveName)
  191.     Name = GetFileName(PicAName)
  192.     if Name = "" then do
  193.         Address FLY_1 OK_TEXT " OK "
  194.         Title = "You Must Enter A Valid Clip Name To Use!"
  195.         Address FLY_1 FYINT Title
  196.         Address FLY_1 Quit
  197.         call Switcher(TOWB)
  198.         exit
  199.         end
  200.     Address FLY_1 SetFileName PicAName
  201.     Address FLY_1 GetClipLength PicAName
  202.     End = result
  203.     Start = 0
  204.     Address FLY_1 Program "5"
  205.     Address FLY_1 StartNum Start
  206.     Address FLY_1 EndNum End
  207.     Address FLY_1 CurrentNum "0"
  208.     Address FLY_1 GetTimeNT "Select A Range Of Frames To Process!"
  209.     Start = word(result,1)*2
  210.     End = word(result,2)*2
  211.     Start  = Start + 1
  212.     End = End +2
  213.     call addlib('PROJECT_REXX_PORT' , 0)
  214.     call addlib(TOASTERLIB,0)
  215.     call Switcher(TOWB)
  216.     address command "C:Wait 1"
  217.     ScreenToFront
  218.     end
  219.    if IAType = 1 then do
  220.     RequestFile '"Select Flyer Still For ImageA!"' DriveName ' '
  221.     PicAName = result
  222.     Name = GetFileName(PicAName)
  223.     if Name = "" then do
  224.         Title = "You Must Enter A Valid Name To Use!"
  225.         RequestNotify Title
  226.         if FlyOn = 1 then Address FLY_1 Quit
  227.         exit
  228.         end
  229.     RequestNumber '"Enter Number Of Frames To Process!"' Frames
  230.     End = result
  231.     Start = 1
  232.     end
  233.    if IAType = 2 then do
  234.     RequestFile '"Select FileName For ImageA!"' 'SYS:' ' '
  235.     PicAName = result
  236.     Name = GetFileName(PicAName)
  237.     if Name = "" then do
  238.         Title = "You Must Enter A Valid Name To Use!"
  239.         RequestNotify Title
  240.         if FlyOn = 1 then Address FLY_1 Quit
  241.         exit
  242.         end
  243.     RequestNumber '"Enter Number Of Frames To Process!"' Frames
  244.     End = result
  245.     Start = 1
  246.     end
  247.    if IAType = 3 then do
  248.     RequestFile '"Select BaseName For ImageA! "' 'SYS:' ' '
  249.     PicAName = result
  250.     Name = GetFileName(PicAName)
  251.     if Name = "" then do
  252.         Title = "You Must Enter A Valid Name To Use!"
  253.         RequestNotify Title
  254.         if FlyOn = 1 then Address FLY_1 Quit
  255.         exit
  256.         end
  257.     RequestNumber '"Enter Number Of Frames To Process!"' Frames
  258.     End = result
  259.     Start = 1
  260.     end
  261. return
  262.  
  263.  
  264.  
  265. GetAll:
  266.  if IAType.i = 0 then do
  267.     call Switcher(TOSW)
  268.     PicName.i = GetFile("Select Flyer Clip For Image #"i+1"  ",DriveName)
  269.     Name = GetFileName(PicName.i)
  270.     if Name = "" then do
  271.         Address FLY_1 OK_TEXT " OK "
  272.         Title = "You Must Enter A Valid Clip Name To Use!"
  273.         Address FLY_1 FYINT Title
  274.         Address FLY_1 Quit
  275.         call Switcher(TOWB)
  276.         exit
  277.         end
  278.     Address FLY_1 SetFileName PicName.i
  279.     Address FLY_1 GetClipLength PicName.i
  280.     End.i = result
  281.     Start.i = 0
  282.     Address FLY_1 Program "5"
  283.     Address FLY_1 StartNum Start.i
  284.     Address FLY_1 EndNum End.i
  285.     Address FLY_1 CurrentNum "-1"
  286.     Address FLY_1 GetTimeNT "Select Frame To Start With For Image #"i+1"  "
  287.     Start.i = word(result,1)*2
  288.     End.i = word(result,2)*2
  289.     Start.i  = Start.i + 1
  290.     End.i = End.i +2
  291.  
  292.     call addlib('PROJECT_REXX_PORT' , 0)
  293.     call addlib(TOASTERLIB,0)
  294.     call Switcher(TOWB)
  295.     address command "C:Wait 1"
  296.     ScreenToFront
  297.     end
  298.    if IAType.i = 1 then do
  299.     Title = Quotes"Select Flyer Still For Image #"i+1"  "Quotes
  300.     RequestFile Title DriveName ' '
  301.     PicName.i = result
  302.     Name = GetFileName(PicName.i)
  303.     if Name = "" then do
  304.         Title = "You Must Enter A Valid Name To Use!"
  305.         RequestNotify Title
  306.         if FlyOn = 1 then Address FLY_1 Quit
  307.         exit
  308.         end
  309.     End.i = 1
  310.     Start.i = 1
  311.     end
  312.    if IAType.i = 2 then do
  313.     if i = 1 then DriveName = "SYS:"
  314.     Title = Quotes"Select FileName For Image #"i+1"  "Quotes
  315.     RequestFile Title DriveName ' '
  316.     PicName.i = result
  317.     Name = GetFileName(PicName.i)
  318.     if Name = "" then do
  319.         Title = "You Must Enter A Valid Name To Use!"
  320.         RequestNotify Title
  321.         if FlyOn = 1 then Address FLY_1 Quit
  322.         exit
  323.         end
  324.     End.i = 1
  325.     Start.i = 1
  326.     end
  327.    if IAType.i = 3 then do
  328.     if i = 1 then DriveName = "SYS:"
  329.     Title = Quotes"Select BaseName For Image #"i+1"  "Quotes
  330.     RequestFile Title DriveName ' '
  331.     PicName.i = result
  332.     Name = GetFileName(PicName.i)
  333.     if Name = "" then do
  334.         Title = "You Must Enter A Valid Name To Use!"
  335.         RequestNotify Title
  336.         if FlyOn = 1 then Address FLY_1 Quit
  337.         exit
  338.         end
  339.     RequestNumber '"Enter Number Of Frames To Process!"' (End-Start)+1
  340.     End.i = result
  341.     Start.i = 1
  342.     end
  343. return
  344.  
  345. CloseStuff:
  346.     Address FLY_1 Quit
  347.     call remlib('ToasterARexx.port')
  348.     call remlib('PROJECT_REXX_PORT')
  349. return
  350.  
  351.  
  352. OpenFlyStuff:
  353.     FlyOn = 1
  354.     address command "run VFXIFX:FLY" 
  355.     do while (POS('FLY_1',SHOW('Ports')) = 0)
  356.         address command "wait 1"
  357.         end
  358.     TOASTERLIB="ToasterARexx.port"
  359.     call remlib('ToasterARexx.port')
  360.     call remlib('PROJECT_REXX_PORT')
  361.     call addlib('PROJECT_REXX_PORT' , 0)
  362.     call addlib(TOASTERLIB,0)
  363.     DriveName = FindDrive()
  364. return
  365.  
  366.  
  367. FindDrive:
  368.     address command "C:Info >RAM:DriveList"
  369.     call open TempFile,"RAM:DriveList",R
  370.     do until eof(TempFile)
  371.         line = readln(TempFile)
  372.         parse var line Drive" "Rest
  373.         if Drive = "FA0:" then 
  374.             FlyVolume = word(Rest,7)":"
  375.     end
  376.     call close TempFile
  377.     address command "Delete >NIL: RAM:DriveList"
  378. return FlyVolume
  379.  
  380.  
  381.  
  382. LoadA:
  383.     if IAType = 0 then do
  384.         LoadBuffer PicAName Force Start
  385.         end
  386.     if IAType = 1 then do
  387.         LoadBuffer PicAName Force 1
  388.         end
  389.     if IAType = 2 then do
  390.         LoadBuffer PicAName Force
  391.         end
  392.     if IAType = 3 then do
  393.         LoadBuffer PicAName""right(Start,3,'0') Force
  394.         end
  395. return
  396.  
  397.  
  398.  
  399.  
  400. Docs:
  401.  
  402.     text1 = '"This effect takes an image, sequence, or clip then"'
  403.     text2 = '"composites as many layers of other images, sequences"'
  404.     text3 = '"or clips as you desire, on top of the base image."'
  405.     text4 = '" "'
  406.     text5 = '"It asks you for the number of frames for the base"'
  407.     text6 = '"image, then allows you to select the amount of blend"'
  408.     text7 = '"to use on each layer you add. You also have the option"'
  409.     text8 = '"to fade each layer In & Out for a user defined length."'
  410.  
  411.     Gadget.1  = 'TEXT LE=10 TE=4 LB='text1' '
  412.     Gadget.2  = 'TEXT LE=10 TE=14 LB='text2' '
  413.     Gadget.3  = 'TEXT LE=10 TE=24 LB='text3' '
  414.     Gadget.4  = 'TEXT LE=10 TE=34 LB='text4' '
  415.     Gadget.5  = 'TEXT LE=10 TE=44 LB='text5' '
  416.     Gadget.6  = 'TEXT LE=10 TE=54 LB='text6' '
  417.     Gadget.7  = 'TEXT LE=10 TE=64 LB='text7' '
  418.     Gadget.8  = 'TEXT LE=10 TE=74 LB='text8' '
  419.     Gadget.9 = 'END'
  420.     NewComplexRequest  '"Instructions For Effect #08"' Gadget 400 86
  421.  
  422.  
  423. return
  424.  
  425.  
  426.