FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   Add to FavoritesAdd to Favorites  * Code Snippets
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    RSS Get RSS Feed  


Edit file for Keywords setup
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Macro Scheduler and Windows Automation Forum Index -> Beginners
View previous topic :: View next topic  
Author Message
mo
Junior Coder


Joined: 21 Aug 2003
Posts: 49

Reputation: 100

PostPosted: Sun Aug 31, 2003 2:57 am    Post subject: Edit file for Keywords setup Reply with quote

Hello,

I have put on hold for the moment my attempt to get the Ad-aware macro working. However, attempting to convert this little script from a recorded macro to all keystrokes, which should be possible (I am using TextPad), is looking very much like the problems I am having with the Ad-aware macro.

I have annotated the script as best as I understand, and would appreciate the word of an experienced eye as to what may be going wrong here:

====================================



========================
_________________
Best Wishes!
mo

Did this message help you? If so please reward the poster with Reputation Points? Reward Points
Back to top
View user's profile Send private message
Bob Hansen
Automation Wizard


Joined: 24 Sep 2002
Posts: 2448
Location: Salem, New Hampshire, US
Reputation: 300
votes: 17

PostPosted: Sun Aug 31, 2003 5:27 am    Post subject: Reply with quote

I have copied your script and will look at it when I can.

Can you submit a sample or a portion of the "edit4keywords_temp.txt" file that you are trying to parse and save?

Do you want to start Macro Scheduler macro after TP is opened with file loaded? OR
Do you want Macro Scheduler macro to open TP and load the file, process and save the text file, and then Stop the Macro fpr you to do additional work, or pause the macro and restart by itself after some condition is met?

"Further routines" can most likely be done by Macro Scheduler also vs. TP.
But let's get this part settled first..................

Stay tuned................

Did this message help you? If so please reward the poster with Reputation Points? Reward Points
Back to top
View user's profile Send private message Visit poster's website
Bob Hansen
Automation Wizard


Joined: 24 Sep 2002
Posts: 2448
Location: Salem, New Hampshire, US
Reputation: 300
votes: 17

PostPosted: Sun Aug 31, 2003 5:43 am    Post subject: Reply with quote

My copy of TextPad did not have the macros loaded for "Delete Blank Lines" or for "Strip Tags" so I added them to my Macro Listing.

But I cannot find any reference to "'Remove all air''. Is this a macro that you created or downloaded? Can you point me to a source for the macro file, or provide a copy?

You might also consider using Macro Scheduler to do the TP macros. That way you can edit them, pause them, have more overall control. Perhaps not with this script, but keep it in mind for future.

Also, what version of TP are you using? I am using 4.7.0. I have not loaded 4.7.1 yet. Despite the initial words of praise with the beta version, I am waiting to see more responses to the final realease that just happened. Any special configuration settings I need to know about to simulate your copy?

I can do most of this without waiting for answers, but the info would help provide a more accurate and sensible solution.

Thanks....................
Bob

Did this message help you? If so please reward the poster with Reputation Points? Reward Points
Back to top
View user's profile Send private message Visit poster's website
Lumumba
Guest






PostPosted: Sun Aug 31, 2003 8:03 am    Post subject: Reply with quote

For those who don't use an editor like TextPad or UltraEdit:

You don't have to eliminate HTML Tags if you paste a text copied from a web page to notepad (a plain ASCII editor).

---

The CommandLine Commando (to be used with MScheds Run Program>)

The CommandLine Commando is the first release of a growing collection of FreeWare Utilities for Windows 9X/NT.

These utilities include many filters and other text processing commands as well as file and text search utilities.

The WIN9X/NT filters
--------------------

Trim | trim trailing blanks from each line in a file.

Onespace | removes extra blank lines from a file.

Basename | gets basename from filename.
Decho | echoes standard input to screen (great for debugging).
Dict | puts each word of a file onto a separate line.
Lcase | translate all uppercase characters to lowercase.
Numbey | number all the lines in a file.
Pad | pad each line in a file to a fixed length.
Strip | create comments file from a c source code file.
Sub | replace one string with another throughout a file.
Sum | add columns of numbers from a redirected file.
Truncate | truncates a line at first matching char (or space).
Ucase | translate all lowercase characters to uppercase.
Uniq | deletes multiple occurances from a sorted list.
Untab | expand all tabs in a file to blanks.
Unws | translate a wordstar document to plain text.
Xtodos | translate Unix text or Apple Text to DOS text.

The WIN9X/NT "almost filters" and utilities
-------------------------------------------

Bingrep | a grep (text search) for binary files.
Ffeed | reads a filespec and sends files to standard output.
Grabasc | a tsr ascii text screen capture utility.
Hexval | create character arrays from binary files.
Idiff | compare 2 textfiles and report differences.
Igrep | a grep (text search) for text files.
Longtext | remove wordwrap from textfiles (DOS to Windows Text).
Mloc | count lines in text files and report totals.
Modeget | get video mode.
Modeset | set video mode.
Newfiles | create list of files modified after specified date.
Pipecon | pipe the console to a diskfile.
Touch | modify file dates and times.
Txt2pcx | convert ascii text to monochrome .PCX image.
Unfeed | undo a lumped file created by ffeed into single files.
Whereis | search the harddisk for files specified.
Which | search the environment for the specified file.
Wraptext | add wordwrap to textfiles (Windows to DOS Text).
Yesno | batchfile extension to allow yes/no questions.[/b]

Did this message help you? If so please reward the poster with Reputation Points? Reward Points
Back to top
mo
Junior Coder


Joined: 21 Aug 2003
Posts: 49

Reputation: 100

PostPosted: Sun Aug 31, 2003 11:23 am    Post subject: Reply with quote

OK, Here goes!

TextPad 4.7.1, on W2KPro, ANSI, PC, default setup using word-wrap, Save with no breaks in lines, strip trailing spaces when saving, syntax highlighting

1. Here is a sample bit of representative of the text being copied and pasted (there is often an additional several paragraphs of discussion etc, but this section has the tabs that need to be removed).
The objective is to end up with a file that can be edited down to the important words found on that page. This is not copied from the web, this is copied off the file opened in TextPad.
====================================================


==========================================================

2. The macro you are missing can be found at:

http://www.textpad.com/add-ons/macros.html
under "Reformating" and is called parajoin and has several macros in the package. The one you want is 'remoair' -- installed it is listed as rem&oair with the title "remove all 'air'".

I think this one is better than the remove blank lines macro for this case.

A little further into the game I will most likely use MS to create my own macros, but for now I need to keep this as simple as possible ... which may be making it more complicated!

============================================================

Quote:
Do you want to start Macro Scheduler macro after TP is opened with file loaded? OR
Do you want Macro Scheduler macro to open TP and load the file, process and save the text file, and then Stop the Macro fpr you to do additional work, or pause the macro and restart by itself after some condition is met?


1. Yes I want to start MS after TP is opened with file loaded and the bit to be edited already copied to the clipboard.
2. Then I want MS to open a new page and paste from the clipboard (I don't want it working on the opened file directly ... obvious, but just to be clear.)
3. The follow up notes were really to myself as I don't expect anyone to be writing my whole script and I had not looked up any part of what was involved in: halting the MS macro temporarily to allow me to do some work on the file, restarting the macro to perform some other routines, possibly doing this stop/start thing several times.

(My background is in computerized phototypesetting ... worked in a publishing house in NY that used the first phototypesetting machine at Kingsport Press (Tenn), (size of a large room) then had my own setup (size of a large desk) and was put out of business by these infernal things they called Apples! (size of a TV) that could do the job, and do it almost as well (quality of final type has never caught up with the Kingsport version). Point being, that these early machines had keys setup where we could set up little routines, pause them, add data, restart them, etc., and I have never found a way to do that on the computer...and MS looks like the way.)
_________________
Best Wishes!
mo

Did this message help you? If so please reward the poster with Reputation Points? Reward Points
Back to top
View user's profile Send private message
Bob Hansen
Automation Wizard


Joined: 24 Sep 2002
Posts: 2448
Location: Salem, New Hampshire, US
Reputation: 300
votes: 17

PostPosted: Sun Aug 31, 2003 6:35 pm    Post subject: Reply with quote

Got the macro package, thanks.......
Did this message help you? If so please reward the poster with Reputation Points? Reward Points
Back to top
View user's profile Send private message Visit poster's website
Bob Hansen
Automation Wizard


Joined: 24 Sep 2002
Posts: 2448
Location: Salem, New Hampshire, US
Reputation: 300
votes: 17

PostPosted: Mon Sep 01, 2003 2:15 am    Post subject: Reply with quote

Just finished my modifications of your macro. Used all keystrokes, no mouse movements. Results from your sample are shown here:

Quote:
In the context of the Satipatthana Sutta:
Pali
MO
Nyanasatta Thera
Soma Thera
Hare
Horner
Punnaji
Nanamoli/ Bodhi
T. W. and C.A.F. Rhys Davids
Thanissaro
Walshe
Woodward
dhamma
Dhamma (the Word), thing, object
mental objects
mental objects
mental objects
thought
mind-objects
ideas
mental qualities
mind-objects


If this looks right, I will submit my version for your review. Process ran instantly, TextPad is still open waiting to be used.

Hope this is what you wanted...................good luck,
Bob

Did this message help you? If so please reward the poster with Reputation Points? Reward Points
Back to top
View user's profile Send private message Visit poster's website
mo
Junior Coder


Joined: 21 Aug 2003
Posts: 49

Reputation: 100

PostPosted: Mon Sep 01, 2003 5:45 pm    Post subject: Reply with quote

Bob,

This looks right. Sorry if this reply is late, somehow I got logged out and it didn't look like there was any response here when I gave it periodic quick checks.

I would like to see what you have done.
_________________
Best Wishes!
mo

Did this message help you? If so please reward the poster with Reputation Points? Reward Points
Back to top
View user's profile Send private message
Bob Hansen
Automation Wizard


Joined: 24 Sep 2002
Posts: 2448
Location: Salem, New Hampshire, US
Reputation: 300
votes: 17

PostPosted: Mon Sep 01, 2003 9:00 pm    Post subject: Reply with quote

Hi mo......

Here is my modified version of your script:
Quote:

//edit4keywords.0.0001.scp
//Saturday, August 30, 2003 3:48 PM
//Created by mo mikeolds@buddhadust.org
//Takes copied text from html formatted pages; pastes to new file;
//moves all copy to the left margin; removes all html tags (using
//TextPad Macro 'Strip Tags'); removes all blank lines(using TextPad
//Macro 'Delete Blank Lines'); removes all extra spaces(using
//TextPad Macro 'Remove all'air''); saves the file as
//F:\Program Files\MacroScheduler\Macro Scheduler
//Pro\bin\edit4keywords_temp.txt (replacing previous save)
//
Label>BobNotes
//Use Main Menu and keystrokes to activate macros vs. Mouse Moves.
//Can use ALT-M and up/down arrows, but macro will not always be in same menu position, so make ALT keys for TP macros.
//In TextPad, make ALT Key for macros. In Configure, Preferences, Macros:
//Highlight the macro name, click on Properties. In the filed for display Name, enter "&" (without the quotes) before the key for ALT action.
//For "Delete all lines" change to "&Delete all lines, use ALT-MD.
//For "Strip tags", change to "&Strip tags", use ALT-MS
//Remove "air" already has ALT-o as an option. Use ALT-Mo.
//Note TP sensitivity to Case with ALT/CTRL macro commands.


//Variables
//
Let>WW_TIMEOUT=5
Let>WindowName=TextPad*
Let>FileName=E:\All Webs\Buddha Dust\BuddhaDust\backmatter\glossology\edit4keywords_temp.txt

//Need here:
//How to start the Macro Focused On the Active Document in TextPad,
//?SetFocus>%WindowName%
//?Press CTRL
//?Wait>0.5
//?Send>fn
//?Wait>0.5
//?Release CTRL
//?Wait>0.5
//?Open a New File
//Run program and wait for it to be active

Change Directory>F:\Program Files\TextPad 4
Run Program>F:\Program Files\TextPad 4\TextPad.exe
WaitWindowOpen>%WindowName%
SetFocus>%WindowName%
Wait>1

//Paste from Clipboard
Press CTRL
Send>v
Release CTRL

//Select All
Press CTRL
//Changed to Upper Case, TP can be sensitive to Case
Send>A

Release CTRL

//Move All to Left Margin (4 back tabs)
Press Shift
Press Tab *4

//Go to Beginning of First Line of text.
//This works in a recorded macro, but doing it with
//keystrokes only it does not go to the beginning of
//the first line, it selects the first line.
//I think this is the source of the problems with
//the first macro, as it need the cursor to be at
//the beginning of the first line.
//Note that single stepping MS macros with ALT/CTRL commands may give unexpected results. I have found that I sometimes need to go to controlled application and manaully enter the ALT-CTRL commands. But this code does work OK in running macro.
Press CTRL
Press Home
Release CTRL

//Run TP 'Strip Tags' Macro Ctl+T (or t)
Press ALT
Send>MS
Release ALT
//My keyboard is set for CTL-T to do "Edit Transpose", not to run "Strip Tags"


//Go to Beginning of First Line of text
Press CTRL
Press Home
Release CTRL

//Run TP 'Remove Blank Lines' Macro Ctl+Q (or q) This appears to be
//redundant with the 'remove air' macro But it didn't work this way:
//My modifications include both macros because I did not understand your needs, and running both may not be redundant. That would be your call.
Press ALT
Send>MD
Release ALT
//My keyboard is set for CTL-Q to do "undefined", not to run "Delete Blank Lines"


//Go to Beginning of First Line of text
Press CTRL
Press Home
Release CTRL

//Run TP 'Remove 'air'' Macro Ctl+W (or w) This doesnt work this way:
Press ALT
Send>Mo
Release ALT
//My keyboard is set for CTL-W to do "Word Right", not to run "Remove Air"


//Save As 'edit4keywords_temp.txt
Press F12
WaitWindowOpen>Save As*
Send>%FileName%
Press Enter
//Replace existing file
Press Left
Press Enter
WaitWindowClosed>Save As*


//Need here:
//1. Exit MacroScheduler (not Textpad File);
//2. Pause MacroScheduler to allow editing of file, then continue with
//further routines: Sort list, pause to remove duplicates, run search
//and replace to add commas to the end of each word, run search and
//replace to delete double commas at the end of each word, sort again,
//join all words (CTRL+SHIFT+J), backspace twice to place cursor at
//the end of the line and remove the final comma, select all, copy,
//terminate script, close %FileName%


It looks like you are getting a handle on Macro scheduler now. The major changes I introduced for you were using Keyboard vs. Mouse. Also, my past experience with TP and its sensitivity to ALT/CTRL keys in macros. Wait> is usually not needed, but can be inserted as needed to fine tune "race conditions". Whenever I see that need, it is usually after Press ALT/CTRL and Send> Commands.

Thanks also for the TP macro scripts in parajoin.zip. Gerrit Kears did a good job of documenting his TP macros in the readme files. You could cut/paste them into Macro Scheduler. Then change the syntax as needed to eliminate calling the TP macros.

Hope this was helpful......................good luck,
Bob

Did this message help you? If so please reward the poster with Reputation Points? Reward Points
Back to top
View user's profile Send private message Visit poster's website
mo
Junior Coder


Joined: 21 Aug 2003
Posts: 49

Reputation: 100

PostPosted: Mon Sep 01, 2003 9:19 pm    Post subject: Reply with quote

Thanks Bob,

I'll get right to work on this...let you know when I mess up the next step!

For the strip tags, there is a regex that should do it, but my regex know-how is about as strong as my scripting know-how...

Find < select to next > and delete (delete I can manage).
_________________
Best Wishes!
mo

Did this message help you? If so please reward the poster with Reputation Points? Reward Points
Back to top
View user's profile Send private message
Bob Hansen
Automation Wizard


Joined: 24 Sep 2002
Posts: 2448
Location: Salem, New Hampshire, US
Reputation: 300
votes: 17

PostPosted: Mon Sep 01, 2003 10:00 pm    Post subject: Reply with quote

I started self teaching myself on Reg Ex this past year. I now find myslef answering questions for others on this subject, but still have a lot to learn.

Excellent book is "Regular Expressions", 2nd edition, by Jeffrey Friedl, published by O'Reilly Press, copyright 2002, about $40.

Opens up a whole new world of Search methods. Be sure not to get the earlier edition.

Did this message help you? If so please reward the poster with Reputation Points? Reward Points
Back to top
View user's profile Send private message Visit poster's website
mo
Junior Coder


Joined: 21 Aug 2003
Posts: 49

Reputation: 100

PostPosted: Mon Sep 01, 2003 11:11 pm    Post subject: INTERMEDIATE RESULTS Reply with quote

Hello Bob,

After a few blunders I have managed to get this to work with a couple of changes and one question.

I am embarased to ask the question! But in your instructions for setting up ALT keys for TextPad Macros, you say

Quote:
Highlight the macro name, click on Properties. In the filed for display Name, enter "&" (without the quotes) before the key for ALT action.
//For "Delete all lines" change to "&Delete all lines, use ALT-MD.


Which I can read (and have tried) two ways: as changing the name to read:

Remove Blank Lines,ALT-MD
or
Remove Bland (Blank!...that would be some useful macro!) Lines,use ALT-MD

The current working version is using the latter, much to my astonishment, but I am wondering if that is just because TextPad is being nice and ignoring my "use"; and if the times I used it the other way didn't work because of other reasons.

The other thing is that I could not get the file to save using your file saving code, and reverted to the one I had previously.

I also stripped out all the comments as they were starting to get me crazy.

99% your code; works just like that! [snap fingers] (tried it twice on some much more complicated test material than I posted for you):

=========================================


===================================
_________________
Best Wishes!
mo

Did this message help you? If so please reward the poster with Reputation Points? Reward Points
Back to top
View user's profile Send private message
mo
Junior Coder


Joined: 21 Aug 2003
Posts: 49

Reputation: 100

PostPosted: Mon Sep 01, 2003 11:58 pm    Post subject: Reply with quote

Well I messed with the TextPad settings and it seems that it really doesn't make any difference, but to be on the safe side I set all three of the macros to

macroname,[space]ALT-XX

Now for some reason the above script no longer works if I use both the Delete Blank Lines and the Remove all 'air' macros. The script works, it just does not remove blank lines. The Remove all Air Macro seems to be the badguy here (most likely something to do with my fiddling in TextPad, but I don't know what I did)...and the script does what I need without 'Remove all 'air' (opposite to previous notation).

I'm getting punchy here so if there are any bright ideas, I will consider them...in a bit.
_________________
Best Wishes!
mo

Did this message help you? If so please reward the poster with Reputation Points? Reward Points
Back to top
View user's profile Send private message
mo
Junior Coder


Joined: 21 Aug 2003
Posts: 49

Reputation: 100

PostPosted: Tue Sep 02, 2003 12:28 am    Post subject: Reply with quote

This is the script to date with the now-relevant comments edited and re-inserted.

I have used it several more times, and without the "Remove all 'air'" macro, it works fine for what I am trying to do. Why that macro doesn't work is still a mystery.

Here is the script:

==========================


====================================
_________________
Best Wishes!
mo

Did this message help you? If so please reward the poster with Reputation Points? Reward Points
Back to top
View user's profile Send private message
mo
Junior Coder


Joined: 21 Aug 2003
Posts: 49

Reputation: 100

PostPosted: Tue Sep 02, 2003 12:50 am    Post subject: Reply with quote

OK, one more glitch: This thing is working for me 2 out of three times, sometimes every other time...the other times it is not deleting blank lines, but is otherwise running without hanging the machine, stopping, etc.

I thougt it might be something to do with CapsOff but inserting it in the usual place or taking it out doesn't seem to make a difference.

This may have been what was happening with the "Remove all 'air'" macro...that is, that it worked a couple of times for me and then stopped working and I thought that was the problem.

I also thought it might have had to do with using the same test copy over and over, sometimes not fully starting from scratch, i.e., just hitting CTRL+C to copy the material. Not this.

This may be a TextPad problem, or it may be my computer...or it may be the script...


EDIT: This is beginning to feel like a computer memory problem: now the thing is not moving the text to the left, is stripping off tags, is not removing blank lines.

I tried rebooting. No change. This is W2KPro with 1G of RAM I'm not supposed to have memory problems (I did a memtest recently!)

THIRD EDIT: Now it's working perfectly again! Likely culpret seems to be the computer. But what happened with this message with no proper line breaks? Not that way in the edit box?
_________________
Best Wishes!
mo

Did this message help you? If so please reward the poster with Reputation Points? Reward Points
Back to top
View user's profile Send private message
Display posts from previous:    View previous topic :: View next topic  
Post new topic   Reply to topic    Macro Scheduler and Windows Automation Forum Index -> Beginners All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group