Jump to content
Macro Express Forums

Run Macro in Variable and Text Type Paste Rich Text incompatible?

Recommended Posts

Hey everyone,


I noticed that when I use a Text Type - Paste Rich Text command via the Run Macro in Variable command, I get syntax errors.



<TEXT TYPE Action="3" Text="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1031{\\fonttbl{\\f0\\fnil\\fcharset0 Courier New;}{\\f1\\fnil Courier New;}}\r\n{\\colortbl ;\\red0\\green128\\blue0;}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 fqwe\r\n\\par tr\r\n\\par \\cf1\\b\\fs44 qg\r\n\\par as\r\n\\par g\r\n\\par asd\\fs20 \r\n\\par g\r\n\\par w\\cf0\\b0 \r\n\\par qw\r\n\\par rz\r\n\\par ezrte\\f1 \r\n\\par }\r\n"/>


throws a syntax error, while any other type like Use Clipboard and Paste Text works fine



<TEXT TYPE Action="1" Text="fqwe\r\ntr\r\nqg\r\nas\r\ng\r\nasd\r\ng\r\nw\r\nqw\r\nrz\r\nezrte"/>


The Rich Text one runs just fine when not run with Run Macro in Variable.

Do I have to edit something manually in the direct code or is Text Type - Paste Rich Text just incompatible with Run Macro in Variable? Haven't had this issue with any other command I used so far.

Link to comment
Share on other sites

I want to make sure I understand...


1. You have written a script that includes an instruction to set a text variable %MacroName% to the value of "Test".


2. Another instruction appears later in the script...



Macro Run: %MacroName%


or perhaps this, which I think would do the same thing...



Run Macro in Variable: %MacroName%


3. You have written another macro called "Test" that includes this line:



Text Type (Paste Rich Text): fqwetrqgasgasdgwqwrzezrte


4. "Test" works when run by itself, but fails when it's called by the first macro?

Link to comment
Share on other sites

Your problem text contains a lot of extended features of RTF. I'm guessing you pasted this in from some other app which is including them not becasue it's necessary, but by default. I'm guessing that some of these things I don't often see like semicolons, curly braces are being seen a a Macro command component. You see when that run in macro command does that, it takes all the 'direct editor' code, including yoru text, and reinterprets the whole thing. I would edit out all those things so it looks like normal simple RTF. Also you could/should use the text type command to create the RTF. 


Why are you using Run Macro in Variable instead of Macro Run? It's rare that is ever needed and Macro Run wouldn't have this problem. And most times I've seen people who think they need the Macro Run in Variable, don't. 


My first thing woudl be to not use Macro Run in Variable. Tell us why you are using it instead of Macro Run and I bet I can find a better way for you using Macro Run. Second woudl be to remove all superfluous code in the RTF as I described in the first paragraph. 


Link to comment
Share on other sites

I like to use a Google sheet which contains MEX Direct Code in certain cells. By hoovering and starting a master makro MEX then interprets the content of the cell. One use case is that MEX runs direct code which is in such a cell in a variable. Works like a charm. Except when the direct code contains a "Paste rich text" command. I did not copy text of another application into the paste rich text command. I just edited the text in the command itself and then copied the direct code. Can anybody confirm that MEX cannot perform the "Paste rich text" command when It's written in Direct code and run by "Run macro in variable"?

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.

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.

  • Create New...