Index  |  Applets  |  Templates  |  Resources  |  What's new


Macros and buttons


All upper case
Button bar icon order and macros
Facing pages macro tip
Interactive help for user macro buttons
Macro buttons to open/close palettes
Selecting overflowed text
Thesaurus button

Return to complete hints and tips index


Q :– I want to create a macro and button for the toolbar that will change a selected block of text into upper case. How do I do it?
Create a style in the edit style box. All you have to do is select Case=All Caps on the modify text menu.

Define new buttons with, for example, the names and macro strings as shown:

FunctionNameMacro
Normal
Title
All Caps
aa
Aa
AA
{case_entry(0,0)}
{case_entry(1,0)}
{case_entry(2,0)}

While these don't have the toggle effect of swapcase, they seem to do the trick.

Q :– I wished to save a change in the order of the button icons on the top bar (produced by Ctrl dragging). I have attempted to save the change by calling up the Macro window, clicking on the Save icon at the bottom and then accepting the Overwrite option to save as "!Macros". On reloading Ovation the button icons were back in their old order.

This is a common problem. In Autorun, you should have a !Macros file, this sets up all the buttons and macros, it controls the order of the buttons, and it is what is saved when you click on Save on the macros window. The trouble starts if you have another file in Autorun which sets up macros. If you do, and that file is executed after !Macros, then you can change !Macros as much as you like, and it won't have an effect. At some point Beebug dished out a file, which they suggested be put in Autorun, set up buttons, and was not called !Macros. Since then this has been fixed, but no doubt copies live on to trip up the unwary.

I often use the facing pages option as means of checking the layout of a double sided document but on my monitor (AKF60) using a resolution of 600 x 800, I find that this is a little difficult without also reducing the Zoom down to 50%. This can be done very easily but it requires 4 clicks of the mouse when one would be preferable.

I made the following simple alteration to the "Facing pages" macro, which enables you to toggle between a single page at 100% and facing pages at 50% with one click of the mouse.

Replace the existing definition of the facingpages macro with the following line.

{if (getfacingpages()==0) setzoom(ZOOM50,0,0);
else setzoom(ZOOM100,0,0);
setfacingpages(!getfacingpages())}
To turn the colour, style and page palettes on and off from the button bar just create buttons with these macros:
{stylepal_entry(0,0)}
{colpal_entry(0,0)}
{pagepal_entry(0,0)}
Q :– I find I can't select, or apply effects to, text which has flowed out of a frame. I need to be able to select everything after a chosen point in the text and reduce its size, font or leading etc..
Define a key macro and for the body have the following.

{int b;b=bmcreate(\"k1\");setbmtocaret(b);bmmove(b,1,4);setzonetobm (b);bmdelete(b);}

That will give you a key press which selects to the end of the current story.

Q :– How exactly do you set up a button in the toolbar to run !Thesaurus?
Hack the !Run file of the thesaurus and bracket the run line at the end with

set thesaurus$running 1

and;

unset thesaurus$running

Then define a macro (for C_T) with the body

{string s="thesaurus$running";if(!getenvs(s)) {osclis("wimptask run <Thesaurus$Dir>.!Run");pause(5)}}{'C_T}

Note: It is necessary that <Thesaurus$Dir> needs to have been defined. To ensure this copy the "Set Thesaurus$Dir <Obey$Dir>" line from the !Run file of the Thesaurus application to its !Boot file also. Either allow the filer to "see" the Thesaurus application before attempting to use the macro, or Filer_Boot the Thesaurus application in your boot sequence.

Q :– Is there a way to define interactive help for user macro buttons added to the toolbar? All the pre-defined macros have help, but I would like to add some for the ones I have created myself.
Yes. Have a look at the !Macros file. For example

defmacro2(0,"select","{picktool(1,0)}","select","Select tool.|MThis is the default tool used to select objects and edit text.");

You can see the help text - the last argument of defmacro2() which is an enhanced version of the original defmacro() function. I suppose it gets complicated because you can't just type the help text into an icon.


navigate.gif - 3804 bytes

Index  |  Applets  |  Templates  |  Resources  |  What's new