Jump to content
Macro Express Forums

Output Macro Information format - opinions?


Recommended Posts

I wrote a macro to extract details of every macro in every macro file to Excel. I used the File/Export/Output Macro Information. It worked fine but I did not care for the format. I was only interested in Name, Activation and Scope. The problem was the number of lines used for each.

 

All items:

 

Name: Set Schedule

Icon: (Default)

HotKey: Ctrl+Shift+D

Scope: Window/Program Specific

Macro Express

...followed by macro listing

 

Other macros follow here and below

.

.

 

The problem is with missing fields. For example if you don't have any activation, the line is completely missing. The window/program-specific application only appears, on a new line, where applicable.

 

I would like to see all empty fields filled, either because none exists or not all boxes were checked. By having this format one can key on the Name line and extract the data easily, even if there are endless lines of programming. The line titles like Name:<space> are easily removed. My desired format with blanks filled:

 

Name: None Specified (Not requested)

Icon: (Not requested)

Activation: None Specified (Not requested)

Scope: (Not requested)

Related Program: None (Not requested) [this is Window/Program Specific scope dependent]

Macro Listing: (Not requested)

 

I got round the problem writing a logic macro to transfer the data to an ASCII file and then to Excel. I found another "If" bug in the process but that's another story. Others may prefer the existing format which is nicer for reading and printing. Ideally there would be a checkbox for two formats. Anybody else been using this? How did you handle the data?

Link to comment
Share on other sites

I wrote a macro to extract details of every macro in every macro file to Excel. I used the File/Export/Output Macro Information. It worked fine but I did not care for the format. I was only interested in Name, Activation and Scope. The problem was the number of lines used for each.

Did you try the File / Print Macro List option? It appears to print only the nickname, activation and scope, which happen to be exactly the fields you mentioned? You should be able to print it to a file perhaps?

Link to comment
Share on other sites

I agree with you in that I would rather have an "Activation: None".

..................................................................

But it's a pretty trivial issue really. I have a couple of macro that use the export info, EG one to find the line number of all occurrences of a certain string in all macros, and my solution was to only export the macro name and script. So given it’s a plain text format it would be better to hold a place for the blanks. However the logic should be really simple. In fact I don’t think I would process line by line but rather chew thru it by getting positions of text since the macro script itself contains variable number of lines and would be better to grab at once.

Link to comment
Share on other sites

Re Paul's idea "Print to File". I tried that and it worked to an extent. There were a few snafus however -

Alt+6 came out as A5l ts+e6c followed by the scope and a bunch of garbage characters. The exercise was beneficial as it showed something I had missed. If more than one program is specified in the Scope there will be extra lines. I had assumed one line for all application names.

 

Cory, I don't follow your logic. With missing Activation lines and any number of application names after "Window/Program Specific" you cannot identify what all lines mean.

Name

Scope

can be identified since they always exist and always have that text in the line

 

Activation line may or may not exist and short of interrogating every possibility (Hotkey, Schedule etc) cannot be identified by content

Program name lines can only be associated with a Name by knowing they are lines below the "Window/Program Specific" line and above the blank line that follows

 

My method was to key on the Name line and work down from there until a blank line is reached.

 

Can you explain your logic in more detail?

 

The other possibility I considered was that if the line after Name contained Scope, instead of copying the Scope line to the ASCII file record, I would copy "None" followed by the Scope information. That may have been an easier route and perhaps that is what you were saying Cory. Given the possibility of multiple program name lines I may change to that anyway.

Link to comment
Share on other sites

John there are a dozen different logics that could be applied.

..............................................................

It would depend on exactly what you are trying to do. But here’s a stab at one off the top of me head.

 

You know for a fact the order they appear when all are present, correct? Let’s make a simpler example because I can’t remember the order.

 

Suppose:

Name: Some text.

Scope: Some text.

Activation: Some text.

Macro code: Some text.

 

Copy the contents of file into %source%
Begin a repeat with the counter set to %counter%
Get the position of the colon and save in %position%
Copy text from %source% character 1 to %position% to string %temp%
If %temp% equals "Name:"
 Delete part of text in %source% from character 1 to %position%
 Set %position% to the position of %LF% in %Source%
 Copy text from %source% from character 1 to %position%
 Trim %temp%
 Delete text from %source% from character 1 to %position%
 Copy %temp% to %Name[%counter%]%
Else
 Set %Name[%counter%]% to "None"
Endif
[add 3 more like above for the other labels]
End Repeat

 

The result of this would be 4 arrays for the 4 labels and if there was a missing line it would store “None” but could just as well be left blanks. Now one can use Join String to create a TSV file or whatever you like. But like I say I can think of a few other ways this can be handled but this one is super simple. It just chews thru the string.

Link to comment
Share on other sites

I should have given more examples. The point I was trying to make from the start is that the output from Output Macro Information is totally inconsistent. I wish they were per your last post; that is what I was proposing! Here are the two extremes with Name, Activation, Scope checked:

 

Name: Byte Converter and Download Rate

Scope: Global

................................this is always a blank line

Name: Process output single frame

HotKey: Alt+Shift+G

Scope: Window/Program Specific

VirtualDub

VirtualDubMod

................................this is always a blank line

 

You cannot count lines as such. The only keys you have are Name, Scope and filled lines between Scope and blank line. Logic has to be in place. On my spreadsheet the columns are:

Macro Filename, Macro Name, Activation, Scope, applications (as many columns as needed)

 

I now have working logic. It's quite ugly but the process is not that long with 900+ macros.

Link to comment
Share on other sites

I thought my logic was pretty simple and regardless of your last post I don't see why that concept will not work.

 

Say John cold you reply to the actual message instead of the reply button at the bottom. For us it's easier to tell who you are specifically responding to in Outline View.

Link to comment
Share on other sites

I wrote a macro to extract details of every macro in every macro file to Excel. I used the File/Export/Output Macro Information. It worked fine but I did not care for the format. I was only interested in Name, Activation and Scope. The problem was the number of lines used for each.

Even with the option you used (File/Export/Output Macro Information) you can tick just the columns you want, thereby excluding Script and Icon Path.

 

While you're right in saying that the format is inconsistent (i.e. there are missing lines if there is no data for the label), it would be quite easy to correct this with another macro, wouldn't it? Since each label (Name:, Scope: and Hotkey:) ends with a colon, it shouldn't be too difficult to achieve this.

Link to comment
Share on other sites

I thought my logic was pretty simple and regardless of your last post I don't see why that concept will not work.

 

Say John cold you reply to the actual message instead of the reply button at the bottom. For us it's easier to tell who you are specifically responding to in Outline View.

 

Reply method per request Cory

 

I'm not sure I'm getting through. The text string "Activation:" never appears (not ever, no how) in the listings even if there is a valid activaton. See my last examples. If my comments below don't put some doubts in your mind, could you post the commands for the Activation processing block? I need to see it in black & white.

 

Per your logic, the macro will do the Name line putting the data minus "Name:" into say Name[1] and deleting all of that line from %source%

The next instruction below the Name logic will be to get the position of the next ":" in what remains of %source%

This may be the Activation line. We are apparently hoping to find the ":" in "Activation:" but that string never exists

 

It will find either

The ":" in Scope: if the Activation line is missing or the activation does not end in a ":" such as Schedule

or

The ":" in (say) "HotKey:" if the activation line does exist and contains that parameter

 

In the first case the Activation field will always be set to None, which is fine

In the second case it will set Activation to None because (say) "Hotkey:" was found instead of "Activation:"

 

The Window/Program Specific application fields (VirtualDub and VirtualDubMod in my example) that you did not cover would have to be put in some fields like %Application1[%counter%]%, %Application2[%counter%]% etc. You can extract them because they must follow Scope, and each non-blank line must be another application. You cannot search for the next ":" after Scope because it will find the ":" in the next "Name:" and skip extracting all the applications.

 

I'm positive that this is more problematic than you think. If it's really that easy, try it on one of your listing with various types of Activations. Just the two I posted with a repeat of the two added may do the trick.

 

A minor point, I assume that

Copy text from %source% from character 1 to %position%

should read

Copy text from %source% from character 1 to %position% to %temp%

 

Sorry to drag this out

Link to comment
Share on other sites

Even with the option you used (File/Export/Output Macro Information) you can tick just the columns you want, thereby excluding Script and Icon Path.

 

While you're right in saying that the format is inconsistent (i.e. there are missing lines if there is no data for the label), it would be quite easy to correct this with another macro, wouldn't it? Since each label (Name:, Scope: and Hotkey:) ends with a colon, it shouldn't be too difficult to achieve this.

 

I only check the 3 fields I want (not script and icon)

 

The problem with the Activation line if it even exists is that it may not be HotKey: it may be Schedule (no ":") or any of the other 9 activation possiblities.

 

The Window/Program specific application program lines (VirtualDub and VirtualDubMod in my example) NEVER have a label.

 

My working logic is based on the following:

 

If the Name line is found, it's a new macro listing

If the next line is Scope then Activation is set to None

If the next line is not Scope then there is a valid Activation

If there are non-blank lines after Scope they must be applications

If a blank line is found, that is the end of that macro listing

 

In practice I process the text first to put new lines with "None" where the Activation line is missing.

Then I process a second time extracting the data. Not neat but easier to see what is going on.

 

The essence of the problem is that you can have one or more unlabelled lines which may or may not exist. Another wrinkle I found today is with Macro Names and Hotkeys that have a "," in them. I had to add some lines to encase in quotes for importing the CSV into Excel.

Link to comment
Share on other sites

I only check the 3 fields I want (not script and icon)

 

The problem with the Activation line if it even exists is that it may not be HotKey: it may be Schedule (no ":") or any of the other 9 activation possiblities.

 

The Window/Program specific application program lines (VirtualDub and VirtualDubMod in my example) NEVER have a label.

Yes, having looked at the output more closely, I can see it's a dog's breakfast! I don't suppose this will be given a very high priority by Insight.

Link to comment
Share on other sites

Yes, having looked at the output more closely, I can see it's a dog's breakfast! I don't suppose this will be given a very high priority by Insight.

 

Once I got the thing working fully, it was quite neat to see all the macro information in a compact spreadsheet. I was mostly interested in seeing the distribution of Activation types and which hot keys I used the most across all the macro files. Most popular hotkey for me was "Alt+,". The most frequent activation was "None" and applied to over half my macros.

 

An unexpected bonus was that any oddball macros really stand out. I had one which had 4 window/program specific entries. The most elsewhere was 2 so I looked into why one had 4. It turned out to be a non-issue but nice-to-know.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...