sample macro request

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
astudent
Posts: 5
Joined: Mon Sep 15, 2003 11:00 pm

sample macro request

Post by astudent »

Since text editing TEXTPAD macros doesn't seem to be an obvious option, can someone offer some examples of controlling Textpad via DDE from Rexx/Perl/VB scripts or I suppose Java(I'm clueless about Java)?

Specifically I am trying to extract all keys/values for a product from a REGEDIT exported text file for a specific product to use as backup and later import. Using some regular expression searchs in a macro to bound the [HKEY to ^$ and copy append and paste to another file does sort of work but the repeated typing and resetting of the search box is error prone in my hands.
User avatar
Bob Hansen
Posts: 1516
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post by Bob Hansen »

I can't help with the following as a solution.
controlling Textpad via DDE from Rexx/Perl/VB scripts or I suppose Java
But I can offer another solution instead. I would be using Macro Scheduler to do that.

Macro Scheduler has a built in function to read and write to the Registry, or from a file like the REGEDIT file. So you could use that to extract the key values. You can also Macro Scheduler to pass multiple variables into fields in another program. So you can read the Registry files to get your key values, save them as variables, open up TextPad, Open Search/Replace, and paste the variables/keys from the earlier steps into the fields for Find and Replace, etc. Return to Macro Scheduler, read next line, repeat until EOF. Or something like that.


Too many features to detail here. Macro Scheduler is available at:
http://www.mjtnet.com/index.htm?ef=rmha ... rg_2644641
astudent
Posts: 5
Joined: Mon Sep 15, 2003 11:00 pm

sample macro request

Post by astudent »

I'll be happy to look at the macro scheduler but perhaps I did not clarify that I do not know the KEYS in question. What I am doing is using Textpad (in a sense) find the PRODUCT name within a key, then bounding the from the preceeding [HKEY to the next empty line and copying this result to a new file. My initial impression of the macro scheduler is that it assumes I must already know the key names.
User avatar
Bob Hansen
Posts: 1516
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post by Bob Hansen »

This is tough to do without a better understanding, but I will take a stab at it. It sounds like you know the Product Name. If that is the case, you could set up the macro to read lines looking for the Product Name. If the Product Name did exist, you would skip that line of the file and proceed to the next line. Only when you found a line with the Product Name would anything be processed. You could also set the the beginning of the macro to prompt you for the Product Name so you could use this routine for multiple products, it would not have to be hard coded. Or, if you wanted to hardcode it, that is possible too.

But rather than jumping to Macro Scheduler, if you provided a more specific example of "before" and "after" situations, showing excerpts from the actual files, we might be able to do what you want in TextPad by itself. I think we just need a better explanation of what you are trying to do.

Staying tuned............
astudent
Posts: 5
Joined: Mon Sep 15, 2003 11:00 pm

sample macro request

Post by astudent »

1. Understand how to Textpad edit a Textpad macro file, perhaps one written in Perl/Rexx whatever perhaps driving Textpad through DDE in the sense of z/OS/ISPF edit/Rexx edit macros or W2000/THE/Regina edit macros or W2000/Emacs/Perl.
2 Understand some general concepts of editing in Textpad.
3. Specific instance.
REGEDIT export the registry to a txt(OLDSYS) file and Textpad this file turning off line wrap.
Find all instances of the word ACROBAT(PRODUCTA).
In a Winnt4 REGEDIT export (OLDSYS) each instance will be bounded by [HKEY followed by an empty line.
Select each of these instances--including the empty line and paste all such instances into another txt file (NEWSYS).
With some caveats you may then be able to import the contents into another registry.
The specific instance is having one processor, multiple disks, 2 distinct Windows environments. BIOS boot from one disk for your standard system and produce OLDSYS and NEWSYS.Then BIOS boot from an alternate disk with the new target opsys.
Since both systems have access to the same disks (drive letters change), you want to run ProductA in each environment without a re-installation on the new target opsys. So, you need to update the registry on the new target opsys with contents from the standard system by importing NEWSYS in the registry of the target opsys. Well, perhap--other complications exist.
I've created the macro to read OLDSYS and produce NEWSYS, but it was an error prone, painful process which cannot be easily shared with anyone else, and, more to the point, the result has no documentation value for me personally. And I cannot produce a script to illustrate/replicate the simple case problem that find regex ^$ up fails, that find regex ^$ down fails if executed on second execution. Nor can I easily document the use of a keystroke to continue the extended collection which made this possible.

Perhaps there exists something about the Java environment to accomplish this driving of TextPad?
Post Reply