[Open] Watch List sorting for command created variables

Ideas for new features & functions

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
jpuziano
Automation Wizard
Posts: 1085
Joined: Sat Oct 30, 2004 12:00 am

[Open] Watch List sorting for command created variables

Post by jpuziano » Fri Oct 09, 2009 10:55 pm

Hi Marcus,

In reference to your answer to JRL's post here: Separate> Suggestion (resolved)(RegEx solution)

I ran the code you supplied:
a command that creates variables, VAR_1, Var_2, etc. wrote:RegEx>.,String1%CRLF%String2,0,var,var_count,0
and here's the variables created as shown in the Watch List. Note that ~ below represents either CR or LF:
unsorted wrote:VAR_6=g
VAR_5=n
VAR_8=~
VAR_7=1
VAR_2=t
VAR_1=S
VAR_4=i
VAR_3=r
VAR_9=~
VAR_15=g
VAR_14=n
VAR_COUNT=16
VAR_16=2
VAR_11=t
VAR_10=S
VAR_13=i
VAR_12=r
I wanted to see if each character was captured so to get a better view, I right-clicked on the Watch list and used the Sort function. Now the variables looked like this:
sorted wrote:VAR_1=S
VAR_10=S
VAR_11=t
VAR_12=r
VAR_13=i
VAR_14=n
VAR_15=g
VAR_16=2
VAR_2=t
VAR_3=r
VAR_4=i
VAR_5=n
VAR_6=g
VAR_7=1
VAR_8=~
VAR_9=~
VAR_COUNT=16
That's better but still mixed around somewhat.

Would it be possible, at least for the variables created by MS commands like Separate, Regex, etc., to have them appear like this in the Watch List when we click Sort:
an improved sort function might have wrote:VAR_1=S
VAR_2=t
VAR_3=r
VAR_4=i
VAR_5=n
VAR_6=g
VAR_7=1
VAR_8=~
VAR_9=~
VAR_10=S
VAR_11=t
VAR_12=r
VAR_13=i
VAR_14=n
VAR_15=g
VAR_16=2
VAR_COUNT=16
Possible? Impossible? Outrageous? Your thoughts?
jpuziano

Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post - :-)

gdyvig
Automation Wizard
Posts: 447
Joined: Fri Jun 27, 2008 7:57 pm
Location: Seattle, WA

Post by gdyvig » Sat Oct 10, 2009 3:00 am

Hi jpuziano,

Looks possible if the command does the VAR_COUNT before it starts writing out the variables. Sorting will work if you know how many leading zeroes to supply. Maybe an arbitrary large number of leading zeroes for a reasonable worst case.
VAR_01=S
VAR_02=t
VAR_03=r
VAR_04=i
VAR_05=n
VAR_06=g
VAR_07=1
VAR_08=~
VAR_09=~
VAR_10=S
VAR_11=t
VAR_12=r
VAR_13=i
VAR_14=n
VAR_15=g
VAR_16=2
VAR_COUNT=16
Gale

User avatar
jpuziano
Automation Wizard
Posts: 1085
Joined: Sat Oct 30, 2004 12:00 am

Post by jpuziano » Sun Oct 11, 2009 12:52 am

gdyvig wrote:Looks possible if the command does the VAR_COUNT before it starts writing out the variables.
Hi Gale,

Thanks for your post. Using that sort of solution, in this case, it would know there are 16 values and therefore, one leading zero is required and it would name the created variables accordingly.

The benefit there is, no changes to the sort function would be required as the leading zeros would make the sort come out right.

The problem with that solution is that it is not backwards compatible with code already written. For example, elsewhere in the code, I refer to the variable as VAR_1 because I know it will ALWAYS be named VAR_1. If it occasionally named it VAR_01 or VAR_001, that would break code that is looking for VAR_1 so I don't think that approach would be well received.

And yes, I know I could programatically check for the existance of VAR_1 and if not found, check for VAR_01 and if not found... on and on... but I'd certainly rather not.

On the other hand, a more intelligent sort would not break any existing code.

Marcus, can the Watch List sort routine be enhanced so that it displays these numbered variables (created by certain MS commands) in numerically ascending order?
jpuziano

Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post - :-)

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Jan 18, 2010 8:28 am

If the watch list is NOT sorted, the variables are listed in the order of creation, based on time. If it IS sorted they are alphabetically sorted, and the list above is correct.

I don't really see another way to do it, though on the (much) longer term I would like to create "proper" array type variables, and then the watch list would just show VAR_ and allow you to expand it to see the elements in the right order. But this is not imminent.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
jpuziano
Automation Wizard
Posts: 1085
Joined: Sat Oct 30, 2004 12:00 am

Post by jpuziano » Mon Jan 18, 2010 4:54 pm

OK, fair enough, thanks for the reply.
jpuziano

Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post - :-)

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