home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 April / macformat-023.iso / Shareware City / Applications / bbedit-send-script-111 / send-script-111 / Send Script Documentation next >
Encoding:
Text File  |  1994-11-29  |  7.3 KB  |  184 lines  |  [TEXT/R*ch]

  1. Send Script Version 1.1.1 -- Extension for BBEdit 2.2 or Later
  2. ==============================================================
  3.  
  4. • Legal Stuff
  5.  
  6. Copyright © 1993-4 Ed Watkeys (edw@distant.com) This software may be
  7. copied freely, provided that the documentation (this file) is retained,
  8. and that you do not profit monetarily from its further distribution. It
  9. may, however, be distributed by bulletin board systems and on-line
  10. information services. If you would like to distribute Send Script in
  11. any sort of software collection, you must contact me and get my
  12. permission before doing so.
  13.  
  14. You are under no legal or moral obligation to pay anything for this
  15. software, however, I'm not going to stop you if you want to. Comments and
  16. suggestions, however, are encouraged.
  17.  
  18. I've stopped distributing the source code along with the extension, as I
  19. imagine most people don't really care about it. If you would like the
  20. source code, simply send me a message. By the way, I wrote Send Script
  21. in THINK C 5.0 originally, but but it has since been compiled with
  22. CodeWarrior. It is not "Accellerated for Power Macintosh" because
  23. there's not point in doing so.
  24.  
  25. While I'm on the subject of CodeWarrior, check out the Official
  26. CodeWarrior FAQ Answer Sheet available at:
  27.  
  28.     http://distant.com/Docs/CodeWarrior/FAQ.html
  29.     
  30. For the WWW-impaired, the FAQ is also available via FTP on distant.com
  31. in the /Public folder.
  32.  
  33. Edwin H. Watkeys III
  34. 3509 Baring Street Apt 1E
  35. Philadelphia, PA 19104
  36.  
  37. • Instructions
  38.  
  39. Send Script simply allows you to use BBEdit to write and send scripts to
  40. other programs via the do-script Apple event. Examples of programs
  41. which accept scripts are FileMaker Pro, UserLand Frontier, StuffIt
  42. Deluxe, the Alpha text editor, Tim Endre's TCL implementation for the
  43. Macintosh, tickle, and of course, HyperCard 2.1. Note: you will have
  44. problems sending scripts to Alpha and StuffIt Deluxe unless you have
  45. versions 5.3 and 3.0.5, respectively.
  46.  
  47. Before you send a script, you'll need a script to send. All of the
  48. examples I give will be for UserLand Frontier -- that's what I used for
  49. testing.
  50.  
  51. If you select "Send Script…" without a selection, Send Script will
  52. assume you want the entire current document sent. Otherwise, Send
  53. Script will send only the text you have selected.
  54.  
  55. Tip: Make sure you press the return key after the end of yor script, and
  56. select the return character, too. Results are inserted immediately
  57. after the script, and will be begin on the same line as your script if
  58. you don't make a carriage return the last character in your script.
  59.  
  60. Here's a sample UserLand Frontier script:
  61.  
  62. message = "This is a test" + char(13);
  63. message = message + "of Send Script." + char(13);
  64. return(message);
  65.  
  66. Select it, and choose "Send Script…" from the Extensions menu. You will
  67. be confronted with a dialog box. Here's a list of the items, along with
  68. their purposes:
  69.  
  70. 1. "Select Target…" -- click here to bring up a browser which allows you
  71.    select which application will receive your script. Your selection is
  72.    saved in Send Script's preferences, so that you don't need to change
  73.    do this except when you want to change your target.
  74.  
  75. 2. "Put Results in New Document" -- check this if you want the results of
  76.    your script to appear in a new document. Otherwise, they will appear
  77.    immediately after the script you selected. This item's default state is
  78.    determined by wether or not you selected anything in the current
  79.    document -- if you did, Send Script will by default insert the results
  80.    in the original document. If you didn't, it'll will by default put the
  81.    results in a new document. Because of this, your selection is not saved
  82.    in Send Script's preferences.
  83.  
  84. 3. "Timeout" -- these radio buttons allow you to tell Send Script how long
  85.    to wait for a reply to your script. If the timeout runs out, it'll stop
  86.    waiting for a reply and will exit. The default timeout is about a
  87.    minute.  A reason to change this is if your script requires user
  88.    interaction, and you don't know how long it will take for the user to
  89.    make his/her decision. I'm not sure what you'd want no timeout for, but
  90.    put it there for the sake of completeness. This option is saved in Send
  91.    Script's preferences.
  92.  
  93. 4. "OK" and "Cancel" -- click on "Cancel" and we'll forget any of this
  94.    ever happened. Click on "OK", and Send Script will go ahead and send
  95.    your script. The watch cursor comes up, and you will wait, unless you
  96.    press command-period to cancel the script, in which case you return to
  97.    BBEdit. The "OK" button will be unavailable if there is no currently
  98.    selected target. Just because the "OK" button is available, it doesn't
  99.    mean you have a valid target, so unless you know what it is, it might
  100.    be a good idea to check. In practice, the only times that "OK" will be
  101.    unavailable is the first time you run Send Script with a new copy of
  102.    BBEdit, or if you throw away the BBEdit Preferences file.
  103.  
  104. The above descriptions should give you a pretty good idea of how to use
  105. Send Script.
  106.  
  107. • Notes for Frontier Users
  108.  
  109. If you execute the following script from BBEdit:
  110.  
  111. msg("Have a nice day.");
  112.  
  113. You will find that it returns "true". It'll put a message in Frontier's
  114. message window, but that might not be what you were thinking of. If you
  115. want to turn BBEdit into your "standard out", you're going to need to
  116. do something else. I suggest you create an item in the object database
  117. called "stdout" and write your scripts like this:
  118.  
  119. on WriteLn(message)
  120. {
  121.     people.edw.stdout = people.edw.stdout + string(message) + char(13);
  122. };
  123.  
  124. on Write(message)
  125. {
  126.     people.edw.stdout = people.edw.stdout + string(message);
  127. };
  128.  
  129. on InitStdout()
  130. {
  131.     people.edw.stdout = "";
  132. };
  133.  
  134. InitStdout();
  135. WriteLn("Hello, my name is Ed.");
  136. WriteLn("What is your name?");
  137. return(people.edw.stdout);
  138.  
  139. The above example will return the following:
  140.  
  141. Hello, my name is Ed.
  142. What is your name?
  143.  
  144. So, you see, there isn't a lot to it. Don't forget to put your own
  145. "initials" where "edw" is. This isn't the only way to do it, it's just
  146. one that I usually use because it makes using Frontier scripts more
  147. natural from BBEdit. You can put the above routines in your own "home"
  148. table if you wish -- I just did it this way to show you how I do it.
  149.  
  150. Keep in mind that I wrote all of the above stuff almost two years ago,
  151. and haven't touched Frontier since, so I have no idea what I was
  152. talking about.
  153.  
  154. • Misc. Stuff
  155.  
  156. I hope you enjoy Send Script. If you have found any novel uses for it or
  157. you hate something about it that you'd like me to change, feel free to
  158. tell me.
  159.  
  160. I'm not really sure about what you can actually use Send Script for. I
  161. wrote it because I thought it was a cool idea, not because I had a use
  162. for it. When you think about it, using BBEdit to send scripts to
  163. Frontier makes little if any sense! Additionally, with the advent of
  164. AppleScript, who wants to use an application-specific scripting language
  165. anymore?
  166.  
  167. Let me know if there are any other BBEdit Extensions you'd like to see
  168. -- I'll consider writing any which aren't insanely boring. Don't know
  169. what I'd call boring, so I you'll have to ask me about anything you
  170. have in mind.
  171.  
  172. • Changes Since Version 1.0
  173.  
  174. 1.1.1:  Messed around with stuff to make Send Script compile with Code
  175.             Warrior.
  176.         Updated Documentation.
  177.         Fixed problem with confusing a resource handle with a plain
  178.             old handle.
  179.  
  180. 1.0.1:    Fixed all known bugs in 1.0.
  181.         Changed documentation a bit.
  182.         Send Script won't get upset if there is neither a direct object
  183.             nor an error string in the reply Apple event.
  184.