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

  1. /*
  2.                         Control Tower Arexx Script
  3.                            Written By J.L. White
  4.                          (C)1995 Merlin's Software
  5.  
  6.    Use this script as a building block to create your own Flyer scripts!
  7.  
  8.    To write scripts to run with Control Tower use "Address CT_1" and use
  9.   "Address FLY_1" for running macros and scripts directly from the Flyer.
  10. */
  11.  
  12. signal on error
  13. signal on syntax
  14. Options Results
  15.  
  16.  
  17. Main:
  18. call OpenStuff()
  19. call Docs()
  20. call Routine()
  21. call CloseStuff()
  22. exit
  23. return
  24.  
  25.  
  26. Routine:
  27.  
  28.     call Info("You Can Have Requesters With Any Text!"," OK ")
  29.     call Info("You Can Have Requesters With\ More Than One Line Of Text"," OK ")
  30.     call Info("You Can Change The Text For The Button As Well!"," I Like This Instead ")
  31.     Address FLY_1 OpenMessageNT "You Can Have Windows With A Message That\Appear While Something Else Is Going On!"
  32.     Address command "C:wait 3"
  33.     call Info("Ok Something Happened So Now You Can Go On!"," Continue ")
  34.     Address FLY_1 CloseMessageNT
  35.  
  36.     Address FLY_1 OpenMessageNT "You Can Select Files From A Standard Amiga ASL Requester!"
  37.     Address command "C:wait 3"
  38.     Address FLY_1 CloseMessageNT
  39.     DriveName = FindDrive()
  40.     FileName = GetFile("Select Clip You Wish To Process! ",DriveName)
  41.     Address FLY_1 OK_TEXT " OK "
  42.     Address FLY_1 FYINT "You Selected "FileName"!"
  43.  
  44.     Address FLY_1 OpenMessageNT "You Can Select A Certain Path To Use!"
  45.     Address command "C:wait 3"
  46.     Address FLY_1 CloseMessageNT
  47.     FileName = GetPath("Select Path To Save Frames To! ","RAM:")
  48.     Address FLY_1 FYINT "You Selected "FileName" As Your Path!"
  49. Text="You Can Ask Yes Or No Questions!\
  50.  \
  51.  You Can Press [RETURN] For YES\
  52.   Or Press [SPACE BAR] For NO!"
  53.     Answer = YesOrNo(Text," YES "," NO ")
  54.     if Answer = 0 then Name = "NO"    
  55.     if Answer = 1 then Name = "YES"    
  56.     Address FLY_1 FYINT "You Answered "Name" To That Question!"
  57.  
  58.     Address FLY_1 OpenMessageNT "You Can Ask What Compression Mode To Use!"
  59.     Address command "C:wait 2"
  60.     Address FLY_1 CloseMessageNT
  61.     Address FLY_1 GetCompressionNT
  62.     Mode = result
  63.     if Mode = 0 then Type = "Standard Play"
  64.     if Mode = 1 then Type = "Extended Play"
  65.     if Mode = 2 then Type = "Audio Only"
  66.     if Mode = 3 then Type = "High Quality 5"
  67.     Address FLY_1 OK_TEXT " OK "
  68.     Address FLY_1 FYINT "The Mode You Selected Was "Type"!"
  69.  
  70.     Address FLY_1 OpenMessageNT "You Can Ask What Video Input To Use!"
  71.     Address command "C:wait 2"
  72.     Address FLY_1 CloseMessageNT
  73.     Address FLY_1 GetInputNT
  74.     Type = result
  75.     Address FLY_1 OK_TEXT " OK "
  76.     Address FLY_1 FYINT "You Selected Video Input #"Type
  77.  
  78.     Address FLY_1 OpenMessageNT "You Can Ask What Transition Speed To Use!"
  79.     Address command "C:wait 2"
  80.     Address FLY_1 CloseMessageNT
  81.     Address FLY_1 GetSpeedNT
  82.     Mode = result
  83.     if Mode = 1 then Type = "Slow Speed"
  84.     if Mode = 2 then Type = "Medium Speed"
  85.     if Mode = 3 then Type = "Fast Speed"
  86.     if Mode = 4 then Type = "Variable Speed"
  87.     Address FLY_1 OK_TEXT " OK "
  88.     Address FLY_1 FYINT "The Speed You Selected Was "Type"!"
  89.  
  90.     Address FLY_1 OpenMessageNT "You Can Use String Requesters!"
  91.     Address command "C:wait 2"
  92.     Address FLY_1 CloseMessageNT
  93.     Text = GetText("Enter Text To Use!","")
  94.     Address FLY_1 FYINT "You Entered "Text"!"
  95.  
  96.  
  97.     Address FLY_1 OpenMessageNT "You Can Convert TimeCode To & From Frames!"
  98.     Address command "C:wait 2"
  99.     Address FLY_1 CloseMessageNT
  100.  
  101.     Address FLY_1 SetString "00:00:00:00"
  102.     Address FLY_1 GetStringNTTC "Enter Time Code Number"
  103.     TimeCode = result
  104.     Address FLY_1 ConvertTC TimeCode
  105.     Num = result
  106.     Address FLY_1 FYINT TimeCode" = "Num" Frames"
  107.  
  108.     Address FLY_1 SetString ""
  109.     Address FLY_1 GetStringNT "Enter Number Of Frames"
  110.     Num = result
  111.     Address FLY_1 ConvertNum Num
  112.     TimeCode = result
  113.     Address FLY_1 FYINT Num" Frames = "TimeCode
  114.  
  115.     Address FLY_1 OpenMessageNT " You Can Open A Window To Wait Until \You Have Finished With Something Else"
  116.     Address command "C:wait 4"
  117.     Address FLY_1 CloseMessageNT
  118.     call Set_View(2)
  119.     call Switcher(MDV1)
  120.     call Switcher(PDV2)
  121.     Address FLY_1 WaitSW "Adjust TBAR Then Click Here To Continue!"
  122.  
  123.     Address FLY_1 OpenMessageNT "You Can Click On Buttons Through ARexx!"
  124.     Address FLY_1 ClickMouse "090|312"
  125.     Address FLY_1 ClickMouse "138|312"
  126.     Address FLY_1 ClickMouse "180|312"
  127.     Address FLY_1 ClickMouse "235|312"
  128.     Address FLY_1 ClickMouse "278|312"
  129.     Address FLY_1 CloseMessageNT
  130.  
  131.     Address FLY_1 OpenMessageNT "  You Can Even Record What Mouse & Keyboard\Options The User Selects Then Play Them Back!"
  132.     Address command "C:wait 4"
  133.     Address FLY_1 CloseMessageNT
  134.     Address FLY_1 StartRecording
  135.     Address FLY_1 WaitSW "Move Mouse Around Then Click Here To Continue!"
  136.     Address FLY_1 StopRecording
  137.     Address FLY_1 PlayRecording
  138.     Address command "Delete >NIL: RAM:FLY-Record"
  139.     call Set_View(0)
  140.  
  141. Text ="The possibilites are endless. I hope this example\
  142. has given you some ideas on how you can incorporate\
  143. these routines into your own scripts. If you come up\
  144. with something Really Cool, let us know, we would\
  145. LOVE to see what you come up with!... Enjoy"
  146.     Address FLY_1 OK_TEXT " THE END "
  147.     Address FLY_1 FYINT Text
  148. return
  149.  
  150. GetFile:
  151.     parse Arg Title, Path
  152.     Address FLY_1 SetString Path
  153.     Address FLY_1 GetFileNameNT Title
  154. return result
  155.  
  156.  
  157. GetPath:
  158.     parse Arg Title, Path
  159.     Address FLY_1 SetString Path
  160.     Address FLY_1 GetPathNameNT Title
  161. return result
  162.  
  163. GetText:
  164.     parse Arg Title, Text
  165.     Address FLY_1 SetString Text
  166.     Address FLY_1 GetStringNT Title
  167. return result
  168.  
  169.  
  170. OpenStuff:
  171.     address command "run CT:FLY" 
  172.     /* The command above has to be present to access CT commands */
  173.     do while (POS('FLY_1',SHOW('Ports')) = 0)
  174.         address command "wait 1"
  175.         end
  176.     TOASTERLIB="ToasterARexx.port"
  177.     call remlib('ToasterARexx.port')
  178.     call remlib('PROJECT_REXX_PORT')
  179.     call addlib('PROJECT_REXX_PORT' , 0)
  180.     call addlib(TOASTERLIB,0)
  181. return
  182.  
  183. CloseStuff:
  184.     Address FLY_1 Quit
  185.     /* The command above has to be present to quit the FLY program */
  186.     call remlib('ToasterARexx.port')
  187.     call remlib('PROJECT_REXX_PORT')
  188.     exit
  189. return
  190.  
  191. YesOrNo: procedure
  192.     parse Arg Title,Yes,No
  193.     Address FLY_1 OK_TEXT Yes
  194.     Address FLY_1 CANCEL_TEXT No
  195.     Address FLY_1 AskYesNoNT Title
  196.     if result = "OK" then YesNo = 1
  197.     else YesNo = 0
  198. return YesNo
  199.  
  200.  
  201. FindDrive:
  202.     address command "C:Info >RAM:FLY-List"
  203.     call open TempFile,"RAM:FLY-List",R
  204.     do until eof(TempFile)
  205.         line = readln(TempFile)
  206.         parse var line Drive" "Rest
  207.         if Drive = "FA0:" then 
  208.             Volume = word(Rest,7)":"
  209.     end
  210.     call close TempFile
  211.     address command "Delete >NIL: RAM:FLY-List"
  212. return Volume
  213.  
  214. Info: 
  215.     parse Arg Title,Yes
  216.     Address FLY_1 OK_TEXT Yes
  217.     Address FLY_1 FYINT Title
  218. return
  219.  
  220.  
  221. Docs:
  222. Text = "          Control Tower Example Routines\
  223.  \
  224. This Macro is designed to show you some of the\
  225. Built-In options that can be added to the Flyer\
  226. By Control Tower. While Newtek does include some\
  227. options that can be used through Arexx, Control\
  228. Tower gives you many more Powerful add ons that\
  229. can take advantage of both the Flyer & Arexx.\
  230.  \
  231. This window is one example of what can be done.\
  232. All our Windows & Requesters open up right on\
  233. the Flyer Screen. This sample script shows what\
  234. can be done and those of you that know how to\
  235. write ARexx programs can integrate any of these\
  236. routines into your own programs. Control Tower\
  237. doesn't need to be running to use these routines.\
  238.  \
  239. OK just hit Continue to see what options are now\
  240. at your disposal. Enjoy..."
  241.  
  242.     Address FLY_1 OK_TEXT " Continue! "
  243.     Address FLY_1 FYINT Text
  244.  
  245. return
  246.  
  247.  
  248. syntax:
  249. error:
  250.     Address FLY_1 OK_TEXT " OK "
  251.     Title = "An Error Was Found With This Macro On Line #"SIGL"!"
  252.     Address FLY_1 FYINT Title
  253.     Address FLY_1 Quit
  254. exit
  255.  
  256.