Jump to content
Macro Express Forums

rberq

Members
  • Posts

    1,200
  • Joined

  • Last visited

  • Days Won

    61

Everything posted by rberq

  1. I have these two commands at the beginning of every macro. (I wrote a macro to put them there.) The result is a single log file, rather than a separate log for each macro. Because "Log Messages" explicitly logs each macro, called macros are just as easy to identify as main macros. The single log is especially useful for complicated applications where you want to see the sequence and timing that related macros ran. Also, for trace and/or diagnostic purposes you can scatter "Log Messages" commands throughout your macro and examine them later at your leisure. I generally inactivate the diagnostic logging after a macro is debugged, but leave the commands in place so they are easy to reactivate if later problems appear. A very short sample of my log is below. Macro Express inserts the "Macro Completed" lines, so between that and the "Log Messages" at the beginning you know when and for how long a macro ran. Notice in the last log sample that "0_Generic_Copy_To_Clipboard" is a called macro; it's beginning is indicated by the explicit "Log Messages" command within the macro, but Macro Express does NOT tell us when it ended, same as macro explorer says last run time was "Never." If you needed to know how long the called macro took to run, you could put your own time-stamped "Log Messages" command at the end of it. Commands: Log Messages to "C:\Temp\MacroExpressProLogFiles\MacroExpressPro_Macro_Log_File.txt" "Macro executed: 0_Generic_Copy_To_Clipboard" Log Errors to "C:\Temp\MacroExpressProLogFiles\MacroExpressPro_Macro_Log_File.txt" 7/16/2020 12:32:41 PM: Macro executed: Kybd_Paste_Solitaire_Hint Thursday, July 16, 2020 12:32:42 PM: Macro Completed (Kybd_Paste_Solitaire_Hint) 7/16/2020 12:33:18 PM: Macro executed: 1_Type_gmail_eMail_Address Thursday, July 16, 2020 12:33:19 PM: Macro Completed (1_Type_gmail_eMail_Address) 7/16/2020 12:34:26 PM: Macro executed: 1_Close_Application_or_Browser_Window Thursday, July 16, 2020 12:34:26 PM: Macro Completed (1_Close_Application_or_Browser_Window) 7/16/2020 12:34:27 PM: Macro executed: 1_Close_Application_or_Browser_Window Thursday, July 16, 2020 12:34:27 PM: Macro Completed (1_Close_Application_or_Browser_Window) 7/16/2020 12:36:12 PM: Macro executed: 1_GoToForumLink_or_eMail 7/16/2020 12:36:12 PM: Macro executed: 0_Generic_Copy_To_Clipboard Thursday, July 16, 2020 12:36:13 PM: Macro Completed (1_GoToForumLink_or_eMail)
  2. I did modify my book-marking macro to insert a comment via the command list panel. It's nice knowing how to navigate the list with just keystrokes. Also finally wrote a macro that does nothing but simulate the DELETE key. It's either my keyboard or my clumsy fingers, but frequently when I try to delete something, it ends up deleting twice.
  3. Here are my solutions to the copy-and-paste I described above: (1) Insert a "bookmark" comment into the script. (2) For a highlighted block of code, copy to clipboard, re-find the bookmark, delete it, and in its place paste from the clipboard. The bookmark is inserted by duplicating the command at the insertion point, and adding a "bookmark" comment to the duplicated command. This is a little bit crude, because if the bookmark doesn't get deleted we end up with a duplicated command which might or might not cause problems. I might rewrite it to use your command-panel navigation method, to insert a standalone comment rather than modify a "live" command. I couldn't quite figure out that navigation when I originally worked on this a few days ago. // Macro bookmarks a place in the script by duplicating the current line and adding a "BOOKMARK" comment to it // (Works only if the Editor is set to insert commands AFTER the current command) // // Duplicate the line of code at the insertion point Text Type (Simulate Keystrokes): <CTRLD>d<CTRLU> // Ctrl-Alt-c shortcut to insert comment Text Type (Simulate Keystrokes): <CTRLD><ALTD>c<ALTU><CTRLU> Delay: 250 milliseconds // Type special recognizable "bookmark" text, then tab to "OK" and press ENTER to insert the bookmark comment Text Type (Use Clipboard and Paste Text): !@#$%*** BOOKMARK ***!@#$% Text Type (Simulate Keystrokes): <TAB><ENTER> // Macro Return // Macro copies highlighted macro script lines, pastes them into bookmarked location in script // Macro Run: 0_Generic_Copy_To_Clipboard // // Ctlr-HOME to top of script, locate bookmark, paste copied text, arrow up to bookmark line, remove bookmark Text Type (Simulate Keystrokes): <CTRLD><HOME><CTRLU> Text Type (Simulate Keystrokes): <CTRLD>f<CTRLU> Text Type (Simulate Keystrokes): !@#$%*** BOOKMARK ***!@#$%<ENTER><ESC> Text Type (Simulate Keystrokes): <CTRLD>v<CTRLU> Text Type (Simulate Keystrokes): <ARROW UP> Text Type (Simulate Keystrokes): <DELETE> // Macro Return
  4. Yes! Although I admit to getting sucked into doing too-big things with it myself. 🙄
  5. Clever idea, to automate the insertion of often-used commands. There's one thing I would like to have, and I wrote macros for in my last job, and that is bookmarking places in the code. I often will copy a block of code, and want to insert it elsewhere in the same macro. Lots of time is spent finding the code to be copied, then lots more time to re-find the insertion point and paste in the code. It is not unknown for me to paste it in the wrong place. 😧 So I will work on two macros: (1) Insert a "bookmark" comment into the script. (2) Copy to clipboard, re-find the bookmark, delete it, and in its place paste from the clipboard. After macro (1), of course, one would manually locate and highlight the block of code to be cloned, then run macro (2).
  6. Ctrl-1/2/3 etc. seem to work in Firefox and in IE also. If there are more than eight tabs in Firefox, Ctrl-9 takes you to the last one. Things I never knew before ....🙃
  7. Look up keyboard shortcuts for Chrome. When I Googled "keyboard shortcut to switch to a specific Chrome tab", I found that Ctrl-1 activates the first tab, Ctrl-2 activates the second, and so on. So if your Parts tab is always the second one, instead of doing "Window Activate", use the Text Type command to "type" Ctrl-2. Of course Chrome itself will have to be in focus to accept the keystrokes. I don't know for sure that this will work for you, but it's worth a try.
  8. Simpler than mine. Hardest part of making the macro is looking up the Excel keyboard shortcuts.
  9. Now that's impressive!!! You did OCR strictly with ME macros??? How much data did you have to get off a typical document -- a few key characters, or whole lines, or pages of text? How large were the fonts, or did you blow up the PDFs to make gigantic letters? Even though you were working with known fonts and sizes, there must have been slight variations between the pixels "read" and the standardized pixel maps. How did you adjust for the differences? How did you determine that a character was, or was not, a match to one of the maps? By sampling a few dozen, or a few hundred, pixels within a known space on the screen? When you say you could read "very quickly", what does that mean in characters per second, or however you measured it? Sounds like wicked good programming fun!!!
  10. Yes and no. Lots of nice features in ME that make it easy to do stuff beyond keyboard and mouse functions. For simple jobs it's quick and easy, but then one can get sucked in to using it beyond where its strengths are. As a high-level language, the fact that you have to define your own inter-module structure means my techniques will probably differ a lot from yours. Like the days when every bicycle mechanic became his own automobile manufacturer -- eventually Henry Ford had a better idea. ME works nicely as one tool in the box but doesn't replace the whole box.
  11. This seems to work well with Excel 2010. Before initiating the macro, hover the mouse over any cell in the row to be moved down. Then keyboard shortcuts are used. Though row X is to be moved down, the macro actually creates an empty row above X, then copies the row below X to the clipboard and pastes it into the empty row, then deletes the copied/pasted row. The last step of the macro is to position the mouse over the row that has just been moved down, so that no manual repositioning is needed to move it down further – just initiate the macro again. A macro to move a row up would be similar. // // // move excel row down -- mouse hovered over row to be moved // select any cell in row to be moved, based on mouse hovering over it Mouse Left Click // keyboard select entire row to be moved Text Type (Simulate Keystrokes): <SHIFTD><SPACE><SHIFTU> // keyboard insert empty row above row to be moved Text Type (Simulate Keystrokes): <CTRLD><SHIFTD>=<SHIFTU><CTRLU> // keyboard arrow down to row below that to be moved down, keyboard select entire row, copy to clipboard Text Type (Simulate Keystrokes): <ARROW DOWN><ARROW DOWN><SHIFTD><SPACE><SHIFTU><CTRLD>c<CTRLU> // keyboard arrow up to the blank inserted row, keyboard select entire row, paste copied row from clipboard Text Type (Simulate Keystrokes): <ARROW UP><ARROW UP><SHIFTD><SPACE><SHIFTU><CTRLD>v<CTRLU> // keyboard arrow down to row below that to be moved down, keyboard select entire row, keyboard delete row Text Type (Simulate Keystrokes): <ARROW DOWN><ARROW DOWN><SHIFTD><SPACE><SHIFTU><CTRLD>-<CTRLU> // Keyboard arrow up to the row just moved, position mouse over row so we can repeat macro to move it down still more Text Type (Simulate Keystrokes): <ARROW UP> Mouse Move: To the Text Cursor Position // Macro Return // //
  12. Also check Options | Preferences | Playback | Delay After Keystroke Down (and UP). On my system, both items are check-marked, and the suggested 300 microseconds is specified. Are these macros that previously worked, and are now failing? Or have they never worked reliably? Is your PC fairly modern? What version of Windows?
  13. The icons along the right side are so subdued that I didn't even notice them (bear in mind I only started using ME Pro a couple weeks ago.)🙄 But I have for a long time used the keyboard equivalents ctrl-up-arrow, ctrl-down-arrow, and ctrl-d to move or duplicate highlighted lines. I haven't figured out the keyboard shortcut for adding a comment, but while experimenting I discovered that ctrl-x deletes highlighted line(s).
  14. I have been astonished how well my Android phone understands my speech. Not only Google searches, but the map application, too. Instead of all that typing with fingers or a stylus, I can just say, "Hey, Google, navigate to Kalamazoo," and it comprehends.
  15. Yeah, but then my wife will know what I am up to, and offer her opinions.🙄 But that's a great idea. I like my smartphone feature, where I can just say, "Hey, Google, what's the population of Paraguay, and where the heck is Paraguay, anyhow?" and it tells me. I will look into Dragon. Maybe I can just mumble and it will understand....
  16. I have used the opposite approach in many macros, to establish the text cursor position. Generally this is by positioning the mouse over an item, such as one of the titles in a list of emails, or a file name in Explorer, or a word within text. Then hit the hotkey combination to start a macro, and the first thing the macro does is click the mouse to establish the cursor position. Biggest problem with this is, when I move my hands to the keyboard to start the macro, the touch-pad detects the movement and slides the mouse pointer to somewhere else! Perhaps the next ME release will have a brain-wave interface so I can just think "run macro now" without moving my hands. But I will have to keep in mind the possibilities for this command. I experimented a bit this morning and it worked in most of the applications I tested with.
  17. Works well now with the more-common Notepad method of (1) using the ENTER key to start a new line, or just typing along and letting Notepad wrap the words; and (2) using two ENTERs in a row to start a new paragraph by double-spacing. This involved simply scanning the text for two contiguous CRLFs, and if any is/are found, then all single CRLFs are removed. Haven't really tested extensively with lots of documents -- it's fun but I don't envision much use for this macro. <COMMENT Value=" "/> <LOG MESSAGES Filename="C:\\Temp\\MacroExpressProLogFiles\\MacroExpressPro_Macro_Log_File.txt" Message="Macro name: Kbyd_Paragraph" Stamp="TRUE"/> <LOG ERRORS Hide_Errors="FALSE"/> <COMMENT Value="Line Feed (New Line) character ascii 10"/> <VARIABLE SET TO ASCII CHAR Value="10" Destination="%LF%"/> <COMMENT Value="Carriage Return character ascii 13"/> <VARIABLE SET TO ASCII CHAR Value="13" Destination="%CR%"/> <COMMENT Value="Carriage Return / Line Feed combination characters ascii 13 + ascii 10"/> <VARIABLE MODIFY STRING Option="\x08" Destination="%CRLF%" Variable="%CR%" NoEmbeddedVars="FALSE"/> <VARIABLE MODIFY STRING Option="\x07" Destination="%CRLF%" Variable="%LF%" NoEmbeddedVars="FALSE"/> <COMMENT Value="Octal 01 and 02 "/> <VARIABLE SET TO ASCII CHAR Value="1" Destination="%Octal01%"/> <VARIABLE SET TO ASCII CHAR Value="94" Destination="%Octal01%" _ENABLED="FALSE" _COMMENT="caret ^"/> <VARIABLE SET TO ASCII CHAR Value="2" Destination="%Octal02%"/> <VARIABLE SET TO ASCII CHAR Value="126" Destination="%Octal02%" _ENABLED="FALSE" _COMMENT="tilde ~"/> <COMMENT Value="Pattern to flag paragraph (insertion point) "/> <VARIABLE SET STRING Option="\x00" Destination="%pattern%" Value=")(*()(*()(*()(*()(*()][\\][p" NoEmbeddedVars="FALSE"/> <COMMENT Value="Maximum number of paragraphs to be handled by macro"/> <COMMENT Value="Clear %paragraph% array to hold up to 50 paragraphs "/> <VARIABLE SET INTEGER Option="\x00" Destination="%max_paragraphs%" Value="500"/> <CLEAR VARIABLES Type="Text Variables" Option="\x01" Variable="%paragraph%" Start="1" End="%max_paragraphs%" _COMMENT="clear storage array to hold paragraphs"/> <COMMENT Value=" "/> <COMMENT Value="Style_1 has one CRLF per paragraph.\r\nStyle_2 has a double-CRLF per paragraph, to double-space between paragraphs.\r\nStyle_2 may or may not have a CRLF for each line within a paragraph."/> <COMMENT Value=" "/> <COMMENT Value=" "/> <COMMENT Value="Text file should be already open in Notepad, with mouse hovering over paragraph which is to be moved down.\r\nInsert funny pattern of characters at insertion point."/> <MOUSE LEFT CLICK/> <TEXT TYPE Action="0" Text="%pattern%"/> <COMMENT Value=" "/> <COMMENT Value="Get Notepad content into veriable %book%. "/> <MACRO RUN Use_ID="FALSE" Name="0_Kybd_Copy_All" ID="-1" Wait="TRUE"/> <VARIABLE SET STRING Option="\x02" Destination="%book%" NoEmbeddedVars="FALSE"/> <DELAY Flags="\x11" Time="2" _ENABLED="FALSE"/> <TEXT BOX DISPLAY Title="Debugging -- display book content with pattern inserted" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 %book%\\f1 \r\n\\par }\r\n" Left="25" Top="114" Width="1289" Height="566" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0" _ENABLED="FALSE"/> <COMMENT Value=" "/> <COMMENT Value="Make sure no octal 01 or 02 already exist in the text"/> <IF VARIABLE Variable="%book%" Condition="\x06" Value="%Octal01%" IgnoreCase="FALSE"/> <OR/> <IF VARIABLE Variable="%book%" Condition="\x06" Value="%Octal02%" IgnoreCase="FALSE"/> <TEXT BOX DISPLAY Title="Error" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 Error: ZIP macro -- text to be compressed already contains the ESC Escape character, or an octal 01 or 02. These characters are not allowed, because they are used for special purposes within this macro.\r\n\\par \r\n\\par Macro aborted. \\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/> <MACRO RETURN/> <END IF/> <COMMENT Value=" "/> <COMMENT Value="Right-trim the overall text and add another copy of the marker pattern to the end,\r\npreceded by octal 02 so it will be split out as a (dummy) concluding paragraph. "/> <VARIABLE MODIFY STRING Option="\x02" Destination="%book%"/> <VARIABLE MODIFY STRING Option="\x06" Destination="%book%" Value="%Octal02%" NoEmbeddedVars="FALSE"/> <VARIABLE MODIFY STRING Option="\x06" Destination="%book%" Value="%pattern%" NoEmbeddedVars="FALSE"/> <VARIABLE SET INTEGER Option="\x0D" Destination="%length_book%" Text_Variable="%book%"/> <COMMENT Value=" "/> <COMMENT Value="If text contains any double-CRLF, set Style_2 indicator. Otherwise Style_1. \r\nIf Style_2, replace double-CRLFs by octal 01, so we know where to put back the\r\ndouble-CRLFs later on. Then, if Style_2, get rid of single CRLFs (if any) that mark\r\nends of lines as opposed to paragraphs. "/> <IF VARIABLE Variable="%book%" Condition="\x06" Value="%CRLF%%CRLF%" IgnoreCase="FALSE"/> <VARIABLE SET STRING Option="\x00" Destination="%style1%" Value="FALSE" NoEmbeddedVars="FALSE"/> <VARIABLE SET STRING Option="\x00" Destination="%style2%" Value="TRUE" NoEmbeddedVars="FALSE"/> <VARIABLE MODIFY STRING Option="\x0F" Destination="%book%" ToReplace="%CRLF%%CRLF%" ReplaceWith="%Octal01%" All="TRUE" IgnoreCase="FALSE" NoEmbeddedVars="FALSE"/> <VARIABLE MODIFY STRING Option="\x0F" Destination="%book%" ToReplace="%CRLF%" ReplaceWith=" " All="TRUE" IgnoreCase="FALSE" NoEmbeddedVars="FALSE"/> <VARIABLE MODIFY STRING Option="\x0F" Destination="%book%" ToReplace="%Octal01%" ReplaceWith="%CRLF%" All="TRUE" IgnoreCase="FALSE" NoEmbeddedVars="FALSE"/> <ELSE/> <VARIABLE SET STRING Option="\x00" Destination="%style1%" Value="TRUE" NoEmbeddedVars="FALSE"/> <VARIABLE SET STRING Option="\x00" Destination="%style2%" Value="FALSE" NoEmbeddedVars="FALSE"/> <END IF/> <TEXT BOX DISPLAY Title="Diagnostics -- style" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 style1 = %style1%\r\n\\par style2 = %style2%\\f1 \r\n\\par \r\n\\par }\r\n" Left="Center" Top="Center" Width="1348" Height="597" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/> <COMMENT Value=" "/> <COMMENT Value="Replace all CRLF within text by octal 02."/> <VARIABLE MODIFY STRING Option="\x0F" Destination="%book%" ToReplace="%CRLF%" ReplaceWith="%Octal02%" All="TRUE" IgnoreCase="FALSE" NoEmbeddedVars="FALSE"/> <TEXT BOX DISPLAY Title="Diagnostics -- modified text with octal 02" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 %book%\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="1348" Height="597" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0" _ENABLED="FALSE"/> <COMMENT Value=" "/> <COMMENT Value="Split out text into paragraphs based on CRLF (which has been replaced by octal 02). "/> <SPLIT STRING Source="%book%" SplitChar="%Octal02%" Dest="%paragraph%" Index="1"/> <TEXT BOX DISPLAY Title="Diagnostics -- paragraphs 1 to 12" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 %paragraph[1]%\r\n\\par \r\n\\par %paragraph[2]%\r\n\\par \r\n\\par %paragraph[3]%\r\n\\par \r\n\\par %paragraph[4]%\r\n\\par \\f1 \r\n\\par \\f0 %paragraph[5]%\r\n\\par \r\n\\par %paragraph[6]%\r\n\\par \r\n\\par %paragraph[7]%\r\n\\par \r\n\\par %paragraph[8]%\r\n\\par \r\n\\par %paragraph[9]%\r\n\\par \r\n\\par %paragraph[10]%\r\n\\par \r\n\\par %paragraph[11]%\r\n\\par \r\n\\par %paragraph[12]%\\f1 \r\n\\par \r\n\\par \r\n\\par \r\n\\par \r\n\\par \r\n\\par \r\n\\par }\r\n" Left="7" Top="89" Width="1352" Height="596" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0" _ENABLED="FALSE"/> <COMMENT Value=" "/> <COMMENT Value="Scan paragraphs in array looking for special pattern that we inserted earlier.\r\nMake sure to take the first pattern, so as not to use the extra pattern that\r\nwe inserted at the end. "/> <VARIABLE SET INTEGER Option="\x00" Destination="%paragraph_index%" Value="0"/> <VARIABLE SET INTEGER Option="\x00" Destination="%index_of_paragraph_to_be_moved%" Value="0"/> <REPEAT UNTIL Variable="%paragraph_index%" Condition="\x04" Value="%max_paragraphs%"/> <VARIABLE MODIFY INTEGER Option="\x07" Destination="%paragraph_index%"/> <IF VARIABLE Variable="%paragraph[%paragraph_index%]%" Condition="\x06" Value="%pattern%" IgnoreCase="FALSE"/> <VARIABLE MODIFY INTEGER Option="\x06" Destination="%index_of_paragraph_to_be_moved%" Variable="%paragraph_index%"/> <REPEAT EXIT/> <END IF/> <END REPEAT/> <TEXT BOX DISPLAY Title="Diagnostics -- paragraph containing pattern" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 Paragraph %index_of_paragraph_to_be_moved% contains the marker pattern\\f1 \r\n\\par \r\n\\par }\r\n" Left="Center" Top="Center" Width="543" Height="171" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0" _ENABLED="FALSE"/> <COMMENT Value=" "/> <COMMENT Value="Switch the pattern-marked paragraph with the subsequent paragraph "/> <VARIABLE MODIFY INTEGER Option="\x00" Destination="%index_of_subsequent_paragraph%" Value1="%index_of_paragraph_to_be_moved%" Value2="1"/> <VARIABLE MODIFY STRING Option="\x08" Destination="%temporary_paragraph%" Variable="%paragraph[%index_of_paragraph_to_be_moved%]%" NoEmbeddedVars="FALSE"/> <VARIABLE MODIFY STRING Option="\x08" Destination="%paragraph[%index_of_paragraph_to_be_moved%]%" Variable="%paragraph[%index_of_subsequent_paragraph%]%" NoEmbeddedVars="FALSE"/> <VARIABLE MODIFY STRING Option="\x08" Destination="%paragraph[%index_of_subsequent_paragraph%]%" Variable="%temporary_paragraph%" NoEmbeddedVars="FALSE"/> <COMMENT Value=" "/> <COMMENT Value="Build output text by concatenating paragraphs. \r\nAppend to each paragraph the octal 02 that was removed by the Strip command."/> <VARIABLE SET STRING Option="\x00" Destination="%book1%" NoEmbeddedVars="FALSE"/> <VARIABLE SET INTEGER Option="\x00" Destination="%paragraph_index%" Value="0"/> <REPEAT UNTIL Variable="%paragraph_index%" Condition="\x04" Value="%max_paragraphs%"/> <VARIABLE MODIFY INTEGER Option="\x07" Destination="%paragraph_index%"/> <IF VARIABLE Variable="%paragraph[%paragraph_index%]%" Condition="\x00" IgnoreCase="FALSE"/> <ELSE/> <VARIABLE MODIFY STRING Option="\x07" Destination="%book1%" Variable="%paragraph[%paragraph_index%]%" NoEmbeddedVars="FALSE"/> <VARIABLE MODIFY STRING Option="\x07" Destination="%book1%" Variable="%Octal02%" NoEmbeddedVars="FALSE"/> <END IF/> <END REPEAT/> <VARIABLE SET INTEGER Option="\x0D" Destination="%length_book1%" Text_Variable="%book1%"/> <TEXT BOX DISPLAY Title="Diagnostics -- output rebuilt, but without CRLFs" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 Length of original book %length_book%\r\n\\par Length of modified book1 %length_book1%\r\n\\par \r\n\\par %book1%\\f1 \r\n\\par \r\n\\par }\r\n" Left="Center" Top="Center" Width="1345" Height="613" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0" _ENABLED="FALSE"/> <COMMENT Value=" "/> <COMMENT Value="Put back the CRLF sequences that we previously converted to octal 02."/> <IF VARIABLE Variable="%style1%" Condition="\x00" Value="TRUE" IgnoreCase="TRUE"/> <VARIABLE MODIFY STRING Option="\x0F" Destination="%book1%" ToReplace="%Octal02%" ReplaceWith="%CRLF%" All="TRUE" IgnoreCase="FALSE" NoEmbeddedVars="FALSE"/> <ELSE/> <VARIABLE MODIFY STRING Option="\x0F" Destination="%book1%" ToReplace="%Octal02%" ReplaceWith="%CRLF%%CRLF%" All="TRUE" IgnoreCase="FALSE" NoEmbeddedVars="FALSE"/> <END IF/> <TEXT BOX DISPLAY Title="Diagnostics -- output rebuilt, CRLFs restored" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 %book1%\\f1 \r\n\\par \r\n\\par }\r\n" Left="Center" Top="Center" Width="1345" Height="613" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0" _ENABLED="FALSE"/> <COMMENT Value=" "/> <COMMENT Value="Remove the marker pattern from the text "/> <VARIABLE MODIFY STRING Option="\x0F" Destination="%book1%" ToReplace="%pattern%" All="TRUE" IgnoreCase="FALSE" NoEmbeddedVars="FALSE"/> <TEXT BOX DISPLAY Title="Diagnostics -- final output rebuilt, marker patterns removed" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 %book1%\\f1 \r\n\\par \r\n\\par }\r\n" Left="Center" Top="Center" Width="1345" Height="613" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0" _ENABLED="FALSE"/> <COMMENT Value=" "/> <COMMENT Value="Put the retructured text back into the Notepad area by highlighting all and pasting from clipboard"/> <VARIABLE MODIFY STRING Option="\x10" Destination="%book1%" NoEmbeddedVars="FALSE"/> <TEXT TYPE Action="0" Text="<CTRLD>a<CTRLU>"/> <DELAY Flags="\x12" Time="500"/> <TEXT TYPE Action="0" Text="<CTRLD>v<CTRLU>"/> <COMMENT Value=" "/> <COMMENT Value=" "/> <MACRO RETURN/> <COMMENT Value=" "/>
  18. Often this approach works well for precisely-defined conditions, like what you used it for, and can be done in relatively-few keystrokes. I used to have a wonderful keyboard where you just pressed one of twelve "program" keys, then entered whatever keystrokes you wanted. Basically you could enter a keyboard macro in a matter of seconds, right within the keyboard. My keyboard finally became obsolete because newer computers had no place to plug it in,😧 so I transitioned to Macro Express. ME is vastly more powerful overall, but the programmable keyboard was vastly easier and faster for small keyboard-only sequences. Meanwhile, minor tweaks have made my Notepad macro work with more common document layouts that I mentioned above.
  19. Well, I have a preliminary version working for Notepad. It moves a paragraph down; moving it up would be similar. It requires that the text be typed continuously in Notepad, using the ENTER key only to start a new paragraph. That means the CR-LF sequence exists only at the end of a paragraph. Logic of the macro is first to type an oddball string at the insertion point – wherever the mouse is positioned within the paragraph to be moved down. Then, get the whole document into a variable, and replace every CR-LF with an octal 02, an unprintable character that will never exist in normal text. Replacing CR-LF with a single byte is done because Macro Express needs a single byte for splitting. The text is then split on &02 into array %paragraph%. Each item in the array is searched for the oddball string that the macro initially typed, and when found that array item is swapped with the subsequent one. The items of array %paragraph% are then concatenated to an output string, with CR-LF appended after each paragraph, and the oddball marker string is removed. It works fine when the text follows the constraints I defined. However, when I loaded the text of a book from Project Gutenberg, there was a CR-LF for every line, and paragraphs delineated by double-spacing. More work needed to handle these real-world cases! <COMMENT Value=" "/> <LOG MESSAGES Filename="C:\\Temp\\MacroExpressProLogFiles\\MacroExpressPro_Macro_Log_File.txt" Message="Macro name: Kbyd_Paragraph" Stamp="TRUE"/> <LOG ERRORS Hide_Errors="FALSE"/> <COMMENT Value="Line Feed (New Line) character ascii 10"/> <VARIABLE SET TO ASCII CHAR Value="10" Destination="%LF%"/> <COMMENT Value="Carriage Return character ascii 13"/> <VARIABLE SET TO ASCII CHAR Value="13" Destination="%CR%"/> <COMMENT Value="Carriage Return / Line Feed combination characters ascii 13 + ascii 10"/> <VARIABLE MODIFY STRING Option="\x08" Destination="%CRLF%" Variable="%CR%" NoEmbeddedVars="FALSE"/> <VARIABLE MODIFY STRING Option="\x07" Destination="%CRLF%" Variable="%LF%" NoEmbeddedVars="FALSE"/> <COMMENT Value="Octal 01 and 02 "/> <VARIABLE SET TO ASCII CHAR Value="1" Destination="%Octal01%"/> <VARIABLE SET TO ASCII CHAR Value="2" Destination="%Octal02%"/> <COMMENT Value="Pattern to flag paragraph (insertion point) "/> <VARIABLE SET STRING Option="\x00" Destination="%pattern%" Value=")(*()(*()(*()(*()(*()][\\][p" NoEmbeddedVars="FALSE"/> <COMMENT Value="Maximum number of paragraphs to be handled by macro"/> <COMMENT Value="Clear %paragraph% array to hold up to 50 paragraphs "/> <VARIABLE SET INTEGER Option="\x00" Destination="%max_paragraphs%" Value="50"/> <CLEAR VARIABLES Type="Text Variables" Option="\x01" Variable="%paragraph%" Start="1" End="%max_paragraphs%" _COMMENT="clear storage array to hold paragraphs"/> <COMMENT Value=" "/> <COMMENT Value="Text file should be already open in Notepad, with mouse hovering over paragraph which is to be moved down.\r\nInsert funny pattern of characters at insertion point."/> <MOUSE LEFT CLICK/> <TEXT TYPE Action="0" Text="%pattern%"/> <COMMENT Value=" "/> <COMMENT Value="Get Notepad content into veriable %book%. "/> <MACRO RUN Use_ID="FALSE" Name="0_Kybd_Copy_All" ID="-1" Wait="TRUE"/> <VARIABLE SET STRING Option="\x02" Destination="%book%" NoEmbeddedVars="FALSE"/> <DELAY Flags="\x11" Time="2" _ENABLED="FALSE"/> <TEXT BOX DISPLAY Title="Debugging -- display book content with pattern inserted" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 %book%\\f1 \r\n\\par }\r\n" Left="25" Top="114" Width="1289" Height="566" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0" _ENABLED="FALSE"/> <COMMENT Value=" "/> <COMMENT Value="Make sure ESC character does not exist in the text, also no octal 01 or 02"/> <VARIABLE MODIFY STRING Option="\x07" Destination="%book%" Variable="%Octal02%" NoEmbeddedVars="FALSE" _ENABLED="FALSE"/> <IF VARIABLE Variable="%book%" Condition="\x06" Value="%Octal02%" IgnoreCase="FALSE"/> <TEXT BOX DISPLAY Title="Error" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 Error: ZIP macro -- text to be compressed already contains the ESC Escape character, or an octal 01 or 02. These characters are not allowed, because they are used for special purposes within this macro.\r\n\\par \r\n\\par Macro aborted. \\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/> <MACRO RETURN/> <END IF/> <COMMENT Value=" "/> <COMMENT Value="Right-trim the overall text and add another copy of the marker pattern to the end,\r\npreceded by octal 02 so it will be split out as a (dummy) concluding paragraph. "/> <VARIABLE MODIFY STRING Option="\x02" Destination="%book%"/> <VARIABLE MODIFY STRING Option="\x06" Destination="%book%" Value="%Octal02%" NoEmbeddedVars="FALSE"/> <VARIABLE MODIFY STRING Option="\x06" Destination="%book%" Value="%pattern%" NoEmbeddedVars="FALSE"/> <VARIABLE MODIFY STRING Option="\x06" Destination="%book%" Value="%Octal02%" NoEmbeddedVars="FALSE" _ENABLED="FALSE"/> <VARIABLE SET INTEGER Option="\x0D" Destination="%length_book%" Text_Variable="%book%"/> <COMMENT Value=" "/> <COMMENT Value="Replace all CRLF within text by octal 02."/> <VARIABLE MODIFY STRING Option="\x0F" Destination="%book%" ToReplace="%CRLF%" ReplaceWith="%Octal02%" All="TRUE" IgnoreCase="FALSE" NoEmbeddedVars="FALSE"/> <TEXT BOX DISPLAY Title="Diagnostics -- modified text with octal 02" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 %book%\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="1348" Height="597" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0" _ENABLED="FALSE"/> <COMMENT Value=" "/> <COMMENT Value="Split out text into paragraphs based on CRLF (which has been replaced by octal 02). "/> <SPLIT STRING Source="%book%" SplitChar="%Octal02%" Dest="%paragraph%" Index="1"/> <TEXT BOX DISPLAY Title="Diagnostics -- paragraphs 1 to 12" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 %paragraph[1]%\r\n\\par \r\n\\par %paragraph[2]%\r\n\\par \r\n\\par %paragraph[3]%\r\n\\par \r\n\\par %paragraph[4]%\r\n\\par \\f1 \r\n\\par \\f0 %paragraph[5]%\r\n\\par \r\n\\par %paragraph[6]%\r\n\\par \r\n\\par %paragraph[7]%\r\n\\par \r\n\\par %paragraph[8]%\r\n\\par \r\n\\par %paragraph[9]%\r\n\\par \r\n\\par %paragraph[10]%\r\n\\par \r\n\\par %paragraph[11]%\r\n\\par \r\n\\par %paragraph[12]%\\f1 \r\n\\par \r\n\\par \r\n\\par \r\n\\par \r\n\\par \r\n\\par \r\n\\par }\r\n" Left="7" Top="89" Width="1352" Height="596" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0" _ENABLED="FALSE"/> <COMMENT Value=" "/> <COMMENT Value="Scan paragraphs in array looking for special pattern that we inserted earlier.\r\nMake sure to take the first pattern, so as not to use the extra pattern that\r\nwe inserted at the end. "/> <VARIABLE SET INTEGER Option="\x00" Destination="%paragraph_index%" Value="0"/> <VARIABLE SET INTEGER Option="\x00" Destination="%index_of_paragraph_to_be_moved%" Value="0"/> <REPEAT UNTIL Variable="%paragraph_index%" Condition="\x04" Value="%max_paragraphs%"/> <VARIABLE MODIFY INTEGER Option="\x07" Destination="%paragraph_index%"/> <IF VARIABLE Variable="%paragraph[%paragraph_index%]%" Condition="\x06" Value="%pattern%" IgnoreCase="FALSE"/> <VARIABLE MODIFY INTEGER Option="\x06" Destination="%index_of_paragraph_to_be_moved%" Variable="%paragraph_index%"/> <REPEAT EXIT/> <END IF/> <END REPEAT/> <TEXT BOX DISPLAY Title="Diagnostics -- paragraph containing pattern" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 Paragraph %index_of_paragraph_to_be_moved% contains the marker pattern\\f1 \r\n\\par \r\n\\par }\r\n" Left="Center" Top="Center" Width="543" Height="171" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0" _ENABLED="FALSE"/> <COMMENT Value=" "/> <COMMENT Value="Switch the pattern-marked paragraph with the subsequent paragraph "/> <VARIABLE MODIFY INTEGER Option="\x00" Destination="%index_of_subsequent_paragraph%" Value1="%index_of_paragraph_to_be_moved%" Value2="1"/> <VARIABLE MODIFY STRING Option="\x08" Destination="%temporary_paragraph%" Variable="%paragraph[%index_of_paragraph_to_be_moved%]%" NoEmbeddedVars="FALSE"/> <VARIABLE MODIFY STRING Option="\x08" Destination="%paragraph[%index_of_paragraph_to_be_moved%]%" Variable="%paragraph[%index_of_subsequent_paragraph%]%" NoEmbeddedVars="FALSE"/> <VARIABLE MODIFY STRING Option="\x08" Destination="%paragraph[%index_of_subsequent_paragraph%]%" Variable="%temporary_paragraph%" NoEmbeddedVars="FALSE"/> <COMMENT Value=" "/> <COMMENT Value="Build output text by concatenating paragraphs. \r\nAppend to each paragraph the octal 02 that was removed by the Strip command."/> <VARIABLE SET STRING Option="\x00" Destination="%book1%" NoEmbeddedVars="FALSE"/> <VARIABLE SET INTEGER Option="\x00" Destination="%paragraph_index%" Value="0"/> <REPEAT UNTIL Variable="%paragraph_index%" Condition="\x04" Value="%max_paragraphs%"/> <VARIABLE MODIFY INTEGER Option="\x07" Destination="%paragraph_index%"/> <IF VARIABLE Variable="%paragraph[%paragraph_index%]%" Condition="\x00" IgnoreCase="FALSE"/> <ELSE/> <VARIABLE MODIFY STRING Option="\x07" Destination="%book1%" Variable="%paragraph[%paragraph_index%]%" NoEmbeddedVars="FALSE"/> <VARIABLE MODIFY STRING Option="\x07" Destination="%book1%" Variable="%Octal02%" NoEmbeddedVars="FALSE"/> <END IF/> <END REPEAT/> <VARIABLE SET INTEGER Option="\x0D" Destination="%length_book1%" Text_Variable="%book1%"/> <TEXT BOX DISPLAY Title="Diagnostics -- output rebuilt, but without CRLFs" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 Length of original book %length_book%\r\n\\par Length of modified book1 %length_book1%\r\n\\par \r\n\\par %book1%\\f1 \r\n\\par \r\n\\par }\r\n" Left="Center" Top="Center" Width="1345" Height="613" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0" _ENABLED="FALSE"/> <COMMENT Value=" "/> <COMMENT Value="Put back the CRLF sequences that we previously converted to octal 02."/> <VARIABLE MODIFY STRING Option="\x0F" Destination="%book1%" ToReplace="%Octal02%" ReplaceWith="%CRLF%" All="TRUE" IgnoreCase="FALSE" NoEmbeddedVars="FALSE"/> <TEXT BOX DISPLAY Title="Diagnostics -- output rebuilt, CRLFs restored" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 %book1%\\f1 \r\n\\par \r\n\\par }\r\n" Left="Center" Top="Center" Width="1345" Height="613" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0" _ENABLED="FALSE"/> <COMMENT Value=" "/> <COMMENT Value="Remove the marker pattern from the text "/> <VARIABLE MODIFY STRING Option="\x0F" Destination="%book1%" ToReplace="%pattern%" All="TRUE" IgnoreCase="FALSE" NoEmbeddedVars="FALSE"/> <TEXT BOX DISPLAY Title="Diagnostics -- final output rebuilt, marker patterns removed" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 %book1%\\f1 \r\n\\par \r\n\\par }\r\n" Left="Center" Top="Center" Width="1345" Height="613" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0" _ENABLED="FALSE"/> <COMMENT Value=" "/> <COMMENT Value="Put the retructured text back into the Notepad area by highlighting all and pasting from clipboard"/> <VARIABLE MODIFY STRING Option="\x10" Destination="%book1%" NoEmbeddedVars="FALSE"/> <TEXT TYPE Action="0" Text="<CTRLD>a<CTRLU>"/> <DELAY Flags="\x12" Time="500"/> <TEXT TYPE Action="0" Text="<CTRLD>v<CTRLU>"/> <COMMENT Value=" "/> <COMMENT Value=" "/> <MACRO RETURN/> <COMMENT Value=" "/>
  20. I agree a ME macro will likely need the clipboard. After all, an application like Word already HAS the document in memory, where ME does not. And even though the Microsoft apps may not use the standard Windows clipboard, they must be using an internal equivalent. I'm going to tackle the easy one first: Notepad.
  21. Yes. I also noticed that ctrl-c, to copy the pixel color to the clipboard, works only the first time I do it after launching the Mouse Locator. After that, no change in the clipboard.
  22. Found this old topic when searching. I have had ME Pro installed for a few years but used it very little. Started converting from ME3 yesterday, and immediately got the flashing/flickering mouse locator. Has there been any progress fixing it? I am running Me 4.9.1.1 on Windows 7.
×
×
  • Create New...