home *** CD-ROM | disk | FTP | other *** search
/ Visual FX for Image FX / VisualFX for Image FX 3.adf / Files / SetUp / 03 / 15.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1997-08-25  |  7.7 KB  |  331 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. Quote = '22'X
  12. parse arg Num Frames
  13. options results
  14. address "IMAGEFX.1"
  15.     ReDraw On
  16.     RequestResponse "Do You Need Instructions?"
  17.     if rc = 0 then do
  18.         call Docs()
  19.         end    
  20.  
  21. if exists("libs:flyer.library") then do
  22.     if (POS('PROJECT_REXX_PORT',SHOW('Ports')) =0) then do
  23.         RequestNotify 'Flyer Must Be Running First!'
  24.         exit
  25.         end
  26.     call OpenFlyStuff()
  27.  
  28.  
  29.     Gadget.1 = 'D/110/22/120/ImageA Type/4/FLYER CLIP/FLYER STILL/FRAME/SEQUENCE'
  30.     ComplexRequest  '"Visual FX  SetUp Options"' 1 Gadget 250 60
  31.     if rc ~= 0 then do
  32.         call CloseStuff()
  33.         exit 0
  34.         end
  35.     else do
  36.         IAType = RESULT.1
  37.            end
  38.  
  39.     call GetA()
  40. end
  41. else do
  42.     Gadget.1 = 'D/110/22/120/ImageA Type/2/FRAME/SEQUENCE'
  43.     ComplexRequest  '"Visual FX  SetUp Options"' 1 Gadget 250 60
  44.     if rc ~= 0 then do
  45.         call CloseStuff()
  46.         exit 0
  47.         end
  48.     else do
  49.         IAType = RESULT.1+2
  50.            end
  51.  
  52.     call GetA()
  53. end
  54.     KillBrush
  55.     i = Start
  56.     call LoadA()
  57.     GetMain
  58.     parse var result Name Width Height Blah
  59.  
  60.  
  61.     RequestSlider '"Enter Amount To Darken Image!"' 1 127 90
  62.     Answer = -Result
  63.     RequestSlider '"Enter X Radius Of SpotLight!"' 1 200 75
  64.     Answer2X = Result
  65.     RequestSlider '"Enter Y Radius Of SpotLight!"' 1 200 75
  66.     Answer2Y = Result
  67.     RequestSlider '"Enter Amount To Feather SpotLights!"' 1 50 5
  68.     Answer3 = Result
  69.     RequestSlider '"Enter Number Of SpotLights!"' 1 2 1
  70.     Answer4 = Result
  71.  
  72.     Gadget.1 = ' Select Path Options For SpotLight '
  73.     Gadget.2 = ' Draw Straight Line '
  74.     Gadget.3 = ' Draw Free Hand Line '
  75.     ListRequest 3 Gadget
  76.     PathType = 0
  77.     if result = 2 then PathType = 0
  78.     if result = 3 then PathType = 1
  79.     if PathType = 0 then call PickLine()
  80.     if PathType = 1 then call PickFreeLine()
  81.  
  82.  
  83. if FlyOn = 1 then
  84.     call CloseStuff()
  85.  
  86. call open TempFile,"VFXIFX:TempDrawer/"strip(Num),W
  87. call writeln TempFile,PicAName
  88. call writeln TempFile,Start
  89. call writeln TempFile,End
  90. call writeln TempFile,IAType
  91. call writeln TempFile,Answer
  92. call writeln TempFile,Answer2X
  93. call writeln TempFile,Answer2Y
  94. call writeln TempFile,Answer3
  95. call writeln TempFile,Answer4
  96. call writeln TempFile,PathType
  97. call writeln TempFile,AnswerMove
  98. call close TempFile
  99. exit
  100.  
  101. GetFile:
  102.     parse Arg Title, Path
  103.     Address FLY_1 SetString Path
  104.     Address FLY_1 GetFileNameNT Title
  105. return result
  106.  
  107. GetFileName: procedure  
  108.    ARG CompleteName
  109.    c = lastpos("/",CompleteName)
  110.    if c = 0 then c = lastpos(":",CompleteName)
  111.    return substr(CompleteName, c + 1)
  112.  
  113.  
  114. GetA:
  115.  if IAType = 0 then do
  116.     call Switcher(TOSW)
  117.     PicAName = GetFile("Select Flyer Clip For ImageA!  ",DriveName)
  118.     Name = GetFileName(PicAName)
  119.     if Name = "" then do
  120.         Address FLY_1 OK_TEXT " OK "
  121.         Title = "You Must Enter A Valid Clip Name To Use!"
  122.         Address FLY_1 FYINT Title
  123.         Address FLY_1 Quit
  124.         call Switcher(TOWB)
  125.         exit
  126.         end
  127.     Address FLY_1 SetFileName PicAName
  128.     Address FLY_1 GetClipLength PicAName
  129.     End = result
  130.     Start = 0
  131.     Address FLY_1 Program "5"
  132.     Address FLY_1 StartNum Start
  133.     Address FLY_1 EndNum End
  134.     Address FLY_1 CurrentNum "0"
  135.     Address FLY_1 GetTimeNT "Select A Range Of Frames To Process!"
  136.     Start = word(result,1)*2
  137.     End = word(result,2)*2
  138.     Start  = Start + 1
  139.     End = End +2
  140.     call addlib('PROJECT_REXX_PORT' , 0)
  141.     call addlib(TOASTERLIB,0)
  142.     call Switcher(TOWB)
  143.     address command "C:Wait 1"
  144.     ScreenToFront
  145.     end
  146.    if IAType = 1 then do
  147.     RequestFile '"Select Flyer Still For ImageA!"' DriveName ' '
  148.     PicAName = result
  149.     Name = GetFileName(PicAName)
  150.     if Name = "" then do
  151.         Title = "You Must Enter A Valid Name To Use!"
  152.         RequestNotify Title
  153.         if FlyOn = 1 then Address FLY_1 Quit
  154.         exit
  155.         end
  156.     RequestNumber '"Enter Number Of Frames To Process!"' Frames
  157.     End = result
  158.     Start = 1
  159.     end
  160.    if IAType = 2 then do
  161.     RequestFile '"Select FileName For ImageA!"' 'SYS:' ' '
  162.     PicAName = result
  163.     Name = GetFileName(PicAName)
  164.     if Name = "" then do
  165.         Title = "You Must Enter A Valid Name To Use!"
  166.         RequestNotify Title
  167.         if FlyOn = 1 then Address FLY_1 Quit
  168.         exit
  169.         end
  170.     RequestNumber '"Enter Number Of Frames To Process!"' Frames
  171.     End = result
  172.     Start = 1
  173.     end
  174.    if IAType = 3 then do
  175.     RequestFile '"Select BaseName For ImageA! "' 'SYS:' ' '
  176.     PicAName = result
  177.     Name = GetFileName(PicAName)
  178.     if Name = "" then do
  179.         Title = "You Must Enter A Valid Name To Use!"
  180.         RequestNotify Title
  181.         if FlyOn = 1 then Address FLY_1 Quit
  182.         exit
  183.         end
  184.     RequestNumber '"Enter Number Of Frames To Process!"' Frames
  185.     End = result
  186.     Start = 1
  187.     end
  188. return
  189.  
  190. CloseStuff:
  191.     Address FLY_1 Quit
  192.     call remlib('ToasterARexx.port')
  193.     call remlib('PROJECT_REXX_PORT')
  194. return
  195.  
  196.  
  197. OpenFlyStuff:
  198.     FlyOn = 1
  199.     address command "run VFXIFX:FLY" 
  200.     do while (POS('FLY_1',SHOW('Ports')) = 0)
  201.         address command "wait 1"
  202.         end
  203.     TOASTERLIB="ToasterARexx.port"
  204.     call remlib('ToasterARexx.port')
  205.     call remlib('PROJECT_REXX_PORT')
  206.     call addlib('PROJECT_REXX_PORT' , 0)
  207.     call addlib(TOASTERLIB,0)
  208.     DriveName = FindDrive()
  209. return
  210.  
  211.  
  212. FindDrive:
  213.     address command "C:Info >RAM:DriveList"
  214.     call open TempFile,"RAM:DriveList",R
  215.     do until eof(TempFile)
  216.         line = readln(TempFile)
  217.         parse var line Drive" "Rest
  218.         if Drive = "FA0:" then 
  219.             FlyVolume = word(Rest,7)":"
  220.     end
  221.     call close TempFile
  222.     address command "Delete >NIL: RAM:DriveList"
  223. return FlyVolume
  224.  
  225.  
  226. PickLine:
  227.     KillBrush
  228.     Menu ToolBox
  229.     DrawTool "Line"
  230.     RequestNotify "Draw Line From Point A To Point B For Movement Of SpotLight "
  231.     HidePanel
  232.     Undo On
  233.     WaitFor SELECTDOWN
  234.     parse var result X1 Y1
  235.     WaitFor SELECTUP
  236.     parse var result X2 Y2
  237.     Undo
  238.     ShowPanel
  239.     Undo Off
  240.     GetMain
  241.     parse var result Name Width Height Blah
  242.     if X1 < 10 then X1 = -50
  243.     if Y1 < 10 then Y1 = -10
  244.     if X2 > (Width-10) then X2 = Width+100
  245.     if Y2 > (Height-10) then Y2 = Width+10
  246.     X1 = strip(X1)
  247.     Y1 = strip(Y1)
  248.     X2 = strip(X2)
  249.     Y2 = strip(Y2)
  250.     AnswerMove = X1" "Y1" "X2" "Y2
  251.     RequestResponse "Is The Line You Have Drawn Correct?"
  252.     if rc ~= 0 then call PickLine()
  253.  
  254. return
  255.  
  256. PickFreeLine:
  257.     KillBrush
  258.     Menu ToolBox
  259.     DrawTool "FreeDraw"
  260.     RequestNotify "Draw Line For Movement Of SpotLight "
  261.     HidePanel
  262.     Undo On
  263.     WaitFor SELECTDOWN
  264.     Learn "RAM:FreeDraw" NoHeader Quiet Force
  265.     WaitFor SELECTUP
  266.     Learn Stop Quiet Force
  267.     Undo
  268.     ShowPanel
  269.     Undo Off
  270.     RequestResponse "Is The Line You Have Drawn Correct?"
  271.     if rc ~= 0 then call PickFreeLine()
  272.     CountNum = 0
  273.     call open TempFile,"Ram:FreeDraw.ifx",R
  274.     call open TempFile2,"VFXIFX:TempDrawer/DrawNum."left(Num,2,''),W
  275.     line = readln(TempFile)
  276.     line = readln(TempFile)
  277.     line = readln(TempFile)
  278.     line = readln(TempFile)
  279.     line = readln(TempFile)
  280.     line = readln(TempFile)
  281.     do until eof(TempFile)
  282.         DoIt = readln(TempFile)
  283.         if DoIt = "FreeDraw" then leave
  284.         parse var DoIt Name" "Nums
  285.         call writeln TempFile2,Nums
  286.         CountNum = CountNum + 1
  287.         end
  288.     call close TempFile
  289.     call close TempFile2
  290.     AnswerMove = right(CountNum,3,'0')
  291.     address command "Delete >NIL: RAM:FreeDraw.ifx"
  292. return
  293.  
  294. LoadA:
  295.     if IAType = 0 then do
  296.         LoadBuffer PicAName Force i
  297.         end
  298.     if IAType = 1 then do
  299.         LoadBuffer PicAName Force 1
  300.         end
  301.     if IAType = 2 then do
  302.         LoadBuffer PicAName Force
  303.         end
  304.     if IAType = 3 then do
  305.         LoadBuffer PicAName""right(i,3,'0') Force
  306.         end
  307. return
  308.  
  309.  
  310. Docs:
  311.  
  312.     text1 = '"This effect will create moving Spotlights on top of"'
  313.     text2 = '"the image. It first darkens the images then shows"'
  314.     text3 = '"a moving lighter section. If you choose 2 Lights, it"'
  315.     text4 = '"will mirror the first on the screen. You have the"'
  316.     text5 = '"option to move the light from point A to point B, or"'
  317.     text6 = '"to draw your own path for the lights to follow."'
  318.  
  319.     Gadget.1  = 'TEXT LE=10 TE=4 LB='text1' '
  320.     Gadget.2  = 'TEXT LE=10 TE=14 LB='text2' '
  321.     Gadget.3  = 'TEXT LE=10 TE=24 LB='text3' '
  322.     Gadget.4  = 'TEXT LE=10 TE=34 LB='text4' '
  323.     Gadget.5  = 'TEXT LE=10 TE=44 LB='text5' '
  324.     Gadget.6  = 'TEXT LE=10 TE=54 LB='text6' '
  325.     Gadget.7= 'END'
  326.     NewComplexRequest  '"Instructions For Effect #15"' Gadget 386 66
  327.  
  328. return
  329.  
  330.  
  331.