Using MS in TextPad

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
mo
Junior Coder
Posts: 49
Joined: Thu Aug 21, 2003 11:02 pm

Using MS in TextPad

Post by mo » Fri Aug 22, 2003 12:36 pm

Hello,

Reading about this product over on the TextPad Forum, I downloaded a copy.

I would really like to know how to use this tool to create/run macros in an open TextPad file.

I know next to nothing about writing macros (I can use a macro recorder) or scripts and would appreciate any links to HOW TOs that may already exist.

At this time the only way I am able to use the thing with TextPad is by copying a file and pasting it into a new document that is opened by MS...i.e., I can't figure out how to get it to run from within an open TextPad file.

I have MS set up as a tool in TextPad...maybe do not have the settings correct.

Cross posting this in the TextPad Forum.
Best Wishes!
mo

Lumumba

Post by Lumumba » Fri Aug 22, 2003 3:20 pm

Maybe you should get in contact with Bob Hansen (check the forum for one of his postings/polls). As I remember he's the one who has asked for the TextPad syntax highlighting conf file (or was it Armstrong aka armsys?) !

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Fri Aug 22, 2003 6:31 pm

Hi,

To run your macro from within TextPad create a new Tool. Go into Configure/Preferences. Under Tools click 'Add'. Select 'Program...' and browse to Macro Scheduler and select your script file (change the file type box from Programs to all files). This is now set up under Tools and when you click on it your script runs (assuming you allowed the Macro Scheduler installer to assign default file associations).

Alternatively select msched.exe and then apply and then modify the properties of the tool and enter your macro name or script file in the Parameters section.

By default it puts $File in the parameters section. This is actually quite cool but not what you want. What this will do is RUN your TextPad document! This is fine if you want to use TextPad as a script editor. In fact it is very useful. Well worth making a tool to do this in fact as then you have the option of creating scripts in textpad and running them with Macro Scheduler.

So you have two ways to run macros from within TextPad and a cool way to have Macro Scheduler run scripts you create in textpad.

As for examples of TextPad related macros - the problem is it depends what you want to do. There are an infinite number of things you might want to automate when it comes to text file manipulation, and everyone's needs are different. But I would suggest, as I do to all Macro Scheduler Newbies, that you read the Getting Started Guide in the help/manual, check out the scripts & tips at http://www.mjtnet.com/scripts.hts and ask questions here. And I would second Lumumba's point about getting in touch with Bob Hansen - he's the TextPad guru around here.
MJT Net Support
[email protected]

mo
Junior Coder
Posts: 49
Joined: Thu Aug 21, 2003 11:02 pm

Post by mo » Fri Aug 22, 2003 10:18 pm

Thank you for this comprehensive response.

I see what I did was your second suggestion: it was trying to run my html files!

So what you are saying is that I must set up a new Tool for every Macro I create to use in TextPad. OK. This far I understand.

What I had thought I would be able to do is to create macros from within TextPad (like your "open this program first" business, but by way of clicking on a tool.

I have read the help file and did browse the tips and scripts section...I thought there might be something a little more detailed.

I believe Mr. Hansen also is very helpful on the TextPad forum, and I welcome any advise he may offer...
Best Wishes!
mo

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Sat Aug 23, 2003 6:46 pm

Hi mo.....

Macro Scheduler can be used to run TextPad. Here is an excerpt from a Macro Scheduler script (can be edited) that is used to open TextPad and open a file that is downloaded weekly from an ftp site. I then call a TextPad macro that parses the file and saves it. I then close TextPad when the parsed file has been saved. The values in %...% are variables and can be defined and changed anywhere in the macro script. Lines with \\ are comment lines. (Be sure to remove all unwanted trailing spaces on a line).

Macro Scheculer script:
==========================
\\User Defined Variables

\\Get date values from system
Month>mm
Day>dd
Year>yyyy

//Define weekly ftp file
Let>ftpfilename=105%mm%%dd%%yyyy%

\\Define working directory
Let>WorkDir=c:\Data\Downloads

\\Start TextPad and open weekly file
Run Program>c:\program files\textpad 4\textpad.exe "%WorkDir%\%ftpfilename%.txt"
Wait>5

//Call Macro to Run. Cannot enter macro name, must use first letter, arrows, enter.
Press Alt
Send Character/Text>M
Release Alt

//Macro name = FTP TO QA. Go to "F", then move arrows to FTP TO QA
Send Character/Text>F
Press Down
Press Down
Press Enter

Label>Parsing
//Loop until TextPad macro is done parsing file. Runs from 10-200 seconds.
IfFileExists>d:\data\qa4\bumed\db\105%mm%%dd%%yyyy%.asc,CloseTextPad
Message>File not parsed yet, in process....
Wait>15
Goto>Parsing

Label>CloseTextPad
//Close TextPad Program
WaitWindowOpen>TextPad*
WaitReady>3

Press ALT
Send Character/Text>F
Release ALT
Send Character/Text>X
Wait>3

Goto>NextProcess
==============================
The steps in the TextPad macro could also have been done with Macro Scheduler but I had already created the macro in TextPad previously. I may convert the TextPad macro to Macro Scheduler in the future, but it works now, so no pressure to change. The only problem is that that TextPad macro cannot be edited, but the Macro Scheduler version is easy to edit, looks like normal programming text, and has built in editor tools, syntax highlighting. But it is a macro and scheduling tool, not a text editor. Each program has its own specific specialties. Combined together they make a terrific combination.

I will also post this in the TestPad forum....

Hope this helps,
Bob

mo
Junior Coder
Posts: 49
Joined: Thu Aug 21, 2003 11:02 pm

Post by mo » Sat Aug 23, 2003 7:48 pm

Again, thanks Bob, can I say this:

Anything you can do twice,
I can do twice as good as you!
Best Wishes!
mo

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts