Macro doesn't restore initial settings

Help with writing and playing macros

Macro doesn't restore initial settings

Postby plastic » Fri Oct 12, 2007 2:18 pm

Hello,

I use Unix Regex syntax with my searches in UE. However, for a particular macro, I found the UltraEdit Regex syntax easier, so I add a UnixReOff at the beginning.

I thought those settings, as InsertMode, ColumnMode and HexMode were used to make sure a macro could run, whatever settings the user currently use, and thus the setting were reverted automatically

Yet each time I use this macro, my settings are left with UltraEdit Regex syntax, and I have to change manually...
Is there a way to restore my settings automatically ?

Regards,
plastic
User avatar
plastic
Newbie
 
Posts: 8
Joined: Wed Mar 07, 2007 12:00 am

Re: Macro doesn't restore initial settings

Postby Mofi » Fri Oct 12, 2007 2:53 pm

I'm afraid not. I requested 2 macro commands to save current environment and restore it per email on Feb. 2006, but it looks like I was alone with that wish.

In the script environment since v13.10 it is possible to get an info about insert mode on/off and hex mode on/off at start of the script, remember it in variables and restore the modes at the end of the scripts accordingly.

Whether in the script nor in the macro environment the status of column mode or which regular expression is currently active can be determind and later restored.

However, for your macro there is a simple solution as I always write when I post a macro which uses UltraEdit regular expressions.

Add UnixReOn or PerlReOn (v12+ of UE) at the end of the macro if you do not use UltraEdit style regular expressions by default - see search configuration.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4066
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Macro doesn't restore initial settings

Postby plastic » Tue Oct 16, 2007 11:25 am

Too bad, if I ever change my mind in the future (this could happen), I would have to remember to change ALL my macros !

For someone as lazy as me, this seems quite inelegant...

Thanks for your reply anyways :)

Regards,
plastic
User avatar
plastic
Newbie
 
Posts: 8
Joined: Wed Mar 07, 2007 12:00 am

Re: Macro doesn't restore initial settings

Postby mrainey56 » Tue Oct 16, 2007 12:58 pm

Make a configuration macro that specifies all the default macro settings as you like them, then add a PlayMacro command at the end of each of your existing macros to run it and reinstate the settings.

A small bit of work up front (you're not THAT lazy), only one macro to maintain when you want to change your default macro settings in the future.
User avatar
mrainey56
Master
Master
 
Posts: 212
Joined: Tue Jul 27, 2004 11:00 pm
Location: Spartanburg, South Carolina

Re: Macro doesn't restore initial settings

Postby plastic » Wed Oct 31, 2007 9:19 am

I have to say that's quite the good idea, I wish I'd think of it by myself !

Regards,
plastic
User avatar
plastic
Newbie
 
Posts: 8
Joined: Wed Mar 07, 2007 12:00 am


Return to Macros