home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / WordProcessors / DAT-WW5C.DMS / in.adf / Archive / WwRexx.lha / Web_Page_Creator < prev   
Encoding:
Text File  |  1996-02-09  |  10.1 KB  |  462 lines

  1. /*    Web_Page_Creator
  2.  
  3.         Digita Wizard Script for Wordworth 5
  4.         Copyright ©1996, Digita International Ltd.
  5.         
  6.         Created: 19 January 1996
  7.         Author:  Mark Jackson, DP
  8. */
  9.  
  10.  
  11. OPTIONS failat 100
  12. OPTIONS RESULTS
  13.  
  14. /* Text variables */
  15. TheTitle = ""
  16.  
  17. Heading = ""
  18. SubHeading = ""
  19. LineAfterHeading = "Y"
  20. CentreHeading = "Y"
  21.  
  22. PicFileName = ""
  23. PicDescription = ""
  24. LineAfterPicture = "N"
  25. CentrePicture = "N"
  26.  
  27. Paragraph1 = ""
  28. Paragraph2 = ""
  29. Paragraph3 = ""
  30. Paragraph4 = ""
  31. LineAfterText = "Y"
  32.  
  33. SiteLocation = ""
  34. SiteDescription = ""
  35.  
  36. YourName = ""
  37. EmailAddress = ""
  38.  
  39. WizFileName = ""
  40.  
  41. /* Example text */
  42. ExTheTitle = "Digita's Home Page"
  43.  
  44. ExHeading = "Welcome to Digita's Home Page"
  45. ExSubHeading = "Where did you want to be yesterday?"
  46. ExLineAfterHeading = "Y"
  47. ExCentreHeading = "Y"
  48.  
  49. ExPicFileName = "/ClipArt/DigitaLogo.gif"
  50. ExPicDescription = "The Digita Logo"
  51. ExLineAfterPicture = "Y"
  52. ExCentrePicture = "Y"
  53.  
  54. ExParagraph1 = "This page is all about Digita International."
  55. ExParagraph2 = "We're a company that produces software for a number of Computer platforms, currently the Amiga and Windows."
  56. ExParagraph3 = "Wordworth is our Word Processing package for the Amiga."
  57. ExParagraph4 = "Check out our forthcoming Web site by pointing your browser at 'http://www.digita.com/'."
  58. ExLineAfterText = "Y"
  59.  
  60. ExSiteLocation = "http://www.digita.com/"
  61. ExSiteDescription = "Digita International's Home Page"
  62.  
  63. ExName = "Web Support"
  64. ExEmailAddress = "webmaster@digita.demon.co.uk"
  65.  
  66. ExWizFileName = "MyWebPage.html"
  67.  
  68.  
  69. /* Start of Wizard */
  70. START:
  71. WizardReq TITLE "Web Page Creator Wizard" LABEL "This Wizard will help you create a page for the World Wide Web." LABEL "" LABEL " Click Next or press Enter to continue to the next step" LABEL " click Previous to return to the previous step, if available" LABEL " click Cancel to quit without creating a web page or" LABEL " click Finish to create a web page using the current parameters." BUTTON 1 "_Next" BUTTON 2 "_Finish" BUTTON "-1" "_Cancel"
  72. IF Result = -1 THEN
  73.     EXIT
  74. IF Result = 2 THEN
  75.     SIGNAL MAKEWEBPAGE
  76.  
  77.  
  78. STEP1:
  79. WizardReq TITLE "Web Page Creator Wizard" LABEL "Please enter the title for the document, this should" LABEL "be a brief description of what the page is about." LABEL "" TEXTBOX 1 "_Title:" CONTENTS TheTitle BUTTON 1 "_Next" BUTTON 2 "_Previous" BUTTON 3 "_Example" BUTTON 4 "_Finish" BUTTON "-1" "_Cancel"
  80. Pressed = Result
  81.  
  82. If Pressed = -1 THEN
  83.     Exit
  84.  
  85. If Pressed = 2 THEN
  86.     SIGNAL START
  87.  
  88. If Pressed = 3 THEN DO
  89.     TheTitle = ExTheTitle
  90.     Pressed = ""
  91.     Signal STEP1
  92. END
  93.  
  94.  
  95. Wizard_GetTextBox 1
  96. TheTitle = Result
  97.  
  98. If TheTitle = "" THEN DO
  99.     RequestNotify Prompt "You must enter a title!"
  100.     Signal STEP1
  101. END
  102.  
  103. If Pressed = 4 THEN
  104.     SIGNAL MAKEWEBPAGE
  105.  
  106.  
  107. STEP2:
  108. WizardReq TITLE "Web Page Creator Wizard" LABEL "Please type a heading for the page, this" LABEL "will appear at the top of the page." LABEL "" TEXTBOX 1 "_Heading:" CONTENTS Heading TEXTBOX 2 "_SubHeading (optional):" CONTENTS SubHeading TEXTBOX 3 "_Line after? (Y/N):" CONTENTS LineAfterHeading TEXTBOX 4 "Cent_red? (Y/N):" CONTENTS CentreHeading BUTTON 1 "_Next" BUTTON 2 "_Previous" BUTTON 3 "_Example" BUTTON 4 "_Finish" BUTTON "-1" "_Cancel"
  109. Pressed = Result
  110.  
  111. If Pressed = -1 THEN
  112.     Exit
  113. If Pressed = 2 THEN DO
  114.     Pressed = ""
  115.     SIGNAL STEP1
  116. END
  117.  
  118. If Pressed = 3 THEN DO
  119.     Heading = ExHeading
  120.     SubHeading = ExSubHeading
  121.     LineAfterHeading = ExLineAfterHeading
  122.     CentreHeading = ExCentreHeading
  123.     Pressed = ""
  124.     Signal STEP2
  125. END
  126.  
  127.  
  128. Wizard_GetTextBox 1
  129. Heading = Result
  130.  
  131. Wizard_GetTextBox 2
  132. SubHeading = Result
  133.  
  134. Wizard_GetTextBox 3
  135. LineAfterHeading = UPPER(Result)
  136. If LineAfterHeading = "NO" THEN
  137.     LineAfterHeading = "N"
  138.  
  139. If LineAfterHeading ~= "N" THEN
  140.     LineAfterHeading = "Y"
  141.  
  142. Wizard_GetTextBox 4
  143. CentreHeading = UPPER(Result)
  144. If CentreHeading = "NO" THEN
  145.     CentreHeading = "N"
  146.  
  147. If CentreHeading ~= "N" THEN
  148.     CentreHeading = "Y"
  149.  
  150. If Pressed = 4 THEN
  151.     SIGNAL MAKEWEBPAGE
  152.  
  153.  
  154. STEP3:
  155. WizardReq TITLE "Web Page Creator Wizard" LABEL "If you want a picture on your page then" LABEL "enter the details below:" LABEL "" TEXTBOX 1 "F_ile Name (the full path):" CONTENTS PicFileName TEXTBOX 2 "_Description:" CONTENTS PicDescription TEXTBOX 3 "_Line after? (Y/N):" CONTENTS LineAfterPicture TEXTBOX 4 "Cent_red? (Y/N):" CONTENTS CentrePicture BUTTON 1 "_Next" BUTTON 2 "_Previous" BUTTON 4 "_Example" BUTTON 5 "_Finish" BUTTON "-1" "_Cancel"
  156. Pressed = Result
  157.  
  158. If Pressed = -1 THEN
  159.     Exit
  160. If Pressed = 2 THEN DO
  161.     Pressed = ""
  162.     SIGNAL STEP2
  163. END
  164.  
  165.  
  166.  
  167. If Pressed = 4 THEN DO
  168.     PicFileName = ExPicFileName
  169.     PicDescription = ExPicDescription
  170.     LineAfterPicture = ExLineAfterPicture
  171.     CentrePicture = ExCentrePicture
  172.     Signal STEP3
  173. END
  174.     
  175.  
  176. Wizard_GetTextBox 1
  177. PicFileName = Result
  178.  
  179. Wizard_GetTextBox 2
  180. PicDescription = Result
  181.  
  182. Wizard_GetTextBox 3
  183. LineAfterPicture = UPPER(Result)
  184. If LineAfterPicture = "NO" THEN
  185.     LineAfterPicture = "N"
  186.  
  187. If LineAfterPicture ~= "N" THEN
  188.     LineAfterPicture = "Y"
  189.  
  190. Wizard_GetTextBox 4
  191. CentrePicture = UPPER(Result)
  192. If CentrePicture = "NO" THEN
  193.     CentrePicture = "N"
  194.  
  195. If CentrePicture ~= "N" THEN
  196.     CentrePicture = "Y"
  197.  
  198. If Pressed = 4 THEN
  199.     Signal MAKEWEBPAGE
  200.  
  201.  
  202. STEP4:
  203. WizardReq TITLE "Web Page Creator Wizard" LABEL "Now type some paragraphs of text for the page." LABEL "Type each paragraph in a seperate text gadget:" LABEL "" TEXTBOX 1 "Paragraph _1:" CONTENTS Paragraph1 TEXTBOX 2 "Paragraph _2:" CONTENTS Paragraph2 TEXTBOX 3 "Paragraph _3:" CONTENTS Paragraph3 TEXTBOX 4 "Paragraph _4:" CONTENTS Paragraph4 TEXTBOX 5 "_Line After? (Y/N):" CONTENTS LineAfterText BUTTON 1 "_Next" BUTTON 2 "_Previous" BUTTON 3 "_Example" BUTTON 4 "_Finish" BUTTON "-1" "_Cancel"
  204. Pressed = Result
  205.  
  206. If Pressed = -1 THEN
  207.     Exit
  208. If Pressed = 2 THEN
  209.     Signal STEP3
  210. If Pressed = 3 THEN DO
  211.     Paragraph1 = ExParagraph1
  212.     Paragraph2 = ExParagraph2
  213.     Paragraph3 = ExParagraph3
  214.     Paragraph4 = ExParagraph4
  215.     LineAfterText = ExLineAfterText
  216.     Pressed = ""
  217.     SIGNAL STEP4
  218. END
  219.  
  220. Wizard_GetTextBox 1
  221. Paragraph1 = Result
  222.  
  223. Wizard_GetTextBox 2
  224. Paragraph2 = Result
  225.  
  226. Wizard_GetTextBox 3
  227. Paragraph3 = Result
  228.  
  229. Wizard_GetTextBox 4
  230. Paragraph4 = Result
  231.  
  232. Wizard_GetTextBox 5
  233. LineAfterText = UPPER(Result)
  234. If LineAfterText = "NO" THEN
  235.     LineAfterText = "N"
  236.  
  237. If LineAfterText ~= "N" THEN
  238.     LineAfterText = "Y"
  239.  
  240. If Pressed = 4 THEN
  241.     Signal MAKEWEBPAGE
  242.  
  243.  
  244. STEP5:
  245. WizardReq TITLE "Web Page Creator Wizard" LABEL "If you would like to add a link to one of your" LABEL "favourite Web Sites then type the details below:" LABEL "(The description is the text that is shown on the page.)" LABEL "" TEXTBOX 1 "Site _Location (URL):" CONTENTS SiteLocation TEXTBOX 2 "Site _Description:" CONTENTS SiteDescription BUTTON 1 "_Next" BUTTON 2 "_Previous" BUTTON 3 "_Example" BUTTON 4 "_Finish" BUTTON "-1" "_Cancel"
  246. Pressed = Result
  247.  
  248. If Pressed = -1 THEN
  249.     Exit
  250. if Pressed = 2 THEN
  251.     SIGNAL STEP4
  252.  
  253. If Pressed = 3 THEN DO
  254.     SiteLocation = ExSiteLocation
  255.     SiteDescription = ExSiteDescription
  256.     Pressed = ""
  257.     Signal STEP5
  258. END
  259.  
  260. Wizard_GetTextBox 1
  261. SiteLocation = Result
  262.  
  263. Wizard_GetTextBox 2
  264. SiteDescription = Result
  265.  
  266. If Pressed = 4 THEN
  267.     SIGNAL MAKEWEBPAGE
  268.  
  269.  
  270. STEP6:
  271. WizardReq TITLE "Web Page Creator Wizard" LABEL "If you would like to include contact information" LABEL "for yourself then fill in the details below:" LABEL "" TEXTBOX 1 "_Your Name:" CONTENTS YourName TEXTBOX 2 "E-mail _Address:" CONTENTS EmailAddress BUTTON 1 "_Next" BUTTON 2 "_Previous" BUTTON 3 "_Example" BUTTON 4 "_Finish" BUTTON "-1" "_Cancel"
  272. Pressed = Result
  273.  
  274. If Pressed = "-1" THEN
  275.     Exit
  276. If Pressed = 2 THEN
  277.     Signal STEP5
  278. If Pressed = 3 THEN DO
  279.     YourName = ExName
  280.     EmailAddress = ExEmailAddress
  281.     Pressed = ""
  282.     Signal STEP6
  283. END
  284.  
  285. Wizard_GetTextBox 1
  286. YourName = Result
  287.  
  288. Wizard_GetTextBox 2
  289. EmailAddress = Result
  290.  
  291. If Pressed = 4 THEN
  292.     Signal STEP5
  293.  
  294.  
  295. /* Now we've got the information, let's create the HTML file! */
  296. MAKEWEBPAGE:
  297. New
  298. Address Value Result
  299.  
  300. Document A4 "0.5in" "0.5in" "0.6in" "1.0in"
  301. Zoom 100
  302. Paragraph 0 0 0 LEFT AUTO SINGLE NONE NONE
  303.  
  304. Font NAME "Shannon Book" SIZE 12
  305.  
  306. Text '<HTML>'
  307. NewParagraph
  308. Text '<HEAD>'
  309. NewParagraph
  310. Text '<TITLE>'
  311. Bold
  312. if TheTitle = "" THEN
  313.     TheTitle = "<Unnamed>"
  314. Text TheTitle
  315. Plain
  316. Text '</TITLE>'
  317. NewParagraph
  318. Text '</HEAD>'
  319. NewParagraph
  320. NewParagraph
  321. Text '<BODY>'
  322. NewParagraph
  323.  
  324. If CentreHeading ~= "N" THEN DO
  325.     Text '<CENTER>'
  326.     NewParagraph
  327. END
  328.  
  329. If Heading ~= "" THEN DO
  330.     Text '<H1>'
  331.     Font Size 28
  332.     Text Heading
  333.     Font SIZE 12
  334.     Text '</H1>'
  335.     NewParagraph
  336. END
  337.  
  338. If SubHeading ~= "" THEN DO
  339.     Text '<H2>'
  340.     Font Size 18
  341.     Text SubHeading
  342.     Font SIZE 12
  343.     Text '</H2>'
  344.     NewParagraph
  345. END
  346.  
  347. If LineAfterHeading ~= "N" THEN DO
  348.     Text '<HR>'
  349.     NewParagraph
  350. END
  351.  
  352. If CentrePicture ~= "N" THEN DO
  353.     If CentreHeading = "N" THEN DO
  354.         Text '<CENTER>'
  355.         NewParagraph
  356.     END
  357. END
  358.  
  359. If PicFileName ~= "" THEN DO
  360.     Text '<IMG SRC = "'
  361.     Text PicFileName
  362.     Text '"'
  363.     If PicDescription ~= "" THEN DO
  364.         Text ' ALT = "'
  365.         Text PicDescription
  366.         Text '"'
  367.     END
  368.     Text '>'
  369.     NewParagraph
  370. END
  371.  
  372. If LineAfterPicture ~= "N" THEN DO
  373.     Text '<HR>'
  374.     NewParagraph
  375. END
  376.  
  377. If CentreHeading ~= "N" | CentrePicture ~= "N" THEN DO
  378.     Text '</CENTER>'
  379.     NewParagraph
  380. END
  381.  
  382. If Paragraph1 ~= "" THEN DO
  383.     Text Paragraph1
  384.     NewParagraph
  385.     Text '<P>'
  386.     NewParagraph
  387. END
  388.  
  389. If Paragraph2 ~= "" THEN DO
  390.     Text Paragraph2
  391.     NewParagraph
  392.     Text '<P>'
  393.     NewParagraph
  394. END
  395.  
  396. If Paragraph3 ~= "" THEN DO
  397.     Text Paragraph3
  398.     NewParagraph
  399.     Text '<P>'
  400.     NewParagraph
  401. END
  402.  
  403. If Paragraph4 ~= "" THEN DO
  404.     Text Paragraph4
  405.     NewParagraph
  406.     Text '<P>'
  407.     NewParagraph
  408. END
  409.  
  410. If LineAfterText ~= "N" THEN DO
  411.     Text '<HR>'
  412.     NewParagraph
  413. END
  414.  
  415. If SiteLocation ~= "" THEN DO
  416.     Text '<A HREF="'
  417.     Text SiteLocation
  418.     Text '">'
  419.     Text SiteDescription
  420.     Text '</A>'
  421.     NewParagraph
  422.     If YourName ~= "" THEN DO
  423.         Text '<P>'
  424.         NewParagraph
  425.     END
  426. END
  427.  
  428. If YourName ~= "" THEN DO
  429.     Text '<A HREF="mailto:'
  430.     Text EmailAddress
  431.     Text '">E-mail '
  432.     Text YourName
  433.     Text '</A>'
  434.     NewParagraph
  435. END
  436.  
  437.  
  438. Text '</BODY>'
  439. NewParagraph
  440. Text '</HTML>'
  441. NewParagraph
  442.  
  443. WizardReq TITLE "Web Page Creator Wizard" LABEL "Now the page has been created, we need to save" LABEL "the file in ASCII format." LABEL "" LABEL "The filename should end with the extension '.html'" LABEL "" BUTTON 1 "_OK" BUTTON "-1" "_Cancel"
  444. If Result = -1 THEN DO
  445.     Close FORCE
  446.     Exit
  447. END
  448.  
  449. RequestFile TITLE "Select Filename for File" PATTERN "#?.html"
  450. WizFileName = Result
  451.  
  452. If (RC > 0) THEN
  453.     Exit
  454.  
  455. if WizFileName = "" THEN
  456.     WizFileName = ExWizFileName
  457.  
  458. SaveAs ASCII NAME WizFileName
  459.  
  460. RequestNotify PROMPT "The Web Page Creator Wizard has finished."
  461. End
  462.