Jump to content
Macro Express Forums

Script management


Recommended Posts

I recently developed an insane script of about 4,000 lines (ca. 80 pages) converting abstruse musical input code into a completely different language. I will make a video of that at some point and post it on YouTube.

 

Anyway: of course, I use text boxes as stops copiously to debug my scripts. I wish there were a preference setting with which to color code certain items; I color code all my text boxes dark blue background, bright yellow text font. Annoying to have to do that individually each time.

 

In a script of 4,000 lines, it is often necessary to activate a bunch of text boxes to find out where the error occurs. When a text box finally displays a faulty message, I know that somewhere before that text box, the error occurs. In a script of thousands of lines, and multiple text boxes displaying, how to you know where that particular text box is located?

 

I have come to put line numbers at the top of all my debugging text boxes. But when the code then changes (additions or deletions), those line numbers are then off.

 

Can you all confirm that, in fact, there is no way to put some kind of integer variable into a text box that identifies the line number of the text box? I think that would be cool to have.

 

Cheers.

Link to comment
Share on other sites

I don't think there's a way to get the line number.

 

I never have this problem because I avoid writing any long macros. My macros tend to be no more than a couple visible pages and I create a multitude of sub-macros for distinct functions. It also helps keep the variables manageable. I also will log the entrance to each of these with some information. "Starting file upload" and at the end "File uploaded in X seconds". Of course for X and other variables, I will put them in the log file So the log file entry might be "Uploading c:\users\cory\somefile.txt". I also log errors. 

 

Have you explored all the debug features? Why don't you use breakpoints? I've helped many people in the past and they come up with all these strange ways of keeping track of what is happening when they could be using built in tools. Like the "Log Messages" feature or the Show Variables window.

Link to comment
Share on other sites

Like Cory, I prefer to write lots of trace information to the log file.  For example, you could break up your code into logical sections, numbered sequentially.  Put a comment line at the beginning of each section, containing the section number.  Right after the section-number comment, write a generic "entering section xxxx" trace message to the log file.  Also include the section number in each of the error text box displays so you will know right where it failed. 

 

For normal operation vs. a debugging situation, you can turn the trace logging on and off.  Just define a variable -- TRACE for example -- at the beginning of the macro and set its value to zero (no trace) or one (trace).  Then at the beginning of each numbered section, the logic would be:

IF TRACE = 1 WRITE SECTION NUMBER TO LOG FILE ENDIF

You could do the same to activate/deactivate the diagnostic text boxes:

IF TRACE = 1 DISPLAY TEXT BOX ENDIF

When you need to debug (or not), simply change the single line at the start of the macro setting TRACE to 1 or 0.  Lots easier than going through thousands of lines of code activating or deactivating logging commands and text box displays.  It takes some initial effort to set it all up, but in the long run you will save effort. 

 

Link to comment
Share on other sites

19 hours ago, MakaPakaTobyHannah said:

I wish there were a preference setting with which to color code certain items; I color code all my text boxes dark blue background, bright yellow text font. Annoying to have to do that individually each time.

 

No need to repeat these repetitive steps. Write a macro!

 

Here is the MEP script I use to change the background colour of selected lines to yellow. As I read through the code, I don't remember why the line to "unfurl" the Edit menu is there. I've been using the macro for years, and my guess is that the line is superfluous. But you can test that yourself!

 

Anyways, you can adapt the script to format or set Macro Express instructions anyway you like.

 

Text Type (Simulate Keystrokes): <ALT>e // Activate &Edit menu
Delay: 100 milliseconds
Text Type (Simulate Keystrokes): <ARROW UP><ARROW DOWN> // Unfurl menu...
Text Type (Simulate Keystrokes): <END> // Go to last item on menu
Repeat Start (Repeat 6 times) // Select "Background Color"
  Text Type (Simulate Keystrokes): <ARROW UP>
End Repeat
Text Type (Simulate Keystrokes): <ENTER>
Wait for Window Title: Color
Text Type (Simulate Keystrokes): <HOME> // Go to top left corner...
Text Type (Simulate Keystrokes): <ARROW RIGHT> // Navigate to Yellow
Text Type (Simulate Keystrokes): <SPACE> // Select Yellow
Text Type (Simulate Keystrokes): <ENTER> // Done!


<TEXT TYPE Action="0" Text="<ALT>e" _COMMENT="Activate &Edit menu"/>
<DELAY Flags="\x02" Time="100"/>
<TEXT TYPE Action="0" Text="<ARROW UP><ARROW DOWN>" _COMMENT="Unfurl menu..."/>
<TEXT TYPE Action="0" Text="<END>" _COMMENT="Go to last item on menu"/>
<REPEAT START Start="1" Step="1" Count="6" Save="FALSE" _COMMENT="Select \"Background Color\""/>
<TEXT TYPE Action="0" Text="<ARROW UP>"/>
<END REPEAT/>
<TEXT TYPE Action="0" Text="<ENTER>"/>
<WAIT FOR WINDOW TITLE Title="Color" Partial="FALSE" Wildcards="FALSE" Indefinite="FALSE" Hours="0" Minutes="0" Seconds="2"/>
<TEXT TYPE Action="0" Text="<HOME>" _COMMENT="Go to top left corner..."/>
<TEXT TYPE Action="0" Text="<ARROW RIGHT>" _COMMENT="Navigate to Yellow"/>
<TEXT TYPE Action="0" Text="<SPACE>" _COMMENT="Select Yellow" _BACK="0080FFFF"/>
<TEXT TYPE Action="0" Text="<ENTER>" _COMMENT="Done!"/>

 

Link to comment
Share on other sites

Conditional formatting to colorize lines of code based on different properties would be pretty cool.  I thought maybe saving snippets would work too, but that doesn't seem to retain the colors.  Maybe Acantor's script could be adapted to look for properties (like whether the line of code is a message box.)

Link to comment
Share on other sites

6 hours ago, kunkel321 said:

Maybe Acantor's script could be adapted to look for properties (like whether the line of code is a message box.)

 

The script can be adapted. Select a line in an MEP script and this script will report if it's a Text Type, If Variable, Message Box, or Comment

Clipboard Copy
Delay: 100 milliseconds
Variable Set String %x% from the clipboard contents
 
If Variable %x% Contains "<TEXT TYPE"
  Text Box Display: This line is a Type Text!
End If
 
If Variable %x% Contains "<IF VARIABLE"
  Text Box Display: This line is an If Variable!
End If
 
If Variable %x% Contains "<MESSAGEBOX"
  Text Box Display: This line is a Message Box!
End If
 
If Variable %x% Contains "<COMMENT"
  Text Box Display: This line is a Comment!
End If
 
 
// TEST LINES
// Check the ability to check the content of an MEP instruction by selecting one of these four lines, then running this macro.
MessageBox: Testing
Text Type (Simulate Keystrokes): 
If Variable %x% Contains "<IF VARIABLE"

  
<CLIPBOARD COPY/>
<DELAY Flags="\x02" Time="100"/>
<VARIABLE SET STRING Option="\x02" Destination="%x%" NoEmbeddedVars="FALSE"/>
<COMMENT/>
<IF VARIABLE Variable="%x%" Condition="\x06" Value="<TEXT TYPE" IgnoreCase="FALSE"/>
<TEXT BOX DISPLAY Title="This line is a Type Text!" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
<END IF/>
<COMMENT/>
<IF VARIABLE Variable="%x%" Condition="\x06" Value="<IF VARIABLE" IgnoreCase="FALSE"/>
<TEXT BOX DISPLAY Title="This line is an If Variable!" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
<END IF/>
<COMMENT/>
<IF VARIABLE Variable="%x%" Condition="\x06" Value="<MESSAGEBOX" IgnoreCase="FALSE"/>
<TEXT BOX DISPLAY Title="This line is a Message Box!" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
<END IF/>
<COMMENT/>
<IF VARIABLE Variable="%x%" Condition="\x06" Value="<COMMENT" IgnoreCase="FALSE"/>
<TEXT BOX DISPLAY Title="This line is a Comment!" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
<END IF/>
<COMMENT/>
<COMMENT/>
<COMMENT Value="TEST LINES"/>
<COMMENT Value="Check the ability to check the content of an MEP instruction by selecting one of these four lines, then running this macro." _BACK="0080FFFF"/>
<MESSAGEBOX Caption="Testing" Message="%x%" Icon="0" _ENABLED="FALSE" _BACK="0080FFFF"/>
<TEXT TYPE Action="0" _ENABLED="FALSE" _BACK="0080FFFF"/>
<IF VARIABLE Variable="%x%" Condition="\x06" Value="<IF VARIABLE" IgnoreCase="FALSE" _ENABLED="FALSE" _BACK="0080FFFF"/>
Link to comment
Share on other sites

1 hour ago, acantor said:

 

The script can be adapted. Select a line in an MEP script and this script will report if it's a Text Type, If Variable, Message Box, or Comment

 

It does indeed!

Link to comment
Share on other sites

For fun I tried to combine Acantor's two scripts (code box below).  

WARNING -- It doesn't stop looping at the end like it's supposed to.  

It's supposed to ...

Set clipboard to %currLine% at the start of the loop,

then set %prevLine% to %currLine% at the end.

And keep looping until prevLine = currLine.  

So once the last line is checked twice in a row, they should be the same.. 

 

It think that logic is correct(???)

 

Anyway, the coloring part works (there has to be a message box and/or comment for it to do anything).   Assign a hotkey to the macro, then open your other macro (that you want to color) and click on line 1, then do the hotkey. 

 

Note:  Acantor's "If %x%" macro above looks to 4 different things.  I only used 2 of them....  I guess in theory a person could colorize as many different types of things as they wanted.  If you had a bunch though, it would probably be good to have most of that code in a different macro, then call it with the main macro.  Maybe(?)   

 


 

Repeat Until %currLine% Equals "prevLine"
  Clipboard Copy
  Delay: 100 milliseconds
  Variable Set String %currLine% from the clipboard contents
   
  If Variable %currLine% Contains "<MESSAGEBOX"
    Text Type (Simulate Keystrokes): <ALT>e // Activate &Edit menu
    Delay: 100 milliseconds
    Text Type (Simulate Keystrokes): <END> // Go to last item on menu
    Repeat Start (Repeat 6 times) // Select "Background Color"
      Text Type (Simulate Keystrokes): <ARROW UP>
    End Repeat
    Text Type (Simulate Keystrokes): <ENTER>
    Wait for Window Title: Color
    Text Type (Simulate Keystrokes): <HOME> // Go to top left corner...
    Text Type (Simulate Keystrokes): <ARROW RIGHT> // Navigate to Yellow
    Text Type (Simulate Keystrokes): <SPACE> // Select Yellow
    Text Type (Simulate Keystrokes): <ENTER> // Done!
  End If
   
  If Variable %currLine% Contains "<COMMENT"
    Text Type (Simulate Keystrokes): <ALT>e // Activate &Edit menu
    Delay: 100 milliseconds
    Text Type (Simulate Keystrokes): <END> // Go to last item on menu
    Repeat Start (Repeat 6 times) // Select "Background Color"
      Text Type (Simulate Keystrokes): <ARROW UP>
    End Repeat
    Text Type (Simulate Keystrokes): <ENTER>
    Wait for Window Title: Color
    Text Type (Simulate Keystrokes): <HOME> // Go to top left corner...
    Text Type (Simulate Keystrokes): <ARROW RIGHT><ARROW RIGHT> // Navigate to Green
    Text Type (Simulate Keystrokes): <SPACE> // Select Yellow
    Text Type (Simulate Keystrokes): <ENTER> // Done!
  End If
   
  Variable Set String %prevLine% to "%currLine%"
  Text Type (Simulate Keystrokes): <ARROW DOWN> // Down to next line of code.
End Repeat
MessageBox: All lines checked.

 

<REPEAT UNTIL Variable="%currLine%" Condition="\x00" Value="prevLine"/>
<CLIPBOARD COPY/>
<DELAY Flags="\x02" Time="100"/>
<VARIABLE SET STRING Option="\x02" Destination="%currLine%" NoEmbeddedVars="FALSE"/>
<COMMENT/>
<IF VARIABLE Variable="%currLine%" Condition="\x06" Value="<MESSAGEBOX" IgnoreCase="FALSE"/>
<TEXT TYPE Action="0" Text="<ALT>e" _COMMENT="Activate &Edit menu"/>
<DELAY Flags="\x02" Time="100"/>
<TEXT TYPE Action="0" Text="<END>" _COMMENT="Go to last item on menu"/>
<REPEAT START Start="1" Step="1" Count="6" Save="FALSE" _COMMENT="Select \"Background Color\""/>
<TEXT TYPE Action="0" Text="<ARROW UP>"/>
<END REPEAT/>
<TEXT TYPE Action="0" Text="<ENTER>"/>
<WAIT FOR WINDOW TITLE Title="Color" Partial="FALSE" Wildcards="FALSE" Indefinite="FALSE" Hours="0" Minutes="0" Seconds="2"/>
<TEXT TYPE Action="0" Text="<HOME>" _COMMENT="Go to top left corner..."/>
<TEXT TYPE Action="0" Text="<ARROW RIGHT>" _COMMENT="Navigate to Yellow"/>
<TEXT TYPE Action="0" Text="<SPACE>" _COMMENT="Select Yellow"/>
<TEXT TYPE Action="0" Text="<ENTER>" _COMMENT="Done!"/>
<END IF/>
<COMMENT/>
<IF VARIABLE Variable="%currLine%" Condition="\x06" Value="<COMMENT" IgnoreCase="FALSE"/>
<TEXT TYPE Action="0" Text="<ALT>e" _COMMENT="Activate &Edit menu"/>
<DELAY Flags="\x02" Time="100"/>
<TEXT TYPE Action="0" Text="<END>" _COMMENT="Go to last item on menu"/>
<REPEAT START Start="1" Step="1" Count="6" Save="FALSE" _COMMENT="Select \"Background Color\""/>
<TEXT TYPE Action="0" Text="<ARROW UP>"/>
<END REPEAT/>
<TEXT TYPE Action="0" Text="<ENTER>"/>
<WAIT FOR WINDOW TITLE Title="Color" Partial="FALSE" Wildcards="FALSE" Indefinite="FALSE" Hours="0" Minutes="0" Seconds="2"/>
<TEXT TYPE Action="0" Text="<HOME>" _COMMENT="Go to top left corner..."/>
<TEXT TYPE Action="0" Text="<ARROW RIGHT><ARROW RIGHT>" _COMMENT="Navigate to Green"/>
<TEXT TYPE Action="0" Text="<SPACE>" _COMMENT="Select Yellow"/>
<TEXT TYPE Action="0" Text="<ENTER>" _COMMENT="Done!"/>
<END IF/>
<COMMENT/>
<VARIABLE SET STRING Option="\x00" Destination="%prevLine%" Value="%currLine%" NoEmbeddedVars="FALSE"/>
<TEXT TYPE Action="0" Text="<ARROW DOWN>" _COMMENT="Down to next line of code."/>
<END REPEAT/>
<MESSAGEBOX Caption="All lines checked." Message="All lines checked." Icon="0"/>

 

 

EDIT LATER....

There were missing %% on the "Repeat until" command.  

I fixed that, but it's still not working correctly. 

 

 

Link to comment
Share on other sites

10 hours ago, acantor said:

The reason the script isn't working is that there is no code to select the current line. You need to do something like this:

 

<HOME><SHIFT><END> to select the line before copying it to the clipboard

 

I played with this a bit and came up with a slightly different approach. Kunkel321’s approach didn’t work because it stayed in an infinite loop. Also, I haven’t inspected this, but I think in theory it’s possible that prevLine = currLine, and this appears somewhere within the script (not just at the end). In that case, the process would abort.

 

So I thought, let’s start by copying the entire script to the clipboard. Assign that to a variable. Then, count all carriage returns and line feeds. That will tell you how many lines there actually are in the script. Use that counter variable for set a repeat loop. When the repeat loop is done, you’re at the end of the script.

 

I have tested this now, and it works just fine on my system. Definitely NOT sexy! I would think it would be better to modify the script code directly for the color coding, rather than navigating through menus. I didn’t attempt that (yet). I did notice that, because the script contained variable definitions (apparently), the "trim" command failed, as apparently the script attempt to locate those variables. So I opted for replacing all % signs with PLACEHOLDER to circumvent that problem. Perhaps someone here can enlighten me how to deal with that issue (it’s come up for me before).

 

Anyway, here is my script now; would love to know if it works for you. This is just set up at the moment to highlight text boxes dark blue background, bright yellow text font. Here it is:

 

<VARIABLE SET TO ASCII CHAR Value="13" Destination="%T13%" _COMMENT="assign carriage return to %T13%"/>
<VARIABLE SET TO ASCII CHAR Value="10" Destination="%T10%" _COMMENT="assign line feed to %T10%"/>
<VARIABLE SET STRING Option="\x00" Destination="%CRLF%" Value="%T13%%T10%" NoEmbeddedVars="FALSE"/>
<KEYSTROKE SPEED Delay="16"/>
<TEXT TYPE Action="0" Text="<CONTROL>a"/>
<CLIPBOARD COPY/>
<VARIABLE SET STRING Option="\x02" Destination="%scriptToClipboard%" NoEmbeddedVars="FALSE"/>
<VARIABLE MODIFY STRING Option="\x0F" Destination="%scriptToClipboard%" ToReplace="%" ReplaceWith="PLACEHOLDER" All="TRUE" IgnoreCase="FALSE" NoEmbeddedVars="FALSE"/>
<VARIABLE MODIFY STRING Option="\x00" Destination="%scriptToClipboard%"/>
<REPEAT UNTIL Variable="%scriptToClipboard%" Condition="\x07" Value="%CRLF%"/>
<VARIABLE MODIFY STRING Option="\x0F" Destination="%scriptToClipboard%" ToReplace="%CRLF%" ReplaceWith="BunnyRabbit" All="FALSE" IgnoreCase="FALSE" NoEmbeddedVars="FALSE"/>
<VARIABLE MODIFY INTEGER Option="\x07" Destination="%counter%"/>
<END REPEAT/>
<VARIABLE MODIFY INTEGER Option="\x01" Destination="%counter%" Value1="%counter%" Value2="2"/>
<VARIABLE MODIFY STRING Option="\x0F" Destination="%scriptToClipboard%" ToReplace="BunnyRabbit" ReplaceWith="BunnyRabbit%CRLF%" All="TRUE" IgnoreCase="FALSE" NoEmbeddedVars="FALSE"/>
<TEXT BOX DISPLAY Title="This is the complete script" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 There are %counter% lines\\f1 \r\n\\par %scriptToClipboard%\r\n\\par }\r\n" Left="Left" Top="Center" Width="1921" Height="592" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0" _ENABLED="FALSE"/>
<TEXT TYPE Action="0" Text="<HOME>"/>
<CLIPBOARD COPY/>
<VARIABLE SET STRING Option="\x02" Destination="%x%" NoEmbeddedVars="FALSE"/>
<IF VARIABLE Variable="%x%" Condition="\x06" Value="<TEXT BOX DISPLAY" IgnoreCase="FALSE"/>
<TEXT BOX DISPLAY Title="This line is a text box!" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0" _ENABLED="FALSE"/>
<TEXT TYPE Action="0" Text="<ALT>e"/>
<DELAY Flags="\x02" Time="100"/>
<TEXT TYPE Action="0" Text="<END>"/>
<REPEAT START Start="1" Step="1" Count="6" Save="FALSE"/>
<TEXT TYPE Action="0" Text="<ARROW UP>"/>
<END REPEAT/>
<TEXT TYPE Action="0" Text="<ENTER>"/>
<WAIT FOR WINDOW TITLE Title="Color" Partial="FALSE" Wildcards="FALSE" Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/>
<TEXT TYPE Action="0" Text="<HOME><ARROW RIGHT><ARROW RIGHT><ARROW RIGHT><ARROW RIGHT><ARROW DOWN><ARROW DOWN><ARROW DOWN><SPACE><ENTER>"/>
<DELAY Flags="\x02" Time="100"/>
<TEXT TYPE Action="0" Text="<ALT>e"/>
<DELAY Flags="\x02" Time="100"/>
<TEXT TYPE Action="0" Text="<END>"/>
<REPEAT START Start="1" Step="1" Count="7" Save="FALSE"/>
<TEXT TYPE Action="0" Text="<ARROW UP>"/>
<END REPEAT/>
<TEXT TYPE Action="0" Text="<ENTER>"/>
<WAIT FOR WINDOW TITLE Title="Color" Partial="FALSE" Wildcards="FALSE" Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/>
<TEXT TYPE Action="0" Text="<HOME><ARROW RIGHT><ARROW DOWN><SPACE><ENTER>"/>
<END IF/>
<REPEAT START Start="1" Step="1" Count="%counter%" Save="FALSE"/>
<TEXT TYPE Action="0" Text="<ARROW DOWN>"/>
<CLIPBOARD COPY/>
<VARIABLE SET STRING Option="\x02" Destination="%x%" NoEmbeddedVars="FALSE"/>
<IF VARIABLE Variable="%x%" Condition="\x06" Value="<TEXT BOX DISPLAY" IgnoreCase="FALSE"/>
<TEXT BOX DISPLAY Title="This line is a text box!" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0" _ENABLED="FALSE"/>
<TEXT TYPE Action="0" Text="<ALT>e"/>
<DELAY Flags="\x02" Time="100"/>
<TEXT TYPE Action="0" Text="<END>"/>
<REPEAT START Start="1" Step="1" Count="6" Save="FALSE"/>
<TEXT TYPE Action="0" Text="<ARROW UP>"/>
<END REPEAT/>
<TEXT TYPE Action="0" Text="<ENTER>"/>
<WAIT FOR WINDOW TITLE Title="Color" Partial="FALSE" Wildcards="FALSE" Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/>
<TEXT TYPE Action="0" Text="<HOME><ARROW RIGHT><ARROW RIGHT><ARROW RIGHT><ARROW RIGHT><ARROW DOWN><ARROW DOWN><ARROW DOWN><SPACE><ENTER>"/>
<DELAY Flags="\x02" Time="100"/>
<TEXT TYPE Action="0" Text="<ALT>e"/>
<DELAY Flags="\x02" Time="100"/>
<TEXT TYPE Action="0" Text="<END>"/>
<REPEAT START Start="1" Step="1" Count="7" Save="FALSE"/>
<TEXT TYPE Action="0" Text="<ARROW UP>"/>
<END REPEAT/>
<TEXT TYPE Action="0" Text="<ENTER>"/>
<WAIT FOR WINDOW TITLE Title="Color" Partial="FALSE" Wildcards="FALSE" Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/>
<TEXT TYPE Action="0" Text="<HOME><ARROW RIGHT><ARROW DOWN><SPACE><ENTER>"/>
<END IF/>
<END REPEAT/>
<TEXT BOX DISPLAY Title="Done" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\qc\\b\\f0\\fs20 Finished!\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="181" Height="112" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
<MACRO STOP/>
<COMMENT Value="Stuff below this kept here for reference."/>
<CLIPBOARD COPY/>
<DELAY Flags="\x02" Time="100"/>
<VARIABLE SET STRING Option="\x02" Destination="%x%" NoEmbeddedVars="FALSE"/>
<COMMENT/>
<IF VARIABLE Variable="%x%" Condition="\x06" Value="<TEXT TYPE" IgnoreCase="FALSE"/>
<TEXT BOX DISPLAY Title="This line is a Type Text!" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
<END IF/>
<COMMENT/>
<IF VARIABLE Variable="%x%" Condition="\x06" Value="<IF VARIABLE" IgnoreCase="FALSE"/>
<TEXT BOX DISPLAY Title="This line is an If Variable!" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
<END IF/>
<COMMENT/>
<IF VARIABLE Variable="%x%" Condition="\x06" Value="<MESSAGEBOX" IgnoreCase="FALSE"/>
<TEXT BOX DISPLAY Title="This line is a Message Box!" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
<END IF/>
<COMMENT/>
<IF VARIABLE Variable="%x%" Condition="\x06" Value="<COMMENT" IgnoreCase="FALSE"/>
<TEXT BOX DISPLAY Title="This line is a Comment!" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
<END IF/>
<IF VARIABLE Variable="%x%" Condition="\x06" Value="<TEXT BOX DISPLAY" IgnoreCase="FALSE"/>
<TEXT BOX DISPLAY Title="This line is a text box!" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
<END IF/>
<COMMENT Value="TEST LINES"/>
<COMMENT Value="Check the ability to check the content of an MEP instruction by selecting one of these four lines, then running this macro."/>
 

Link to comment
Share on other sites

13 hours ago, acantor said:

The reason the script isn't working is that there is no code to select the current line. You need to do something like this:

 

<HOME><SHIFT><END> to select the line before copying it to the clipboard

 

Are you sure this is right Acantor?  If I navigate manually, I can just do <down arrow> then <ctrl>c, and it copies the line of code to the clipboard.  

 

Link to comment
Share on other sites

On 2/29/2020 at 5:44 PM, acantor said:

Here is the MEP script I use to change the background colour of selected lines to yellow

 

Hi Alan,

 

This command caused failure for me:

Wait for Window Title: Color

That has me fascinated, especially as I see that you personally spell 'colour' the same as I do!

 

Is your version of MEP indeed AmericaniZed in that way?

 

Using 6.1.3.1 here, and your macro works fine when I use the correct spelling 🙂

 

Terry

 

 

Link to comment
Share on other sites

Terry,

 

Do you mean that this is what is working?

 

Wait for Window Title "Colour"

 

I don't think this would work for me, as the text of the MEP window title is "Color" not "Colour"!

 

The instruction is actually not 100% necessary. The script should be reliable enough by substituting a short delay for a wait for window instruction.

Link to comment
Share on other sites

On 3/3/2020 at 9:15 AM, acantor said:

When you press the arrow key to navigate to a line of text, does pressing Ctrl + c copy the entire line to the clipboard without the need to select the line?

 

I think so(?)  Here's a quick screencast.

https://www.screencast.com/t/9zClrYOvVC

 

EDIT: In the screencast I click on the top line, then arrow-down, then ctrl+c, then ctrl+v.  The clipboard contents are shown in the Ditto clipboard extender.

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...
×
×
  • Create New...