home *** CD-ROM | disk | FTP | other *** search
/ Archive Magazine 1995 / ARCHIVE95.iso / text / hints / volume_04 / issue_09 < prev    next >
Text File  |  1995-02-16  |  25KB  |  693 lines

  1. Hints and Tips
  2. 4.9
  3. Å   Beware spaces Ö There is a problem with spaces at the end of OS
  4. variables:
  5. 4.9
  6. If you include in a !Run file code such as the following:
  7. 4.9
  8. Set ThisApp$Dir <Obey$Dir>
  9. 4.9
  10. Run <ThisApp$Dir>.!RunImage
  11. 4.9
  12. then beware that you donæt include a space at the end of the first line!
  13. If you do, the space will be included in the definition of ThisApp$Dir
  14. and the second line will cause a öBad File Nameò error. Hugh Eagle.
  15. 4.9
  16. Å   PC emulator with an ARM3 Ö The default boot-up process for the ARM3
  17. performs an RMClear command, killing all RAM resident modules including,
  18. in particular, the module that drives the ARM3. So, in order, to get the
  19. PC emulator to take advantage of the ARM3És extra speed you need to
  20. alter the line in !PC.Genboot.!Config immediately after the one that
  21. reads öPerform RMClear?ò from öYò to öNò! (Thanks to Martin Coulson of
  22. Atomwide for this advice.) Hugh Eagle
  23. 4.9
  24. Å   Printer tips Ö You can alter the halftone density by editing the
  25. PrData file within your printer driver (see Archive 4.6 for an example
  26. of how to find this). For instance, PrinterLJ has lines such as:
  27. 4.9
  28. pxres_halftone:300/8
  29. 4.9
  30. pyres_halftone:300/8
  31. 4.9
  32. so each halftone dot is actually formed of a matrix of 8x8 dots, giving
  33. a halftone density of 300/8=37.5 dpi. This gives a very coarse effect
  34. but can produce 65 different grey levels. Altering the lines to:
  35. 4.9
  36. pxres_halftone:300/6
  37. 4.9
  38. pyres_halftone:300/6
  39. 4.9
  40. gives öonlyò 37 grey levels and a dot pitch of 50 dpi. Experiment to see
  41. what suits your printer best.
  42. 4.9
  43. A word of caution. I used !Draw to produce some PCB artwork, printed it
  44. out using !PrinterLJ on a DeskJet Plus and sent it off... Disaster! The
  45. size was OK across the width but was 1.5% too small along the length of
  46. the paper, as was discovered when the finished circuit boards came back.
  47. Iæd previously had no trouble using an Epson-compatible printer, so it
  48. may be something to do with the friction feed on the HP slipping, or
  49. perhaps a slightly thicker paper would have helped. Anyway, if your hard
  50. copy must be accurate, then check it! Jonathan Oakley, Cambridge.
  51. 4.9
  52. Å   Printing * command output Ö Ever since I got my LaserDirect I have
  53. been laboriously printing the results of *Status, *Dump, etc. by
  54. directing the output to a file and then printing the file (while
  55. bemoaning the loss of the <Ctrl-B>, etc. facility α la BBC). However, I
  56. have just realised that it is easier (and much more in keeping with
  57. Acornæs RISC-OS standards, I am sure) to open a Task Window in !Edit,
  58. enter the * command (which puts its output in the window) and then print
  59. the contents of the window by ösavingò to the printer driver icon. In
  60. other words, click <menu> on the !Edit icon on the icon bar and use
  61. Create Ö New Task window. This presents you with a new window with a *
  62. ready for a command. Type in the command whose output you want listing,
  63. say, *STATUS. When the listing has finished, click on the window with
  64. <menu> and go Edit Ö Save and drop the text file produced onto your
  65. printer icon. Easy! (Then close the window, answering ÉYesæ to ÉKill and
  66. closeæ.) Hugh Eagle
  67. 4.9
  68. Å   Printing via a RISC-OS printer driver from a BASIC program Ö Have you
  69. ever wondered why your computer has a button called öPrintò that doesnæt
  70. seem to do anything of the sort?
  71. 4.9
  72. At last, applications seem to be appearing that recognise that pressing
  73. the <Print> key is rather an intuitive way of printing (Impression and
  74. Poster are two examples). Also, I have discovered that RISC-OS printer
  75. drivers are not nearly as fearsome as the PRM makes them seem and it is
  76. actually quite easy to incorporate into your own programæs printing
  77. routines which are activated by ... wait for it ... the <Print> key.
  78. Amazing!
  79. 4.9
  80. Take the Painting application from the original Arthurian Welcome disc,
  81. for instance. We still use this in my family because it is so simple,
  82. but it has always (incredibly) lacked a printing facility. To rectify
  83. this, proceed as follows:
  84. 4.9
  85. Put this line near the beginning of the program (e.g. immediately after
  86. PROCdesktop (at about line 200):
  87. 4.9
  88.  PROCPrintSetup(110000)
  89. 4.9
  90. Note: 110,000 bytes is big enough to allow the program to run in mode
  91. 20. 55,000 would be enough for mode 12.
  92. 4.9
  93. Put this line in the WimpPoll loop (e.g. immediately after the ENDCASE
  94. statement at around line 400):
  95. 4.9
  96. IF INKEY-33 THEN PROCPrint(162,232,1274,972)
  97. 4.9
  98. Note: INKEY-33 is the crucial function that recognises whether the
  99. <Print> key is being pressed.
  100. 4.9
  101. Finally, put these procedures at the end of the program:
  102. 4.9
  103. DEF PROCPrintSetup(SpriteAreaSize%)
  104. 4.9
  105. DIM SpriteArea% SpriteAreaSize%
  106. 4.9
  107. !SpriteArea%=SpriteAreaSize%
  108. 4.9
  109. SpriteArea%!8=16
  110. 4.9
  111. SYS öOS_SpriteOpò,9+256,SpriteArea%
  112. 4.9
  113. ENDPROC
  114. 4.9
  115.  
  116. 4.9
  117. DEF PROCPrint(X1%,Y1%,X2%,Y2%)
  118. 4.9
  119. SYS öHourglass_Onò
  120. 4.9
  121. PrintHandle%=OPENOUT(öprinter:ò)
  122. 4.9
  123. SYS öPDriver_SelectJobò,PrintHandle% ,0 TO Old%
  124. 4.9
  125. ON ERROR LOCAL PROCPrintError
  126. 4.9
  127.  
  128. 4.9
  129. MOVE X1%,Y1%:MOVE X2%,Y2%
  130. 4.9
  131. SYS öOS_SpriteOpò,14+256, SpriteArea%,öTempSpriteò,1 : REM Get sprite
  132. 4.9
  133.  
  134. 4.9
  135. DIM RectBlock% 15,Transform% 15,PrintPosition% 7
  136. 4.9
  137. RectID%=1
  138. 4.9
  139. BackCol%=&FFFFFF00:REM set background colour to white
  140. 4.9
  141.  
  142. 4.9
  143. REM X1%, Y1%, etc. are the screen coordinates of the area
  144. 4.9
  145. to be printed
  146. 4.9
  147. !RectBlock%=X1%:RectBlock%!4=Y1%
  148. 4.9
  149. RectBlock%!8=X2%:RectBlock%!12=Y2%
  150. 4.9
  151.  
  152. 4.9
  153. REM No scaling or rotation required
  154. 4.9
  155. !Transform%=&10000:Transform%!4=0
  156. 4.9
  157. Transform%!8=0:Transform%!12=&10000
  158. 4.9
  159.  
  160. 4.9
  161. REM Put the bottom LH corner 1.5ö REM from the left AND 5ò from the
  162. 4.9
  163. REM bottom of the page
  164. 4.9
  165. !PrintPosition%=1.5*72000
  166. 4.9
  167. PrintPosition%!4=5*72000
  168. 4.9
  169.  
  170. 4.9
  171. SYS öPDriver_GiveRectangleò,RectID%, RectBlock%,Transform%,
  172. PrintPosition%,BackCol%
  173. 4.9
  174. SYS öPDriver_DrawPageò,1,RectBlock%, 0,0 TO More%,,RectID%
  175. 4.9
  176. WHILE More%
  177. 4.9
  178.   SYS öOS_SpriteOpò,34+256
  179. 4.9
  180. ,SpriteArea%,öTempSpriteò
  181. 4.9
  182. ,X1%,Y1%,0
  183. 4.9
  184.   SYS öPDriver_GetRectangleò,, RectBlock% TO More%,,RectID%
  185. 4.9
  186. ENDWHILE
  187. 4.9
  188. SYS öPDriver_EndJobò,PrintHandle%
  189. 4.9
  190. SYS öHourglass_Smashò
  191. 4.9
  192. CLOSE#(PrintHandle%)
  193. 4.9
  194. ENDPROC
  195. 4.9
  196.  
  197. 4.9
  198. DEF PROCPrintError
  199. 4.9
  200. SYS öPDriver_Abortò,PrintHandle%
  201. 4.9
  202. SYS öHourglass_Smashò
  203. 4.9
  204. CLOSE#(PrintHandle%)
  205. 4.9
  206. ENDPROC
  207. 4.9
  208. Hugh Eagle
  209. 4.9
  210. Å   Running one application from inside another If youæve ever been
  211. puzzled by odd behaviour when you try to run one application from inside
  212. another, the following advice from Mark Neves of Computer Conceptsæ
  213. Technical Support Department may help.
  214. 4.9
  215. My particular problem arose when I tried to make sure that a printer
  216. driver was loaded by running !PrinterXX from within application Aæs !Run
  217. file. The result was that application A failed to run and when I quit
  218. !PrinterXX, an error was reported.
  219. 4.9
  220. The answer is that when you run a ösibling taskò from another appli
  221. cationæs run file the sibling ötakes over the current environmentò until
  222. it terminates and only then does it return control to the parent task
  223. (in a manner analogous to a subroutine call).
  224. 4.9
  225. The solution is to use the command
  226. 4.9
  227. * Desktop <sibling task name>
  228. 4.9
  229. rather than *Run.  Hugh Eagle
  230. 4.9
  231. Å   öSavingò data from one application to another Ö (This is another of
  232. those öobvious to those who know itò hints.) If you want to transfer
  233. data (e.g. text or a sprite or a drawn object) from one RISC-OS
  234. application to another you donæt have to save it on a disc from
  235. application A and then load it into application B; all you have to do is
  236. drag the icon from application Aæs öSaveò box (i.e. the window that
  237. appears when you choose a Save menu option) into application Bæs window.
  238. 4.9
  239. This works with all well behaved (öRISC-OS compliantò) applications,
  240. e.g. !Edit, !Draw, Impression, !Paint, !Poster, etc. and generally works
  241. for either the whole contents of a window or for selected items. Hugh
  242. Eagle
  243. 4.9
  244. Å   Sprite plotting and colour translation Ö The ColourTrans section of
  245. the PRM (pages 1399 to 1424) includes references to a number of SWIæs
  246. (including, in particular, ColourTrans_SelectTable) which have to be
  247. called with R1 pointing to the ösource paletteò. Since, according to PRM
  248. pages 390Ö391, a spriteæs palette data starts 44 bytes after the
  249. beginning of the sprite, it seems clear that, in order to translate a
  250. spriteæs palette you simply call the ColourTrans SWI with
  251. SpritePointer%+44 in R1, doesnæt it? Wrong!!!
  252. 4.9
  253. In fact, the palette data in a sprite appears to include 8 bytes for
  254. each colour with the second 4 bytes duplicating the first 4 (does anyone
  255. know why this is?) whereas ColourTrans expects only 4 bytes per colour.
  256. 4.9
  257. So, before you can translate a spriteæs colours, you need to include
  258. some code on the following lines:Ö
  259. 4.9
  260. PaletteLength%=SpritePointer%!32Ö44
  261. 4.9
  262. IF PaletteLength%=0 THEN
  263. 4.9
  264.  PalettePointer%=0
  265. 4.9
  266. ELSE
  267. 4.9
  268.  FOR I%=0 TO PaletteLength%-8 STEP 8
  269. 4.9
  270.   Palette%!(I%/2) = SpritePointer%!(I%+44)
  271. 4.9
  272.  NEXT
  273. 4.9
  274.  PalettePointer%=Palette%
  275. 4.9
  276. ENDIF
  277. 4.9
  278. Note: The palette data, if any, starts 44 bytes after the beginning of
  279. the sprite. SpritePointer%!32 contains the number of bytes from the
  280. beginning of the sprite to the start of the actual sprite pixel data. If
  281. this equals 44, there is no palette.
  282. 4.9
  283. The point of setting PalettePointer% to 0 if there is no palette data,
  284. is that if the sprite has no palette then, in many cases, (especially if
  285. the sprite is defined in a 256 colour mode) it makes sense to call
  286. ColourTrans with R1 set to 0 since ColourTrans will then translate the
  287. default palette for the spriteæs mode. However ...
  288. 4.9
  289. Å   Strange sprite colours Ö Ever since RISC-OS arrived, Iæve been puzzled
  290. by the odd colours which have appeared when some sprites have been
  291. plotted by various applications (including Impression, no less). I think
  292. that, at last, Iæm beginning to understand why. Consider the following
  293. curious state of affairs:
  294. 4.9
  295. Palette details are an optional part of the sprite data format. A lot of
  296. sprites are created by !Paint. !Paint, by default, creates sprites
  297. without a palette (presumably on the assumption that, having been
  298. designed in the Desktop colour scheme, they will be used on the
  299. Desktop.)
  300. 4.9
  301. The PRM (page 1278) recommends that you should use the ColourTrans
  302. module for best results when plotting or printing a sprite. However,
  303. although ColourTrans knows how to translate from any given palette and
  304. from the default palette for any mode, it doesnæt seem to be equipped
  305. with any means of translating the standard desktop palette of a mode
  306. other than the current one.
  307. 4.9
  308. Therefore, the best that applications can do when faced with a palette-
  309. less sprite is to tell ColourTrans to assume that the sprite was defined
  310. in the default palette for its mode. The trouble with this is that it is
  311. about the worst possible thing that can be done with a sprite defined to
  312. be used on the Desktop since, for instance, colour 0 which is intended
  313. to be white, will be translated by ColourTrans, working from the default
  314. palette, into black! For example, even Impression reverses the colours
  315. of its standard document icon.
  316. 4.9
  317. So, whatæs to be done? As far as I can tell:
  318. 4.9
  319. The best advice is to make sure that every sprite has a palette. If this
  320. isnæt possible then, for plotting sprites on the Desktop, use
  321. Wimp_ReadPixTrans if a sprite doesnæt have a palette (this is the
  322. routine that the Wimp manager uses for plotting sprites as icons and
  323. seems to produce quite acceptable results on the whole) and save
  324. ColourTrans calls for sprites that do have palettes. For example, follow
  325. the above palette conversion routine with code something like this:
  326. 4.9
  327. SYS öColourTrans_SelectTableò,Mode%, PalettePointer%,-1,-1,ColTable%
  328. 4.9
  329. IF PaletteLength%<>0 THEN
  330. 4.9
  331.   SYS öOS_SpriteOpò,52+512,Sprites% ,SpritePointer%,200,200,
  332. Mask%*8,Scale%,ColTable%
  333. 4.9
  334. ELSE
  335. 4.9
  336.   IF NumberOfColoursInSprite%<63 THEN SYS öWimp_ReadPixTransò, 512,
  337. Sprites%,SpritePointer% ,,,,,ColTable%
  338. 4.9
  339.   SYS öOS_SpriteOpò,52+512,Sprites%, SpritePointer%,200,200,
  340. 4.9
  341. Mask%*8,Scale%,ColTable%
  342. 4.9
  343. ENDIF
  344. 4.9
  345. If youære plotting to a printer, öWimp_ReadPixTransò doesnæt help and I
  346. donæt think there is any straightforward, foolproof method. (It would be
  347. possible, I think, to create a block of palette data with the RGB values
  348. for the colours of the Desktop palette in the relevant mode and then
  349. feed this into ColourTrans, but this would be a rather tedious process.)
  350. Hugh Eagle
  351. 4.9
  352. Impression HintsáandáTips
  353. 4.9
  354. Å   Adding fonts by using search & replace Ö As a mathematics and physics
  355. teacher, I use a lot of Greek letters and it is rather bothersome to
  356. have to work through all those menus to reach the effect öGreekò every
  357. time. Therefore, I use search & replace in a way which (at least in the
  358. Impression Junior handbook) is not documented:
  359. 4.9
  360. I type the text, using the Latin equivalents of the Greek letters (ög-
  361. Quantò instead of ög-Quantò) then, when I have finished the text, I use
  362. the following:
  363. 4.9
  364.    Find: g-Quant
  365. 4.9
  366.    Replace: g-Quant
  367. 4.9
  368. Impression does the rest. (Many thanks to Computer Concepts for the
  369. information!)
  370. 4.9
  371. By the way, if you wish to find out how all the other effects are saved
  372. in an Impression document, there is an easy way to find out: Just take a
  373. document with lots of effects and save only the text story (öwith
  374. effectsò). If you then drag the icon of the saved text story onto the
  375. !Edit icon, the text will appear with all the effects in plain language. 
  376.  Jochen Konietzko, Koeln, Germany
  377. 4.9
  378. (Wouldnæt it be easier to use <ctrl-F6> and edit the öGreekò style, go
  379. down to the bottom where it says öKey short-cutò, click in the box and
  380. press, say, <ctrl-shift-F9>, then OK it? Then when you want, say, ög-
  381. Quantò, you type ö<ctrl-shift-F9>g<ctrl-shift-F9>-Quantò.... Oh, I see,
  382. Impression Junior doesnæt have styles. Oh well, nice try!)
  383. 4.9
  384. Å   Cutting invisible text Ö If you have more text in a frame than will
  385. fit, you get the little red arrow which indicates that some of the text
  386. is invisible. You could obviously create a new frame, click on the over-
  387. full frame and then click <adjust> on the new frame but there may still
  388. be too much for that frame. So, is there any way of marking the
  389. invisible text so that you can cut it or copy it? The answer is that you
  390. simply use <ctrl-down> to move the cursor to the (invisible) bottom of
  391. the text the click <adjust> to indicate the upper limit of the area to
  392. be marked. Ed.
  393. 4.9
  394. Å   Handy hint Ö If you use the Éhandæ to move up or down through a long
  395. document, you are not limited in your movements to the visible page. In
  396. other words, if you keep moving the mouse up and up (by repeatedly
  397. lifting the mouse off the table) or down and down, you just keep moving
  398. through the document in the desired direction. (This is particularly
  399. useful if you are a trackerball user!) Ed.
  400. 4.9
  401. Å   Importing text files into Impression Ö In the new version of Impres
  402. sion which CC have just sent me (version 2.11), I have discovered an
  403. exciting new concept in the Archimedes world Ö öthe Return Stripperò!!
  404. 4.9
  405. In the Extensions directory is a new loader module called öLoadReturnò
  406. which at last seems to deal satisfactorily with the importing of text
  407. files. Using this, I no longer have to load the file into !Edit then
  408. change linefeeds into carriage returns before importing. Nor do I have
  409. to suffer fixed line lengths in the imported text.
  410. 4.9
  411. However, I do have two quibbles (some people are never satisfied!):
  412. 4.9
  413. Double carriage returns are reduced to single returns, so spaces between
  414. paragraphs are eliminated (unless you change the style so that it leaves
  415. such a space Ö which I think is good practice. Ed). I feel it would be
  416. helpful to be able to set a öpreferenceò to decide whether or not double
  417. returns are preserved.
  418. 4.9
  419. Importing a text file now involves a somewhat tiresome sequence of
  420. message windows whereby I am asked to accept or reject each of the
  421. available loader modules in turn. I feel it would be helpful to be able
  422. to use the öpreferenceò facility either to define which loader is used
  423. for which filetype or, at the very least, to determine the order in
  424. which the various loader options are offered to me. Hugh Eagle.
  425. 4.9
  426. (All I did was to put the LoadReturn extension into the Auto directory
  427. in the Impression directory and now when I want files stripping, I use
  428. !Settype (Shareware 19 or 23) to change them to Acorn data file type
  429. (&FFD) and they are stripped automatically. Ed.)
  430. 4.9
  431. Å   Labels & Tickets Ö Another way of doing tickets and labels is to
  432. define a new master page which is the right size for what you want to
  433. create (pretty radical, eh?). öFit lotsò still works, giving you
  434. multiple tickets per sheet, but youære not restricted to 1% size
  435. increments which can cause you to miss the boundaries on sticky labels,
  436. especially where there are three or four across the page width.
  437. (Brilliant! Why didnæt I think of that? Ed. Ö see below.)
  438. 4.9
  439. A similar technique works for cassette inlays. One way is to define a
  440. single master page 101mm deep and 288mm wide, divided into columns of
  441. 16, 12, 65, 65, 65 and 65mm; this format will fit two inlays to an A4
  442. page (assuming zero border width, which will vary between printers), but
  443. you need to fiddle around with !FontDraw and !Draw (Or use Draw1╜ Ö see
  444. below. Ed) to get text on the spine of the cassette. Starting with a
  445. page 288mm deep and 101mm wide gives you the spine text a sensible way
  446. round, but the four öbodyò pages are then landscape, which you may not
  447. want.
  448. 4.9
  449. Another way is to split the inlay into two chapters; the spine has a
  450. 101mm wide, 28mm high master page, and the body pages are 65mm by 101mm,
  451. or vice versa if you want landscape. Then you need to do a bit of
  452. cutting and pasting by hand, as Impression wonæt print individual pages
  453. sideways. This is the technique I ended up by using, printing at 141%
  454. then reducing the pasted-up result from two up on A3 back down by 70% to
  455. A4, thus enhancing the graphics halftones from 37.5 dpi to 53.6 dpi.
  456. Iæve included an example ... (Which we have put on the Monthly Program
  457. Disc. Ed) Jonathan Oakley, Cambridge.
  458. 4.9
  459. Å   Labels & tickets Ö Edæs version Ö I have played a bit with Jonathanæs
  460. ideas and developed them a little. I tried to create some labels (like
  461. the ones on our Shareware Discs etc which come as 24 to an A4 page) and
  462. found that his method worked very well. I created a master page that was
  463. 70mm x 37.125mm (which is 210mm divided by 3 horizontally and 297mm
  464. divided by 8 vertically). I set a border 3mm wide on all four sides
  465. because the Laser Direct HiRes can print up to about 2.5mm of the edge
  466. of the page and I wanted to have a simple line border around my labels.
  467. I put all my text on the master page including a page number so that I
  468. could have a serial number on the labels. I then closed the master page
  469. and created another 23 pages for my document by using <menu> Edit Ö
  470. Insert new page. I clicked 22 times with <adjust> so that the menu
  471. stayed on screen and once with <select>. I then pressed <print> and
  472. clicked on öFit lotsò and then öSetup...ò and then öIgnore page borderò.
  473. The printout which appeared was almost right but was 1mm too far to the
  474. right, 1mm too low at the top and the last label was even lower. (Thinks
  475. hard.... tries various things and then....) The printout was slightly
  476. too long so I created a slightly shorter master page Ö 70mm x 37.11mm. I
  477. tried to see if there was any adjustment on the laser printer but
  478. couldnæt find any so I went to the (new, shorter) master page, clicked
  479. on the frame and pressed <ctrl-F10> to alter the frame. In the position
  480. section, I simply increased X from 5 to 6 and reduced Y from 5 to 4 in
  481. order to move the text on the page 1 mm right and 1 mm up. Bingo! Every
  482. border on every label was almost exactly 5mm.
  483. 4.9
  484. I also had a quick try with Jonathanæs cassette inlay printing and it is
  485. really very easy with his first method Ö I cheated though by using
  486. Draw1╜ (Shareware 34). For the spine, all you do is create a new Draw1╜
  487. document, type in the text you want, change it to whatever font you are
  488. using, press <menu> Ö Special Ö Text to path and then <menu> Ö Save Ö
  489. Selection and drop the Draw file produced into the relevant graphics
  490. frame in your Impression document. Then use <adjust> to drag the picture
  491. round until it is near enough at right angles to the rest of the text
  492. (having decided which way you want it to face) and finally press <ctrl-
  493. F11> (Alter graphic) and set the Angle to exactly 90░ or 270░. (If you
  494. can remember which way round 90░ or 270░ puts it, then thereæs no need
  495. to swing it round with <adjust>.) Here is a bit of text that I have just
  496. inserted. It must have taken me all of 45 seconds to create the frame,
  497. type in the text, convert it and add it in! (Software to enable me to do
  498. that on the Mac cost me hundreds of pounds a couple of years ago!)
  499. 4.9
  500. Å   öRunningò an Impression document Ö In Alan Highetæs review of !Menon
  501. on Shareware 38 (Archive 4.8 page 48) he mentions that it did not work
  502. well with Impression documents since an attempt to örunò one of these
  503. caused a second copy of Impression to appear on the icon bar.
  504. 4.9
  505. I have observed a similar phenomenon in trying to create a front-end for
  506. Impression which, amongst other things, opens a template document chosen
  507. by the user. Simply *Running the document results in the loading of a
  508. new copy of Impression regardless of whether one is already running.
  509. 4.9
  510. So, why is it that double-clicking on an Impression document in a Filer
  511. window will load it into an existing copy of Impression whereas
  512. örunningò it doesnæt?
  513. 4.9
  514. Mark Neves of Computer Conceptsæ Technical Support Department has kindly
  515. explained why this happens and has pointed to a solution.
  516. 4.9
  517. The reason is that what happens when you double click on an icon in a
  518. Filer window is not simply that the document is örunò. First, the Filer
  519. broadcasts a Message_DataOpen message inviting other applications to
  520. open the document, and only if this message is returned unacknowledged
  521. does it instigate a *Run.
  522. 4.9
  523. The solution is a fairly simple program on the following lines:
  524. 4.9
  525. REM >!RunImage
  526. 4.9
  527. TaskName$=öRunImpDocò
  528. 4.9
  529. :
  530. 4.9
  531. PROCSetUpWimp
  532. 4.9
  533. DocToOpen$=FNReadOSVarVal
  534. 4.9
  535. (öDoc$ToOpenò)
  536. 4.9
  537. PROCPollLoop
  538. 4.9
  539. SYS öWimp_CloseDownò,Taskid% ,&4B534154
  540. 4.9
  541. IF NotAcknowledged% THEN OSCLI(öRun ò+DocToOpen$)
  542. 4.9
  543. END
  544. 4.9
  545. :
  546. 4.9
  547. DEF PROCPollLoop
  548. 4.9
  549. LOCAL mask%,quit%
  550. 4.9
  551. NotAcknowledged%=FALSE
  552. 4.9
  553. PROCSendDataOpenMessage
  554. 4.9
  555. mask%=0
  556. 4.9
  557. quit%=FALSE
  558. 4.9
  559. REPEAT
  560. 4.9
  561. SYS öWimp_Pollò,mask%,block% TO reason%
  562. 4.9
  563. CASE reason% OF
  564. 4.9
  565. WHEN 17,18 : IF block%!16=4 THEN quit%=TRUE
  566. 4.9
  567.  REM Another task (presumably
  568. 4.9
  569.  REM Impression) has acknowledged
  570. 4.9
  571.  REM our request to load a file.
  572. 4.9
  573. WHEN 19  : NotAcknowledged%=TRUE:quit%=TRUE
  574. 4.9
  575.  REM Our request has not been acknowledged.
  576. 4.9
  577. ENDCASE
  578. 4.9
  579. UNTIL quit%
  580. 4.9
  581. ENDPROC
  582. 4.9
  583. :
  584. 4.9
  585. DEF PROCSendDataOpenMessage
  586. 4.9
  587. !block%=256
  588. 4.9
  589. block%!12=0:block%!16=5:block%!20=0
  590. 4.9
  591. block%!28=0:block%!32=0:block%!36=0
  592. 4.9
  593. block%!40=&2000
  594. 4.9
  595. $(block%+44)=DocToOpen$
  596. 4.9
  597. ?(block%+44+LEN(DocToOpen$))=0
  598. 4.9
  599. SYS öWimp_SendMessageò,18,block%,0
  600. 4.9
  601. ENDPROC
  602. 4.9
  603. :
  604. 4.9
  605. DEF PROCSetUpWimp
  606. 4.9
  607. DIM block% &1000,errblk% 256
  608. 4.9
  609. REM Taskid%=FNWimpInit(200,TaskName$)
  610. 4.9
  611. SYS öWimp_Initialiseò,200, &4B534154,TaskName$ TO Version%,Taskid%
  612. 4.9
  613. ON ERROR PROCError(TaskName$)
  614. 4.9
  615. ENDPROC
  616. 4.9
  617. :
  618. 4.9
  619. DEF FNReadOSVarVal(varname$)
  620. 4.9
  621. LOCAL temp1%,temp2%,length%
  622. 4.9
  623. DIM temp1% 100,temp2% 100
  624. 4.9
  625. $temp2%=varname$
  626. 4.9
  627. SYS öOS_ReadVarValò,temp2%,temp1%, 100,0,3 TO ,,length%
  628. 4.9
  629. temp1%?length%=13
  630. 4.9
  631. var$=$temp1%
  632. 4.9
  633. =var$
  634. 4.9
  635. :
  636. 4.9
  637. DEF PROCError(TaskName$)
  638. 4.9
  639. !errblk%=ERR
  640. 4.9
  641. $(errblk%+4)=REPORT$+ö at line ò+ STR$ERL
  642. 4.9
  643. errblk%?(4+LEN$(errblk%+4))=0
  644. 4.9
  645. SYS öWimp_ReportErrorò,errblk%,1, TaskName$
  646. 4.9
  647. SYS öWimp_CloseDownò,Taskid%, &4B534154:END
  648. 4.9
  649. ENDPROC
  650. 4.9
  651. To use this program, simply set up the OS variable Doc$ToOpen with the
  652. full pathname of the document and run the program. Hugh Eagle
  653. 4.9
  654. Å   Setting a style in an Impression frame Ö Question: how do I set up a
  655. blank frame containing a predetermined style (for instance, to hold the
  656. address of the person I am writing to, where I would like to use a
  657. different font from the one in the body of the letter)? If I put the
  658. cursor in the frame, then apply the style, then move the cursor
  659. elsewhere (or save and reload the document) before bringing it back to
  660. the address frame, and then start typing, the text comes up in the
  661. Basestyle.
  662. 4.9
  663. Answer: If after applying the style, I type anything (for instance a
  664. couple of carriage returns) in the address frame then the applied style
  665. seems to be remembered and the address frame works as intended.
  666. 4.9
  667. Caution: if I delete the entire contents of the frame the applied style
  668. is deleted too. So, if I want to blank the frame for reuse I have to
  669. remember to leave a carriage return or two to preserve the style. Hugh
  670. Eagle.
  671. 4.9
  672. Å   Typesetting Ö We said we would try to find companies willing to do
  673. typesetting from Impression output. Here are two that we have found. If
  674. you discover others, ask them to send us details of their services and
  675. we will publish them. We are particularly interested in those that will
  676. take Impression files as such rather than PostScript files on MS-DOS
  677. discs.
  678. 4.9
  679. The Type Station in Cardiff offers a full bureau service for bromide or
  680. film. You create PostScript files and either send them by post on an MS-
  681. DOS disc or send them c/o BT using a modem. For details, contact Elgan
  682. Davis on 0222Ö229977.
  683. 4.9
  684. Focus Print in Aberdeen can do bromides (PMTæs) from your Impression
  685. files. Phone Alexander Bisset on 0224Ö592571 ext 211 (or 0224Ö593956
  686. evenings).ááA
  687. 4.9
  688.  
  689. 4.9
  690.  
  691.  
  692.  
  693.