From: "Chris Antos (Exchange)"
or if you are just writing a macro (vs. adding something to your .UI
file), try this:
say you write a file "foo.s" that contains only your "mReplace" macro.
you've written a procedure called "mReplace", but you haven't given any
directions about when to run the procedure.
so as Joe said, you could bind it to a key (eg, add a line "
mReplace()" to your foo.s file).
or, you can name your procedure "Main", and then whenever you execute
the "foo.mac" macro file, your "Main" procedure is automatically
started.
//chris
> -----Original Message-----
> From: Joe Souza
> Sent: Thursday, July 10, 1997 12:53 PM
> To: 'tsepro@semware.com'; Smith, Byron
> Subject: RE: help for a beginner
>
> The error received is just a warning. It is telling you (for
> efficiency
> reasons), that you have a macro declared that is never used, e.g. dead
> code. I'm assuming that this is in your UI file, and you want this
> macro to be called whenever you want to replace something. This can
> be
> done by binding it to a keystroke combination, or by adding a new menu
> item that will call the macro. In this example we'll bind it to a
> keystroke combination.
>
> What you need to do is find this line near the end of the UI file:
>
> Replace()
>
> This line tells the editor to call the Replace() function when the
> Ctrl-R keystroke combination is pressed. Change the line so it looks
> like this:
>
> mReplace()
>
> Note the function/macro name is now "mReplace" instead of "Replace".
> You must then rebind the UI file to the editor. This can be done by
> running "SC32 -be32 ui\tse", without the quotes, and replacing
> "ui\tse"
> with the name of your UI file.
>
> After binding the new UI, the editor will call your macro when Ctrl-R
> is
> pressed.
>
>
> > ----------
> > From: Smith, Byron[SMTP:SmithB@nasd.com]
> > Sent: Thursday, July 10, 1997 12:17 PM
> > To: 'tsepro@semware.com'
> > Subject: help for a beginner
> >
> > I am finally making the time to make an attempt at creating a macro.
> > It
> > seemed like it would be simple at first but it is turning out to be
> > quite difficult for me especially since I have not done any
> programing
> > since the days of gwbasic back in the early 80's...
> >
> > Anyway.. I am trying to create a macro that will do a search of a
> > file
> > and replace some pre-defined strings.
> >
> > There is one new string and about 20 old strings that need to be
> > replaced.
> >
> > As an experiment I tried to play around with the example in the TSE
> > Pro
> > Macro ref guide that is used for Replace().
> >
> > My problem is:
> >
> > 1) It doesn't replace anything
> > 2) It compiles with an error I can't find a reference to in the
> > manuals
> > 3) I really stink at Macro Programming.
> >
> > Any help would be appreciated.
> >
> > I am trying to change a piece of text like ABC/RAT to GOAT/EATER.
> >
> > I am using the following Macro source
> >
> > integer proc mReplace()
> > string po[15], npo[15]
> >
> > po = " "
> > npo = " "
> > return(iif (Ask("Search for: ", po) and
> > Ask ("replace with:", npo) ,
> > Replace(po, npo, Query (ReplaceOptions)), FALSE))
> > end
> >
> > I keep getting the following message when I compile or debug the
> macro
> > source:
> > Note 001 (1,14) 'mReplace' declared but never used
> >
> >
> > What does this mean?
> > Is there a better way to do this...
> >
> > any help is appreciated to get me in the right direction.
> >
---
---------------
* Origin: apana>>>>>fidonet [sawasdi.apana.org.au] (3:800/846.13)
|