I've finished the macros I've been working on.  When I look 
back ,they're not too complicated, but the hard part was finding out 
how to do what I needed to.  It was about as tough for me as learning 
Java when I first started because it takes a while to get used to the 
Basic API and, at least for me, to searching the Wiki and the API docs.

I definitely could not have done this without Andrew's Macro Document.  
Andrew, I'll be ordering a copy of your book in the next week or so.  I 
hope you are still getting royalties on it!  Also all the suggestions 
here have been a HUGE help.

I have two small apps now, so I'll start with the one most people can 
use.  I call it AutoMacro and it's a lot like AutoText, but in this 
case, the fields are saved in the document itself.  In AutoText, the 
abbreviations are global.  While it's called AutoMacro, it will only 
take text, not macro commands.  The entire reason I had to develop this 
is so I could use it in connection with another program.  For a 
refresher, here's what a screenplay looks like:

-------------------
FADE IN:

HAL's study.  Papers piled everywhere.  Hal is exhausted, concentrating 
on writing macros for OpenOffice and in over his head.  The PHONE RINGS 
and he answers.

                                                HAL
                                   (very distracted)
                        Yeah, this is Parker.  It's not my fault,
                        nobody saw me do it, and you can't
                        prove anything.

Hal leans back in his chair as he listens.
--------------------------

Note there are 4 margins used in this script, 1 for the descriptions, 1 
for the character's name when s/he speaks, 1 for simple instructions 
(in the parenthesis), and 1 for the spoken part.

I used to use Amiga-1 through Amiga-4 to set the margins and Amiga-? 
where the ? was any letter I could use (on the Amiga, you had two Amiga 
keys that could work as dead keys/modifier keys), so I might use 
Amiga-H to set it to the margin and type HAL for the character when 
he's about to speak.  If AutoText would allow binding of macros to an 
item, this would not have been necessary for me to write!  (So the bug 
fix will mean I'd have to reprogram a lot!)

Now with AutoMacro, I can define a character or phrase.  When I type 
that phrase, then hit the specified key (I use shift-space), it'll use 
that phrase as a key, pull out a document variable, and replace that 
phrase with the document variable.  So if I specify the key as "H" and 
the text as "HAL" when I type an "H" with a space before it or at the 
start of a line, then hit the key, that "H" will be replaced 
with "HAL".

So far like AutoText, but with two differences: 1) I can store the 
phrases in the document and not globally, and 2) I can easily call this 
from a macro in a way that works for me.  In this case, I have a 
companion macro that I've got keyed to F4.  If I type a 1, 2, 3, or 4, 
then F4, this macro will delete that number and set the margin for me.  
If the character I've just typed is not 1,2,3, or 4, it'll first let 
the AutoMacro macros read the text before the cursor and make its own 
substitution, then it'll change the margin to right one for character 
names.

This lets me use SHIFT-SPACE for any phrases in that particular 
document.  I can still use F3 for any global AutoText phrases, but now 
I can have local ones.  Then I can use F4 to change my margins (I mean 
to change the in/outdent -- I know that's the right term, but I still 
think of it as margins -- old habits die hard) and F4 will also use 
AutoMacro to do any AutoText like substitution.

I seriously considered just having the macros call AutoText, but the 
issue of global vs. local document fields is a serious one.  For 
example, when I actually had an agent, I was dealing with Star Trek.  
If I were writing something for Next Generation, Amiga-D might stand 
for Data, but if I were writing something for Deep Space 9, Amiga-D 
would stand for Dax.  It's the same with film scripts: In one P might 
be short for Parker, in another it might be short for Phillip.  I can 
change them, but if I'm heavily into a script about Phillip and I find 
out something's going on with a script about Parker and I need to 
re-write a few scenes, I'll have to change the P to Parker, along with 
other letters.  Then when I'm done, I'll have to change it back.  With 
local fields stored in the document, that isn't necessary.

I also made it so you can save the AutoMacros from a document in a text 
file and load in a text file as well, so it is possible to transfer 
macros from one document to another.  To use my earlier example, if I 
were hired by Deep Space 9 and were writing more than one script, I 
could export the macros from the first one and use them in all later 
ones.

This was the part that I was asking about polling the keyboard.  I was 
seriously looking at doing something a little different, but it sounded 
like it would be so hard to do, I just gave up and did it this way.



The other mini-app I did was to create the script files for me.  For 
example, if I have a script titled, "Doctor What" that I'm going to 
write, I'll want to create a subdirectory in my writing directory 
named "DoctorWhat" (without the spaces) and the script would 
be "DoctorWhat-FullScript.odt"  I might also want to create files of 
partial scripts so I can work on different parts of the film without 
having to jump around in one huge file.  This set of macros gives me a 
dialog box where I enter the name of the script and it creates the 
directory, loads in a template file, puts the title and my name and 
contact info in the right place and puts the cursor where I will start 
typing, 2 lines below the first "FADE IN:"

It also works with TV scripts and can include a series.  (We're 
considering doing some local work like that.)  It also lets me easily 
create separate files for TV scripts with one act per file, numbering 
them appropriately so one file doesn't overwrite another.


Between the two, the 2nd creates the script files for me.  That's not a 
hard job, but for a senile person like me, it's a pain because I always 
have to double check how far down the title goes and crap like that.  
But it's also nice to have it done automatically, without thinking 
about it and to have my program that creates them just as I want them 
done.  Once I have the script file, I can change margins (or 
in/outdent) with 2 keystrokes and also easily have character names 
typed out for me.

I'm going to be using these programs for a bit to see if they need more 
debugging.  I saw references and links along the way to macro sites.  
I'll probably put them up on my blog where I put the FOSS programs I 
write so they can be downloaded there as well as put them up on the 
macro sites.

If people on this list want to see the code, I'll be glad to post it, 
since this is a developer's list and not just a general usage list.  
(It's not yet commented, though!)  I'd probably have to post it in an 
attachment (if the list allows) to preserve formatting.

Maybe it's some kind of nesting instinct, but it's a LOT easier for me 
to be comfortable and to do my writing with little things like this 
that give me the environment I like to work in and I've been trying to 
get this done for 4-5 years!

Thanks for the help and I hope once I'm sure these are in good shape, 
they'll be useful to others.  I still have a few quirks I'd like to get 
rid of (like can I detect when <enter> is pressed in a text control and 
use that to save the field), but it's working and that's a huge relief.

Hal

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to