Fighting with selection in macros

Help with writing and playing macros

Fighting with selection in macros

Postby Lars_Sandberg » Sat Jan 13, 2007 4:39 pm

Hi, i'm trying following code in UE 12.20b without luck.
The goal with my macro is to isolate the filename or in other words to delete drive\path

input:
some text "F:\Projects\Long_hole.ide"

Wanted macro output:
some text "Long_hole.ide"

Here is the macro:
InsertMode
ColumnModeOff
HexOff
PerlReOn
Key END
Find Up "\"
StartSelect
Find Up "F:"
EndSelect

I can see that the curser for nano-seconds passes "\" and then stays by "F", however nothing is selected :(
I guess that this is some of the already diskussed "wait for timing" issues with UE.
If i'm wrong here, I would be very happy with some tips :-)

If I in any way can do the same from the userinterface, I could solve my task with Macro Express ( http://www.macros.com/ )
However UE doesn't accept shift down with CRTL-F3 :(

regards Lars
User avatar
Lars_Sandberg
Newbie
 
Posts: 7
Joined: Sat Nov 25, 2006 12:00 am

Re: Fighting with selection in macros

Postby Mofi » Sat Jan 13, 2007 5:06 pm

The solution is to use following: Find Up Select "F:"

You can use the "Find with selection feature" only when holding SHIFT key when pressing the button Find Next in the Find dialog as described in help about Find command. But it cannot be used with CTRL+SHIFT+F3.

In such cases where only the file name is needed it is best not to use CopyFilePath with a following Paste and some code to delete the path.

Easier is to create ONCE a template with content [FILE_NAME][FILE_EXTENSION] and use the macro command Template x to insert the current file name with extension only.

See for example How to Add the time and date automatically to log files how to create a template.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4066
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Fighting with selection in macros

Postby Lars_Sandberg » Sat Jan 13, 2007 8:31 pm

Hi Mofi, thanks again I solved my task, with help from your tip :-)
regards Lars
User avatar
Lars_Sandberg
Newbie
 
Posts: 7
Joined: Sat Nov 25, 2006 12:00 am


Return to Macros

cron