home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Misc / EDG-CT1.DMS / in.adf / CT.run / Macros / Add_ImageFX_To_Flyer.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1995-10-09  |  5.1 KB  |  195 lines

  1. /*
  2.                         Control Tower Arexx Script
  3.                            Written By J.L. White
  4.                          (C)1995 Merlin's Software
  5. */
  6.  
  7. signal on error
  8. signal on syntax
  9. Options Results
  10.  
  11. Quotes = '22'X
  12. SingleQ = '27'X
  13.  
  14. Main:
  15. call OpenStuff()
  16. call Docs()
  17. call Routine()
  18. call CloseStuff()
  19. exit
  20. return
  21.  
  22. GetFile:
  23.     parse Arg Title, Path
  24.     Address FLY_1 SetString Path
  25.     Address FLY_1 GetFileNameNT Title
  26. return result
  27.  
  28.  
  29. GetPath:
  30.     parse Arg Title, Path
  31.     Address FLY_1 SetString Path
  32.     Address FLY_1 GetPathNameNT Title
  33. return result
  34.  
  35. GetText:
  36.     parse Arg Title, Text
  37.     Address FLY_1 SetString Text
  38.     Address FLY_1 GetStringNT Title
  39. return result
  40.  
  41.  
  42. OpenStuff:
  43.     address command "run CT:FLY"
  44.     do while (POS('FLY_1',SHOW('Ports')) = 0)
  45.         address command "wait 1"
  46.         end
  47.     TOASTERLIB="ToasterARexx.port"
  48.     call remlib('ToasterARexx.port')
  49.     call remlib('PROJECT_REXX_PORT')
  50.     call addlib('PROJECT_REXX_PORT' , 0)
  51.     call addlib(TOASTERLIB,0)
  52. return
  53.  
  54. CloseStuff:
  55.     Address FLY_1 Quit
  56.     call remlib('ToasterARexx.port')
  57.     call remlib('PROJECT_REXX_PORT')
  58.     exit
  59. return
  60.  
  61. YesOrNo: procedure
  62.     parse Arg Title,Yes,No
  63.     Address FLY_1 OK_TEXT Yes
  64.     Address FLY_1 CANCEL_TEXT No
  65.     Address FLY_1 AskYesNoNT Title
  66.     if result = "OK" then YesNo = 1
  67.     else YesNo = 0
  68. return YesNo
  69.  
  70. Info: 
  71.     parse Arg Title,Yes
  72.     Address FLY_1 OK_TEXT Yes
  73.     Address FLY_1 FYINT Title
  74. return
  75.  
  76. FindDrive:
  77.     address command "C:Info >RAM:FLY-List"
  78.     call open TempFile,"RAM:FLY-List",R
  79.     do until eof(TempFile)
  80.         line = readln(TempFile)
  81.         parse var line Drive" "Rest
  82.         if Drive = "FA0:" then 
  83.             Volume = word(Rest,7)":"
  84.     end
  85.     call close TempFile
  86.     address command "Delete >NIL: RAM:FLY-List"
  87. return Volume
  88.  
  89. GetFileName: procedure  
  90.    ARG CompleteName
  91.    c = lastpos("/",CompleteName)
  92.    if c = 0 then c = lastpos(":",CompleteName)
  93.    return substr(CompleteName, c + 1)
  94.  
  95.  
  96. GetPathName: procedure  
  97.    ARG CompleteName
  98.    c = lastpos(":",CompleteName)
  99.    if c = 0 then c = lastpos(":",CompleteName)
  100.    return left(CompleteName,c)
  101.  
  102. Docs:
  103. Answer = YesOrNo(" Do You Need Instructions?"," YES "," NO ")
  104. if Answer = 0 then return 
  105. Text = "This Macro will automatically add\
  106. Image FX to the Flyer Program Menu.\
  107. You have the option to do it just\
  108. for now or to come up each time you\
  109. boot the Flyer Software."
  110. Address FLY_1 OK_TEXT " Continue! "
  111. Address FLY_1 FYINT Text
  112.  
  113. return
  114.  
  115.  
  116. Routine:
  117.     Type = YesOrNo("Add Image FX Now Or Always?"," NOW ","ALWAYS!")
  118.     call CreateAdd()
  119.     if Type = 0 then do
  120.         call CreateAlways()
  121.         end
  122.  
  123. return
  124.  
  125.  
  126. CreateAdd:
  127.     Name = "ImageFX"
  128.     InFile = "ImageFX:ImageFX"
  129.     TOASTERLIB="ToasterARexx.port"
  130.     call remlib('ToasterARexx.port')
  131.     call remlib('PROJECT_REXX_PORT')
  132.     call addlib('PROJECT_REXX_PORT' , 0)
  133.     call addlib(TOASTERLIB,0)
  134.     call Addprogram(Name,"run SYS:rexxc/rx CT:Scripts2/4/"Name,0)
  135.  
  136.     call open TempFile,"CT:Scripts2/4/"Name,W
  137.     call writeln TempFile,"/* */"
  138.     call writeln TempFile,"options results"
  139.     call writeln TempFile,"TOASTERLIB="Quotes"ToasterARexx.port"Quotes
  140.     call writeln TempFile,"call remlib("SingleQ"ToasterARexx.port"SingleQ")"
  141.     call writeln TempFile,"call remlib("SingleQ"PROJECT_REXX_PORT"SingleQ")"
  142.     call writeln TempFile,"call addlib("SingleQ"PROJECT_REXX_PORT"SingleQ" , 0)"
  143.     call writeln TempFile,"call addlib(TOASTERLIB,0)"
  144.     call writeln TempFile,"call Switcher(TOWB)"
  145.     call writeln TempFile,"call remlib("SingleQ"ToasterARexx.port"SingleQ")"
  146.     call writeln TempFile,"call remlib("SingleQ"PROJECT_REXX_PORT"SingleQ")"
  147.     call writeln TempFile,"if (POS("SingleQ"IMAGEFX.1"SingleQ",SHOW("SingleQ"Ports"SingleQ")) = 0)"
  148.     call writeln TempFile,"then do"
  149.     call writeln TempFile,"     Address Command "Quotes"run >NIL: "InFile""Quotes
  150.     call writeln TempFile,"end"
  151.     call writeln TempFile,"else do"
  152.     call writeln TempFile,"     address "Quotes"IMAGEFX.1"Quotes
  153.     call writeln TempFile,"     ScreenToFront"
  154.     call writeln TempFile,"end"
  155.     call writeln TempFile,"exit"
  156.     call close TempFile
  157.  
  158. return
  159.  
  160. CreateAlways:
  161.     parse Arg Program
  162.     Name = GetFileName(InFile)
  163.     call open TempFile,"CT:Scripts2/4/"Name".Load",W
  164.     call writeln TempFile,"/* */"
  165.     call writeln TempFile,"options results"
  166.  
  167.     call writeln TempFile,"do while (POS("SingleQ"PROJECT_REXX_PORT"SingleQ",SHOW("SingleQ"Ports"SingleQ")) = 0)"
  168.     call writeln TempFile,"Address command "Quotes"C:Wait 3"Quotes
  169.     call writeln TempFile,"end"
  170.  
  171.     call writeln TempFile,"TOASTERLIB="Quotes"ToasterARexx.port"Quotes
  172.     call writeln TempFile,"call remlib("SingleQ"ToasterARexx.port"SingleQ")"
  173.     call writeln TempFile,"call remlib("SingleQ"PROJECT_REXX_PORT"SingleQ")"
  174.     call writeln TempFile,"call addlib("SingleQ"PROJECT_REXX_PORT"SingleQ" , 0)"
  175.     call writeln TempFile,"call addlib(TOASTERLIB,0)"
  176.     call writeln TempFile,"call AddProgram("Quotes""Name""Quotes","Quotes"run SYS:rexxc/rx CT:Scripts2/4/"Name""Quotes",0)"
  177.     call writeln TempFile,"call remlib("SingleQ"ToasterARexx.port"SingleQ")"
  178.     call writeln TempFile,"call remlib("SingleQ"PROJECT_REXX_PORT"SingleQ")"
  179.     call writeln TempFile,"exit"
  180.     call close TempFile
  181.  
  182.     call open TempFile,"Toaster:Programs/StartToaster",A
  183.     call writeln TempFile,"rx >NIL: CT:Scripts2/4/"Name".Load"
  184.     call close TempFile
  185.  
  186. return
  187.  
  188. syntax:
  189. error:
  190.     Address FLY_1 OK_TEXT " OK "
  191.     Title = "An Error Was Found With This Macro On Line #"SIGL"!"
  192.     Address FLY_1 FYINT Title
  193.     Address FLY_1 Quit
  194. exit
  195.