Cut & paste +FindReg works only in ~80%

Help with writing and playing macros

Cut & paste +FindReg works only in ~80%

Postby Jogi_cgn » Thu Dec 07, 2006 12:05 pm

Hi all,

my search via RegEx with Cut and paste in the same file works not correctly.

my source is text like this
"
foo, bar (barfoo@company.com)
Mind, Mister (mistermind@company.com)
else, someone (someoneelse@company.com)
..."

I'm interested in the "loginname" RegEx: ([a-z,0-9]+@
The selection is allways correct. e.g. (foobar@ ...

My macro then should (!) cut the hit, move to the end of textfile via "Bottom", paste the hit and from top, search again.

But often the selected text is not cut but only copied...

So if you run the following macro on the source above, with some repetitions, you'll see some doubled pastings at the end of file.

This results in not cutting the hit out of the "source" ...
Am I wrong anywhere in my mind, or is there a problem with the macro-interpreter or the execution?

Thanks a lot for your help.
regards
joerg

PS: The two quotes results of hitting Enter after pasting.. but you know this for sure - I'm just new in these macros ;-)

The macro is:

InsertMode
ColumnModeOff
HexOff
UnixReOff
Find RegExp PreserveCase "([a-z,0-9]+@"
Cut
Bottom
Paste
"
"
Top
User avatar
Jogi_cgn
Newbie
 
Posts: 2
Joined: Thu Dec 07, 2006 12:00 am

Re: Cut & paste +FindReg works only in ~80%

Postby Mofi » Thu Dec 07, 2006 12:43 pm

Find option PreserveCase is only for a following replace. So it should be removed here.

In the regular expression string the comma , means that a comma character can be part of the string as letters and numbers. I think, that's not correct and you only need [a-z0-9]+ .

I could not reproduce the effect you described on your example with UE v11.20b.

However, here is an improved version of your macro which finds all names between ( and @ and pastes it line by line into a new file with a single macro execution.

The macro property Continue if a Find with Replace not found must be checked for this macro.

InsertMode
ColumnModeOff
HexOff
UnixReOff
Top
Clipboard 9
ClearClipboard
Loop
Find RegExp "(*@"
IfFound
CopyAppend
Else
ExitLoop
EndIf
EndLoop
NewFile
UnicodeToASCII
UnixMacToDos
Paste
Top
Find "("
Replace All ""
Find "@"
Replace All "^p"
ClearClipboard
Clipboard 0
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4062
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Cut & paste +FindReg works only in ~80%

Postby Jogi_cgn » Fri Dec 08, 2006 9:14 am

Hi Mofi,
thanks a lot for the quick response.

Now please sit down I'll tell you what happend;-)...

You can believe the following; my diploma in applied computer science didn't come to my by christmas....;-)

The facts:
- the macro didn't run on my machine with version 11.20
- updated to 12.20 - didn't run either.

Computer's uptime is actually 7 days. Running XP Prof (Enterprise Licensed). Fully patched by Enterprise solution. McAfee Enterprise 8.0 (turned on /off - no differerence).
Also running (and open in parallel) MS Outlook, Firefox, Windows Powershell, Netware Aministrator (yes, Novell available too), Total Commander, MS DesktopSearch, MS SMS (SystemManagementService) a.s.o.

Now the Chrismas Wonder:
From Home in the evening, I connected per MSTSC* to the Computer (at work) to check without McAfee to have a good sleep ;-).
And my bad macro ran correctly! Without failures...
Even with turned on McAfee (<- the candidate for some strange errors - sometimes).

This morning, back here. Checked again MSTSC from the second PC on same switch. Runs OK also...
But with failures on the PC itself!
That was reproduceable every time via MSTSC and directly on the pc...

Following colleagues' advice to close all other (FF, Outlook, DosBox, Netware, PShell a.s.o.). UEdit was the only app. running.

Till then, the macro is working correctly... I can't reproduce errors any more.
Doesn't care if on the machine itself, or via MSTSC. no failures.


So I can now check your macro too. Some stuff in it is new for me. Didn't know the loops available. thanks.

Actually, after your macro ran I have to open a new tab to paste the stuff.
In the clipboard, the results are includes the "(" and "@", but I'll make the best out of the two.

So I'm grateful for the initial aid.
I think we'll meet here again.

Nice Weekend and best regards.
Joerg

---------
greetings from cologne ! :-)

*MS TerminalServices
User avatar
Jogi_cgn
Newbie
 
Posts: 2
Joined: Thu Dec 07, 2006 12:00 am

Re: Cut & paste +FindReg works only in ~80%

Postby Mofi » Fri Dec 08, 2006 10:07 am

Jogi_cgn wrote:Actually, after your macro ran I have to open a new tab to paste the stuff.
In the clipboard, the results are includes the "(" and "@", but I'll make the best out of the two.

Glad to read that the problem was caused by too high CPU usage of an other application for too long time. Maybe the DOS program in the DOS box.

My macro already opens a new file tab, deletes all ( and replaces all @ to a line break.

If this does not happen on your computer, you have not checked the macro property Continue if a Find with Replace not found and so the macro exits immediately when the searched string is not found anymore instead of exiting the loop and do the commands till end of the macro. Open Macro - Delete Macros/Modify Properties and check the property with the not good name because it should be named Continue if a Find not found.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4062
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna


Return to Macros