home *** CD-ROM | disk | FTP | other *** search
/ Visual FX for Image FX / VisualFX for Image FX 3.adf / Files / SetUp / 03 / 02.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1997-09-10  |  9.6 KB  |  418 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.     Color = 1
  60.     Border = 0
  61.  
  62.  
  63.     Gadget.1 = ' Select Border Options! '
  64.     Gadget.2 = ' No Border '
  65.     Gadget.3 = ' Solid Border Color '
  66.     Gadget.4 = ' Beveled Scrolling Image '
  67.     Gadget.5 = ' Beveled Picture Edge '
  68.     ListRequest 5 Gadget
  69.     BorderType = -1
  70.     if result = 2 then BorderType = -1
  71.     if result = 3 then BorderType = 0
  72.     if result = 4 then BorderType = 1
  73.     if result = 5 then BorderType = 2
  74.  
  75.     XOff = 0
  76.     YOff = 0
  77.  
  78.     if BorderType = 0 then do
  79.         ActiveColor 0
  80.         RequestNotify "Click On Color To Use For Border Then Click "Quotes"Okay"Quotes""
  81.         ActiveColor
  82.         Color = result
  83.         ActiveColor 1
  84.         NumA = 0
  85.         NumB = 20
  86.         NumC = 7
  87.         RequestSlider '"Enter Thickness Of Border!"' NumA NumB NumC
  88.         Border = Result
  89.         end
  90.  
  91.     if BorderType = 1 then do
  92.         LoadBuffer "VFXIFX:Images/Pics/Seamless.Pic" Force
  93.         RequestNotify "Look At Examples For FileName Then Click "Quotes"Okay"Quotes""
  94.         RequestFile '"Select File To Use For Border!" "VFXIFX:Images/Seamless" ""'
  95.         BrushName = result
  96.         NumA = 0
  97.         NumB = 20
  98.         NumC = 10
  99.         RequestSlider '"Enter Thickness Of Border!"' NumA NumB NumC
  100.         Border = Result
  101.  
  102.         text1 = '"Move X"'
  103.         text2 = '"Move Y"'
  104.         Gadget.1  = 'SLIDER LE=60 TE=4 WD=150 HT=14 LB='text1' IN=1 LO=-10 HI=10 LV=%-3ld'
  105.         Gadget.2  = 'SLIDER LE=60 TE=22 WD=150 HT=14 LB='text2' IN=1 LO=-10 HI=10 LV=%-3ld'
  106.         Gadget.3 = 'END'
  107.         NewComplexRequest  '"Select X & Y Movements!"' Gadget 250 42
  108.         if rc ~= 0 then do
  109.             XOff = 0
  110.             YOff = 0
  111.             end
  112.         else do
  113.             XOff = RESULT.1
  114.             YOff = RESULT.2
  115.             end
  116.         end
  117.  
  118.     if BorderType = 2 then do
  119.         NumA = 1
  120.         NumB = 30
  121.         NumC = 10
  122.         RequestSlider '"Enter Thickness Of Bevel!"' NumA NumB NumC
  123.         Border = Result
  124.         end
  125.  
  126.     Gadget.1 = 'Select Shadow Options!'
  127.     Gadget.2 = 'Use Soft Edge Shadow'
  128.     Gadget.3 = 'Use Regular Shadow'
  129.     Gadget.4 = 'Use No Shadow'
  130.     ListRequest 4 Gadget
  131.     ShadowType = 0
  132.     if result = 2 then ShadowType = 0
  133.     if result = 3 then ShadowType = 1
  134.     if result = 4 then ShadowType = 2
  135.  
  136.     Gadget.1 = 'Select Operator For Background!'
  137.     Gadget.2 = 'Grey Scale'
  138.     Gadget.3 = 'Emboss'
  139.     Gadget.4 = 'Antique'
  140.     Gadget.5 = 'Solarize'
  141.     Gadget.6 = 'Negative'
  142.     Gadget.7 = 'Posterize'
  143.     Gadget.8 = 'False Color'
  144.     Gadget.9 = 'Lighten'
  145.     Gadget.10 = 'Darken'
  146.     Gadget.11 = 'Normal'
  147.     ListRequest 11 Gadget
  148.     Type2 = 0
  149.     if result = 2 then Type2 = 0
  150.     if result = 3 then Type2 = 1
  151.     if result = 4 then Type2 = 2
  152.     if result = 5 then Type2 = 3
  153.     if result = 6 then Type2 = 4
  154.     if result = 7 then Type2 = 5
  155.     if result = 8 then Type2 = 6
  156.     if result = 9 then Type2 = 7
  157.     if result = 10 then Type2 = 8
  158.     if result = 11 then Type2 = 9
  159.  
  160.     Gadget.1 = 'Select Picture Options!'
  161.     Gadget.2 = 'Use Standard Size'
  162.     Gadget.3 = 'User Defined Size'
  163.     ListRequest 3 Gadget
  164.     WindowType = -1
  165.     if result = 2 then WindowType = -1
  166.     if result = 3 then do
  167.         call LoadA()
  168.         call PickBox()
  169.         end
  170.  
  171.     CropAnswer = "None"
  172.     RequestResponse "Does Image Need To Be Cropped?"
  173.     if rc = 0 then do
  174.         if WindowType = -1 then call LoadA()
  175.         call CropPic()
  176.         end    
  177.  
  178. call open TempFile,"VFXIFX:TempDrawer/"strip(Num),W
  179. call writeln TempFile,PicAName
  180. call writeln TempFile,Start
  181. call writeln TempFile,End
  182. call writeln TempFile,IAType
  183. call writeln TempFile,Color
  184. call writeln TempFile,BorderType
  185. call writeln TempFile,Border
  186. call writeln TempFile,ShadowType
  187. call writeln TempFile,Type2
  188. call writeln TempFile,WindowType
  189. call writeln TempFile,CropAnswer
  190. call writeln TempFile,BrushName
  191. call writeln TempFile,XOff
  192. call writeln TempFile,YOff
  193. call close TempFile
  194. exit
  195.  
  196.  
  197.  
  198. CropPic:
  199.     Learn "RAM:VFX" NoHeader Quiet Force
  200.     Crop
  201.     Learn Stop Quiet Force
  202.  
  203.     call open TempFile,"RAM:VFX.ifx",R
  204.     do until eof(TempFile)
  205.         line = readln(TempFile)
  206.         parse var line StartLine" "RestOfLine
  207.         if StartLine = "Crop" then CropAnswer = line
  208.         end
  209.     call close TempFile
  210.     address command "Delete >NIL: Ram:VFX.ifx"
  211.  
  212. return
  213.  
  214. GetFile:
  215.     parse Arg Title, Path
  216.     Address FLY_1 SetString Path
  217.     Address FLY_1 GetFileNameNT Title
  218. return result
  219.  
  220. GetFileName: procedure  
  221.    ARG CompleteName
  222.    c = lastpos("/",CompleteName)
  223.    if c = 0 then c = lastpos(":",CompleteName)
  224.    return substr(CompleteName, c + 1)
  225.  
  226.  
  227. GetA:
  228.  if IAType = 0 then do
  229.     call Switcher(TOSW)
  230.     PicAName = GetFile("Select Flyer Clip For ImageA!  ",DriveName)
  231.     Name = GetFileName(PicAName)
  232.     if Name = "" then do
  233.         Address FLY_1 OK_TEXT " OK "
  234.         Title = "You Must Enter A Valid Clip Name To Use!"
  235.         Address FLY_1 FYINT Title
  236.         Address FLY_1 Quit
  237.         call Switcher(TOWB)
  238.         exit
  239.         end
  240.     Address FLY_1 SetFileName PicAName
  241.     Address FLY_1 GetClipLength PicAName
  242.     End = result
  243.     Start = 0
  244.     Address FLY_1 Program "5"
  245.     Address FLY_1 StartNum Start
  246.     Address FLY_1 EndNum End
  247.     Address FLY_1 CurrentNum "0"
  248.     Address FLY_1 GetTimeNT "Select A Range Of Frames To Process!"
  249.     Start = word(result,1)*2
  250.     End = word(result,2)*2
  251.     Start  = Start + 1
  252.     End = End +2
  253.     call addlib('PROJECT_REXX_PORT' , 0)
  254.     call addlib(TOASTERLIB,0)
  255.     call Switcher(TOWB)
  256.     address command "C:Wait 1"
  257.     ScreenToFront
  258.     end
  259.    if IAType = 1 then do
  260.     RequestFile '"Select Flyer Still For ImageA!"' DriveName ' '
  261.     PicAName = result
  262.     Name = GetFileName(PicAName)
  263.     if Name = "" then do
  264.         Title = "You Must Enter A Valid Name To Use!"
  265.         RequestNotify Title
  266.         if FlyOn = 1 then Address FLY_1 Quit
  267.         exit
  268.         end
  269.     RequestNumber '"Enter Number Of Frames To Process!"' Frames
  270.     End = result
  271.     Start = 1
  272.     end
  273.    if IAType = 2 then do
  274.     RequestFile '"Select FileName For ImageA!"' 'SYS:' ' '
  275.     PicAName = result
  276.     Name = GetFileName(PicAName)
  277.     if Name = "" then do
  278.         Title = "You Must Enter A Valid Name To Use!"
  279.         RequestNotify Title
  280.         if FlyOn = 1 then Address FLY_1 Quit
  281.         exit
  282.         end
  283.     RequestNumber '"Enter Number Of Frames To Process!"' Frames
  284.     End = result
  285.     Start = 1
  286.     end
  287.    if IAType = 3 then do
  288.     RequestFile '"Select BaseName For ImageA! "' 'SYS:' ' '
  289.     PicAName = result
  290.     Name = GetFileName(PicAName)
  291.     if Name = "" then do
  292.         Title = "You Must Enter A Valid Name To Use!"
  293.         RequestNotify Title
  294.         if FlyOn = 1 then Address FLY_1 Quit
  295.         exit
  296.         end
  297.     RequestNumber '"Enter Number Of Frames To Process!"' Frames
  298.     End = result
  299.     Start = 1
  300.     end
  301. return
  302.  
  303. CloseStuff:
  304.     Address FLY_1 Quit
  305.     call remlib('ToasterARexx.port')
  306.     call remlib('PROJECT_REXX_PORT')
  307. return
  308.  
  309.  
  310. OpenFlyStuff:
  311.     FlyOn = 1
  312.     address command "run VFXIFX:FLY" 
  313.     do while (POS('FLY_1',SHOW('Ports')) = 0)
  314.         address command "wait 1"
  315.         end
  316.     TOASTERLIB="ToasterARexx.port"
  317.     call remlib('ToasterARexx.port')
  318.     call remlib('PROJECT_REXX_PORT')
  319.     call addlib('PROJECT_REXX_PORT' , 0)
  320.     call addlib(TOASTERLIB,0)
  321.     DriveName = FindDrive()
  322. return
  323.  
  324.  
  325. FindDrive:
  326.     address command "C:Info >RAM:DriveList"
  327.     call open TempFile,"RAM:DriveList",R
  328.     do until eof(TempFile)
  329.         line = readln(TempFile)
  330.         parse var line Drive" "Rest
  331.         if Drive = "FA0:" then 
  332.             FlyVolume = word(Rest,7)":"
  333.     end
  334.     call close TempFile
  335.     address command "Delete >NIL: RAM:DriveList"
  336. return FlyVolume
  337.  
  338.  
  339.  
  340. LoadA:
  341.     if IAType = 0 then do
  342.         LoadBuffer PicAName Force Start
  343.         end
  344.     if IAType = 1 then do
  345.         LoadBuffer PicAName Force 1
  346.         end
  347.     if IAType = 2 then do
  348.         LoadBuffer PicAName Force
  349.         end
  350.     if IAType = 3 then do
  351.         LoadBuffer PicAName""right(Start,3,'0') Force
  352.         end
  353. return
  354.  
  355. PickBox:
  356.     KillBrush
  357.     GetMain
  358.     parse var result Name Width Height Blah
  359.     if Width = 0 || Height = 0 then do
  360.         WindowType = -1
  361.         return
  362.         end
  363.     Menu ToolBox
  364.     RequestNotify "Draw Rectangle Where You Want New Image Placed!"
  365.     DrawTool Box
  366.     HidePanel
  367.     Undo On
  368.     WaitFor SELECTDOWN
  369.     parse var result X1 Y1
  370.     WaitFor SELECTUP
  371.     parse var result X2 Y2
  372.     Undo
  373.     ShowPanel
  374.     Undo Off
  375.     X1 = strip(X1)
  376.     Y1 = strip(Y1)
  377.     X2 = strip(X2)-X1
  378.     Y2 = strip(Y2)-Y1
  379.     RequestResponse "Is The Box You Selected Correct?"
  380.     if rc ~= 0 then call PickBox()
  381.  
  382.     WindowType = X1" "Y1" "X2" "Y2
  383.  
  384. return
  385.  
  386.  
  387.  
  388.  
  389. Docs:
  390.  
  391.     text1 = '"This effect takes an image and places a copy of itself"'
  392.     text2 = '"in the middle of the screen. You can change the way the"'
  393.     text3 = '"background image looks and add a border to the center"'
  394.     text4 = '"image."'
  395.     text5 = '" "'
  396.     text6 = '"The Crop Image option is there for Flyer Users. The clip"'
  397.     text7 = '"may have garbage on the edges, that are not seen because"'
  398.     text8 = '"of overscan but when scaled to the center, you can see it."'
  399.     text9 = '"This allows you to crop the garbage first, then it will"'
  400.     text10 = '"scale it back to the correct size."'
  401.  
  402.     Gadget.1  = 'TEXT LE=10 TE=4 LB='text1' '
  403.     Gadget.2  = 'TEXT LE=10 TE=14 LB='text2' '
  404.     Gadget.3  = 'TEXT LE=10 TE=24 LB='text3' '
  405.     Gadget.4  = 'TEXT LE=10 TE=34 LB='text4' '
  406.     Gadget.5  = 'TEXT LE=10 TE=44 LB='text5' '
  407.     Gadget.6  = 'TEXT LE=10 TE=54 LB='text6' '
  408.     Gadget.7  = 'TEXT LE=10 TE=64 LB='text7' '
  409.     Gadget.8  = 'TEXT LE=10 TE=74 LB='text8' '
  410.     Gadget.9  = 'TEXT LE=10 TE=84 LB='text9' '
  411.     Gadget.10  = 'TEXT LE=10 TE=94 LB='text10' '
  412.     Gadget.11 = 'END'
  413.     NewComplexRequest  '"Instructions For Effect #02"' Gadget 420 106
  414.  
  415. return
  416.  
  417.  
  418.