Jump to content
Macro Express Forums

rberq

Members
  • Posts

    1,200
  • Joined

  • Last visited

  • Days Won

    61

Posts posted by rberq

  1. I have a macro, A, that I trigger with the Backspace key.

    I have another macro, B, that (among other things) simulates typing a Backspace.

    The problem is, when B "types" Backspace, it triggers A to run, which causes havoc.  How can I keep A from running in this situation?  Both A and B sometimes are used in the same applications, so I can’t limit A by Scope.  Any other suggestions? 

     

  2. What application contains the text? 

    Could you possibly use the Macro Express "Window Resize" command?

    Can you show us the macro command(s) you are using to type WIN_F12? 

    Something like this?

       Text Type (Simulate Keystrokes): <WIND><F12><WINU>
       Delay: 250 milliseconds
       Text Type (Simulate Keystrokes): <WIND><F12><WINU>
       Delay: 250 milliseconds
       Text Type (Simulate Keystrokes): <WIND><F12><WINU>

     

  3. 2 hours ago, acantor said:

    it's fun to witness this macro monitoring the "Size" field...

    Yes, always fun watching a macro follow your instructions in real time.  I think robotics would be fun for the same reason -- program your own Mars Rover to navigate the back yard.  Here's another method that might be fun to try: Have your script take a screen shot of the Properties window, pass it to text-recognition software, then parse and read out the results. 

  4. Sorry, I expressed that badly when I referred to the macro issuing a DOS command.

     

    The macro can:

    (1) Delete any existing file C:\Temp\Temp.bat

    (2) Build a new file C:\Temp\Temp.bat containing the DIR command -- last command of the .bat file should be "exit"

    (3) Program Launch C:\Temp\Temp.bat

    (4) Text File Begin Process to read back and process C:\Temp\filelist.txt (output of DIR command)

     

    The sample below works to create and run the batch command file.  I haven't coded the Text File Process step to read back the report file.  It may need some code after launching the batch file -- a delay at the very least -- to determine when the report file is ready to process. 

     

    //  
    Delete File/Files: "c:\temp\test.bat"
    Variable Set String %line% to "cd\"
    Variable Modify String: Append %line% to text file, "c:\temp\test.bat"
    Variable Set String %line% to "dir c:\onedrive /s > c:\temp\filelist.txt"
    Variable Modify String: Append %line% to text file, "c:\temp\test.bat"
    Variable Set String %line% to "exit"
    Variable Modify String: Append %line% to text file, "c:\temp\test.bat"
    Program Launch: "test.bat" (Normal)
    Parameters:
    Macro Return
    //  

     

  5. 5 hours ago, terrypin said:

    dir "C:\Users\terry\Dropbox\Dropbox (Sundry)" | find "(s)"

    Very clever.  And simpler than mine.  I never thought of piping the output to another command, and to be honest I wasn't even familiar with "find".  Now if we direct output of "find" to a text file, ME can very quickly read it and display the message box called for by the original challenge. 

     

    Microsoft over the years has quietly made the traditional "DOS" commands much more powerful and elaborate.  And usually, these days, they actually work, which is a change from the good old days.  😉

     

    pipe.JPG.3e01dae866f8ae937d5f47ce1f9d7b08.JPG

  6. 1 hour ago, acantor said:

    That would be a far more elegant solution than mine... But will it work?

    Yes it will work.  I don't know that it is more elegant than your solution, but it is simple and straightforward, and has lots of possibilities beyond simply reporting folder size.  I used the technique to automate processing on a server which contained extremely large individual backup files.  The DIR commands were in .bat files that were scheduled by Windows.  Then ME would schedule subsequent scripts to process the DIR output and generate additional .bat commands to compress the backup files and send the compressed files off to long-term tape storage.  A few simple batch files and ME scripts replaced an expensive commercial system that didn't work worth sh*t anyway.  😋

  7. Here's a different technique, which I have used extensively in the past to develop lists of files with various attributes:

     

    The macro can issue a DOS-style command directing its output to a file.  For this problem, the command would be DIR DIRPATH  /S  >C:\Temp\filelist.txt, which lists all files in the specified folder and in all subfolders.  The macro can then read and process filelist.txt, whose next-to-last line contains the cumulative number and size of the files.  It is fairly simple to find the line and extract the totals. 

  8. 1 hour ago, acantor said:

    The "cringe-worthy" concession was being forced to add a non-letter to the start of the string.

    I object.  That is not the least bit cringe-worthy, no more than my appending a garbage string of characters to denote the end of the text.  Something like that can greatly simplify the convoluted logic that otherwise might be needed.  As long as you document it so the next programmer won't be confused by the technique, it's praise-worthy rather than cringe-worthy. 

     

    I like your solution better than mine -- my whole difficulty was special treatment of punctuation, and you avoided that issue.  Sometimes I can make complex problems simple, and other times I can make simple problems complex.🙃

  9. 15 minutes ago, acantor said:

    Your approach of appending a "garbage" string to the end of a text, and then processing the text until the garbage string is reached, is eminently steal-able. Clever. I'm going to try that!

    That's my invention that goes back 50+ years for syncing multiple sequentially-sorted tape files, where category breaks occurred every so often requiring totals processing and resetting of counters for the next category.  It can save a lot of convoluted logic otherwise needed, especially with three or more tapes.  I'm sure I was not the first nor the last to discover the technique -- with account numbers the "garbage" was generally just a string of 9999999....

  10. OK, this seems to be working.  There are punctuation marks that are not in the text used for testing, and they are not accounted for in the macro.  I think to improve the macro, I would try a slightly different technique for punctuation and things like TAB characters -- perhaps replace each punctuation character with ESC and a digit.  For example, ESC1=period, ESC2=comma, etc.  Then in the result change the ESC sequences back to period, comma, and so on.  

    //  
    Log Errors to "C:\Temp\MacroExpressProLogFiles\MacroExpressPro_Macro_Log_File.txt"
    Log Messages to "C:\Temp\MacroExpressProLogFiles\MacroExpressPro_Macro_Log_File.txt"
      "Macro executed: Temp_Extract_First_Letters"
    Log Errors to Default Macro Log
    // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    Keystroke Speed: 10 milliseconds
    Mouse Speed: 30 milliseconds
    // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    //  
    // Null character ascii 0
    Variable Set to ASCII Char 0 to %NULL%
    // BEL character ascii 7
    Variable Set to ASCII Char 7 to %BEL%
    // Escape character ascii 9
    Variable Set to ASCII Char 27 to %ESC%
    // Tab character ascii 9
    Variable Set to ASCII Char 9 to %TAB%
    // Line Feed (New Line) character ascii 10
    Variable Set to ASCII Char 10 to %LINEFEED%
    // Carriage Return character ascii 13
    Variable Set to ASCII Char 13 to %CARRIAGERETURN%
    // Carriage Return / Line Feed combination characters ascii 13 + ascii 10
    Variable Set to ASCII Char 13 to %CRLF%
    Variable Modify String %CRLF%: Append Text String Variable (%LINEFEED%)
    // STX character ascii 2
    Variable Set to ASCII Char 2 to %STX%
    // ETX character ascii 3
    Variable Set to ASCII Char 3 to %ETX%
    // DC1 character ascii 17
    Variable Set to ASCII Char 17 to %DC1%
    // DC2 character ascii 18
    Variable Set to ASCII Char 18 to %DC2%
    //  
    //  
    Variable Set String %text% to "       Once upon a time, there was an ogre named Sandor.

    Sandor lived in a 1000-room "castle" made of ice!

    Change all punctuation marks to "blank punctuation blank".
    Change CR-LF to a single character BEL that is unused elsewhere (surrounded by blanks).
    Insert one dummy blank at the beginning of the text.
    Change all multiple consecutive blanks to single blanks.
    Remove first character from text (must be a blank).
    Repeat until done:
       Extract first character into result, remove from text.
       Locate first blank in text, remove all characters up to that position.
    Repeat end
    Change all punctuation marks from "blank punctuation blank" to "punctuation".  
    Change selected punctuation marks to "punctuation blank" (periods, commas, etc.)  "
    Text Box Display: Diagnostics -- show text
    If Variable %text% Contains "%CRLF%"
    Text Box Display: Diagnostics
    End If
    // Insert one blank at beginning of text
    Variable Set String %temptext% to " "
    Variable Modify String %temptext%: Append Text String Variable (%text%)
    Variable Modify String %text%: Copy Whole Text (%temptext%)
    Text Box Display: Diagnostics -- text with extra blank at beginning
    // Change all multiple consecutive blanks to single blanks.  
    Repeat Start (Repeat 20 times)
      Variable Modify String: Replace "  " in %text% with " "
    End Repeat
    Text Box Display: Diagnostics -- text with multi blanks compressed to single blanks
    // Surround punctuation marks with blanks
    Variable Modify String: Replace "." in %text% with " . "
    Variable Modify String: Replace "," in %text% with " , "
    Variable Modify String: Replace "-" in %text% with " - "
    Variable Modify String: Replace "!" in %text% with " ! "
    Variable Modify String: Replace "(" in %text% with " ( "
    Variable Modify String: Replace ")" in %text% with " ) "
    Variable Modify String: Replace " "" in %text% with " %DC1% " // change left double-quote to DC1
    Variable Modify String: Replace """ in %text% with " %DC2% " // change right double-quote to DC2 (all remaining double-quotes)
    Variable Modify String: Replace "%CRLF%" in %text% with " %BEL% " // Change two-character sequence CRLF to single character BEL
    Text Box Display: Diagnostics -- text after punctuation expansion
    // Remove first character from text
    Variable Modify String %text%: Delete a substring starting at 1 and 1 characters long
    Text Box Display: Diagnostics -- text after deleting leading blank
    // Extract first character of each word -- punctuation marks count as words
    Variable Set String %result% to "" // Clear result text
    Variable Modify String %text%: Append Text ( !@#$%^&*()) // Append garbage to end of text to identify where the end is
    Repeat Until %text% Equals " !@#$%^&*()"
      Variable Modify String: Copy a substring in %text%, starting at 1 and 1 characters long to %onechar% // One character from text into temporary area
      Variable Modify String %result%: Append Text String Variable (%onechar%) // Append extracted character to result
      Variable Modify String %result%: Append Text ( ) // Append one blank to result
      Variable Set Integer %index% to the position of " " in %text%
      Variable Modify String %text%: Delete a substring starting at 1 and %index% characters long // Delete from text up to and including next blank space
    End Repeat
    Text Box Display: Diagnostics -- text after processing to end
    Text Box Display: Diagnostics -- result text with one character per word
    // Change all multiple consecutive blanks to single blanks.  
    // Adjust selected punctuation marks
    Repeat Start (Repeat 20 times)
      Variable Modify String: Replace " ." in %result% with ". " // period
      Variable Modify String: Replace " ," in %result% with ", " // comma
      Variable Modify String: Replace " -" in %result% with "-" // hyphen
      Variable Modify String: Replace "- " in %result% with "-" // hyphen
      Variable Modify String: Replace " !" in %result% with "! " // exclamation point
      Variable Modify String: Replace "!" in %result% with "! " // exclamation point
      Variable Modify String: Replace "( " in %result% with " (" // left paren
      Variable Modify String: Replace "(" in %result% with " (" // left paren
      Variable Modify String: Replace " )" in %result% with ")" // right paren
      Variable Modify String: Replace "%DC1% " in %result% with " "" // left double-quote
      Variable Modify String: Replace " %DC2% " in %result% with """ // right double-quote
      Variable Modify String: Replace "%BEL% " in %result% with "%CRLF%" // Change BEL characters back to CRLF
    End Repeat
    Repeat Start (Repeat 20 times)
      Variable Modify String: Replace "  " in %result% with " " // double space to single space
    End Repeat
    If Variable %result% Contains "%CRLF%"
    Text Box Display: Diagnostics
    End If
    Text Box Display: Diagnostics -- final result after punctuation adjustment
    //  
    //  
    Macro Return
    //  
    //  
    .
    .
    .
    .
    <COMMENT Value=" "/>
    <LOG ERRORS Filename="C:\\Temp\\MacroExpressProLogFiles\\MacroExpressPro_Macro_Log_File.txt" Hide_Errors="TRUE"/>
    <LOG MESSAGES Filename="C:\\Temp\\MacroExpressProLogFiles\\MacroExpressPro_Macro_Log_File.txt" Message="Macro executed: Temp_Extract_First_Letters" Stamp="TRUE"/>
    <LOG ERRORS Hide_Errors="FALSE" _ENABLED="FALSE"/>
    <COMMENT Value="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"/>
    <KEYSTROKE SPEED Delay="10"/>
    <MOUSE SPEED Delay="30"/>
    <COMMENT Value="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"/>
    <COMMENT Value=" "/>
    <COMMENT Value="Null character ascii 0"/>
    <VARIABLE SET TO ASCII CHAR Value="0" Destination="%NULL%"/>
    <COMMENT Value="BEL character ascii 7"/>
    <VARIABLE SET TO ASCII CHAR Value="7" Destination="%BEL%"/>
    <COMMENT Value="Escape character ascii 9"/>
    <VARIABLE SET TO ASCII CHAR Value="27" Destination="%ESC%"/>
    <COMMENT Value="Tab character ascii 9"/>
    <VARIABLE SET TO ASCII CHAR Value="9" Destination="%TAB%"/>
    <COMMENT Value="Line Feed (New Line) character ascii 10"/>
    <VARIABLE SET TO ASCII CHAR Value="10" Destination="%LINEFEED%"/>
    <COMMENT Value="Carriage Return character ascii 13"/>
    <VARIABLE SET TO ASCII CHAR Value="13" Destination="%CARRIAGERETURN%"/>
    <COMMENT Value="Carriage Return / Line Feed combination characters ascii 13 + ascii 10"/>
    <VARIABLE SET TO ASCII CHAR Value="13" Destination="%CRLF%"/>
    <VARIABLE MODIFY STRING Option="\x07" Destination="%CRLF%" Variable="%LINEFEED%" NoEmbeddedVars="FALSE"/>
    <COMMENT Value="STX character ascii 2"/>
    <VARIABLE SET TO ASCII CHAR Value="2" Destination="%STX%"/>
    <COMMENT Value="ETX character ascii 3"/>
    <VARIABLE SET TO ASCII CHAR Value="3" Destination="%ETX%"/>
    <COMMENT Value="DC1 character ascii 17"/>
    <VARIABLE SET TO ASCII CHAR Value="17" Destination="%DC1%"/>
    <COMMENT Value="DC2 character ascii 18"/>
    <VARIABLE SET TO ASCII CHAR Value="18" Destination="%DC2%"/>
    <COMMENT Value=" "/>
    <COMMENT Value=" "/>
    <VARIABLE SET STRING Option="\x00" Destination="%text%" Value="       Once upon a time, there was an ogre named Sandor.\r\n\r\nSandor lived in a 1000-room \"castle\" made of ice! \r\n\r\nChange all punctuation marks to \"blank punctuation blank\".\r\nChange CR-LF to a single character BEL that is unused elsewhere (surrounded by blanks).\r\nInsert one dummy blank at the beginning of the text.\r\nChange all multiple consecutive blanks to single blanks. \r\nRemove first character from text (must be a blank).\r\nRepeat until done: \r\n   Extract first character into result, remove from text.\r\n   Locate first blank in text, remove all characters up to that position.\r\nRepeat end\r\nChange all punctuation marks from \"blank punctuation blank\" to \"punctuation\".  \r\nChange selected punctuation marks to \"punctuation blank\" (periods, commas, etc.)  " NoEmbeddedVars="TRUE"/>
    <TEXT BOX DISPLAY Title="Diagnostics -- show text" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 %text%\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="1079" Height="409" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
    <IF VARIABLE Variable="%text%" Condition="\x06" Value="%CRLF%" IgnoreCase="FALSE" _ENABLED="FALSE"/>
    <TEXT BOX DISPLAY Title="Diagnostics" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 text contains crlf\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0" _ENABLED="FALSE"/>
    <END IF _ENABLED="FALSE"/>
    <COMMENT Value="Insert one blank at beginning of text "/>
    <VARIABLE SET STRING Option="\x00" Destination="%temptext%" Value=" " NoEmbeddedVars="TRUE"/>
    <VARIABLE MODIFY STRING Option="\x07" Destination="%temptext%" Variable="%text%" NoEmbeddedVars="TRUE"/>
    <VARIABLE MODIFY STRING Option="\x08" Destination="%text%" Variable="%temptext%" NoEmbeddedVars="TRUE"/>
    <TEXT BOX DISPLAY Title="Diagnostics -- text with extra blank at beginning" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 %text%\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="1079" Height="409" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0" _ENABLED="FALSE"/>
    <COMMENT Value="Change all multiple consecutive blanks to single blanks.  "/>
    <REPEAT START Start="1" Step="1" Count="20" Save="FALSE"/>
    <VARIABLE MODIFY STRING Option="\x0F" Destination="%text%" ToReplace="  " ReplaceWith=" " All="TRUE" IgnoreCase="TRUE" NoEmbeddedVars="FALSE"/>
    <END REPEAT/>
    <TEXT BOX DISPLAY Title="Diagnostics -- text with multi blanks compressed to single blanks" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 %text%\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="1079" Height="409" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0" _ENABLED="FALSE"/>
    <COMMENT Value="Surround punctuation marks with blanks "/>
    <VARIABLE MODIFY STRING Option="\x0F" Destination="%text%" ToReplace="." ReplaceWith=" . " All="TRUE" IgnoreCase="FALSE" NoEmbeddedVars="TRUE"/>
    <VARIABLE MODIFY STRING Option="\x0F" Destination="%text%" ToReplace="," ReplaceWith=" , " All="TRUE" IgnoreCase="FALSE" NoEmbeddedVars="TRUE"/>
    <VARIABLE MODIFY STRING Option="\x0F" Destination="%text%" ToReplace="-" ReplaceWith=" - " All="TRUE" IgnoreCase="FALSE" NoEmbeddedVars="TRUE"/>
    <VARIABLE MODIFY STRING Option="\x0F" Destination="%text%" ToReplace="!" ReplaceWith=" ! " All="TRUE" IgnoreCase="FALSE" NoEmbeddedVars="TRUE"/>
    <VARIABLE MODIFY STRING Option="\x0F" Destination="%text%" ToReplace="(" ReplaceWith=" ( " All="TRUE" IgnoreCase="FALSE" NoEmbeddedVars="TRUE"/>
    <VARIABLE MODIFY STRING Option="\x0F" Destination="%text%" ToReplace=")" ReplaceWith=" ) " All="TRUE" IgnoreCase="FALSE" NoEmbeddedVars="TRUE"/>
    <VARIABLE MODIFY STRING Option="\x0F" Destination="%text%" ToReplace=" \"" ReplaceWith=" %DC1% " All="TRUE" IgnoreCase="FALSE" NoEmbeddedVars="FALSE" _COMMENT="change left double-quote to DC1"/>
    <VARIABLE MODIFY STRING Option="\x0F" Destination="%text%" ToReplace="\"" ReplaceWith=" %DC2% " All="TRUE" IgnoreCase="FALSE" NoEmbeddedVars="FALSE" _COMMENT="change right double-quote to DC2 (all remaining double-quotes)"/>
    <VARIABLE MODIFY STRING Option="\x0F" Destination="%text%" ToReplace="%CRLF%" ReplaceWith=" %BEL% " All="TRUE" IgnoreCase="FALSE" NoEmbeddedVars="FALSE" _COMMENT="Change two-character sequence CRLF to single character BEL"/>
    <TEXT BOX DISPLAY Title="Diagnostics -- text after punctuation expansion" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 %text%\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="1079" Height="409" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
    <COMMENT Value="Remove first character from text "/>
    <VARIABLE MODIFY STRING Option="\x0A" Destination="%text%" Start="1" Count="1"/>
    <TEXT BOX DISPLAY Title="Diagnostics -- text after deleting leading blank" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 %text%\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="1079" Height="409" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0" _ENABLED="FALSE"/>
    <COMMENT Value="Extract first character of each word -- punctuation marks count as words"/>
    <VARIABLE SET STRING Option="\x00" Destination="%result%" NoEmbeddedVars="FALSE" _COMMENT="Clear result text"/>
    <VARIABLE MODIFY STRING Option="\x06" Destination="%text%" Value=" !@#$%^&*()" NoEmbeddedVars="FALSE" _COMMENT="Append garbage to end of text to identify where the end is"/>
    <REPEAT UNTIL Variable="%text%" Condition="\x00" Value=" !@#$%^&*()"/>
    <VARIABLE MODIFY STRING Option="\x09" Destination="%onechar%" Variable="%text%" Start="1" Count="1" NoEmbeddedVars="TRUE" _COMMENT="One character from text into temporary area"/>
    <VARIABLE MODIFY STRING Option="\x07" Destination="%result%" Variable="%onechar%" NoEmbeddedVars="TRUE" _COMMENT="Append extracted character to result"/>
    <VARIABLE MODIFY STRING Option="\x06" Destination="%result%" Value=" " NoEmbeddedVars="FALSE" _COMMENT="Append one blank to result"/>
    <VARIABLE SET INTEGER Option="\x0E" Destination="%index%" Text_Variable="%text%" Text=" " Ignore_Case="TRUE"/>
    <VARIABLE MODIFY STRING Option="\x0A" Destination="%text%" Start="1" Count="%index%" _COMMENT="Delete from text up to and including next blank space"/>
    <END REPEAT/>
    <TEXT BOX DISPLAY Title="Diagnostics -- text after processing to end" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 %text%\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="1079" Height="409" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0" _ENABLED="FALSE"/>
    <TEXT BOX DISPLAY Title="Diagnostics -- result text with one character per word" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 %result%\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="1079" Height="409" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
    <COMMENT Value="Change all multiple consecutive blanks to single blanks.  "/>
    <COMMENT Value="Adjust selected punctuation marks "/>
    <REPEAT START Start="1" Step="1" Count="20" Save="FALSE"/>
    <VARIABLE MODIFY STRING Option="\x0F" Destination="%result%" ToReplace=" ." ReplaceWith=". " All="TRUE" IgnoreCase="FALSE" NoEmbeddedVars="TRUE" _COMMENT="period"/>
    <VARIABLE MODIFY STRING Option="\x0F" Destination="%result%" ToReplace=" ," ReplaceWith=", " All="TRUE" IgnoreCase="FALSE" NoEmbeddedVars="TRUE" _COMMENT="comma"/>
    <VARIABLE MODIFY STRING Option="\x0F" Destination="%result%" ToReplace=" -" ReplaceWith="-" All="TRUE" IgnoreCase="FALSE" NoEmbeddedVars="TRUE" _COMMENT="hyphen"/>
    <VARIABLE MODIFY STRING Option="\x0F" Destination="%result%" ToReplace="- " ReplaceWith="-" All="TRUE" IgnoreCase="FALSE" NoEmbeddedVars="TRUE" _COMMENT="hyphen"/>
    <VARIABLE MODIFY STRING Option="\x0F" Destination="%result%" ToReplace=" !" ReplaceWith="! " All="TRUE" IgnoreCase="FALSE" NoEmbeddedVars="TRUE" _COMMENT="exclamation point"/>
    <VARIABLE MODIFY STRING Option="\x0F" Destination="%result%" ToReplace="!" ReplaceWith="! " All="TRUE" IgnoreCase="FALSE" NoEmbeddedVars="TRUE" _COMMENT="exclamation point"/>
    <VARIABLE MODIFY STRING Option="\x0F" Destination="%result%" ToReplace="( " ReplaceWith=" (" All="TRUE" IgnoreCase="FALSE" NoEmbeddedVars="TRUE" _COMMENT="left paren"/>
    <VARIABLE MODIFY STRING Option="\x0F" Destination="%result%" ToReplace="(" ReplaceWith=" (" All="TRUE" IgnoreCase="FALSE" NoEmbeddedVars="TRUE" _COMMENT="left paren"/>
    <VARIABLE MODIFY STRING Option="\x0F" Destination="%result%" ToReplace=" )" ReplaceWith=")" All="TRUE" IgnoreCase="FALSE" NoEmbeddedVars="TRUE" _COMMENT="right paren"/>
    <VARIABLE MODIFY STRING Option="\x0F" Destination="%result%" ToReplace="%DC1% " ReplaceWith=" \"" All="TRUE" IgnoreCase="FALSE" NoEmbeddedVars="FALSE" _COMMENT="left double-quote"/>
    <VARIABLE MODIFY STRING Option="\x0F" Destination="%result%" ToReplace=" %DC2% " ReplaceWith="\"" All="TRUE" IgnoreCase="FALSE" NoEmbeddedVars="FALSE" _COMMENT="right double-quote"/>
    <VARIABLE MODIFY STRING Option="\x0F" Destination="%result%" ToReplace="%BEL% " ReplaceWith="%CRLF%" All="TRUE" IgnoreCase="FALSE" NoEmbeddedVars="FALSE" _COMMENT="Change BEL characters back to CRLF"/>
    <END REPEAT/>
    <REPEAT START Start="1" Step="1" Count="20" Save="FALSE"/>
    <VARIABLE MODIFY STRING Option="\x0F" Destination="%result%" ToReplace="  " ReplaceWith=" " All="TRUE" IgnoreCase="TRUE" NoEmbeddedVars="FALSE" _COMMENT="double space to single space"/>
    <END REPEAT/>
    <IF VARIABLE Variable="%result%" Condition="\x06" Value="%CRLF%" IgnoreCase="FALSE" _ENABLED="FALSE"/>
    <TEXT BOX DISPLAY Title="Diagnostics" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 result contains crlf\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0" _ENABLED="FALSE"/>
    <END IF _ENABLED="FALSE"/>
    <TEXT BOX DISPLAY Title="Diagnostics -- final result after punctuation adjustment" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 %result%\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="1079" Height="409" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
    <COMMENT Value=" "/>
    <COMMENT Value=" "/>
    <MACRO RETURN/>
    <COMMENT Value=" "/>
    <COMMENT Value=" "/>

     

  11. Here's the text I'm converting, followed by the result.  Part of the text is yours, part of it is my notes as to how the macro should operate.  There are still some problems with double-quotes and with parentheses.

     

    TEXT:
           Once upon a time, there was an ogre named Sandor.

     

    Sandor lived in a 1000-room "castle" made of ice!

     

    Change all punctuation marks to "blank punctuation blank".
    Change CR-LF to a single character BEL that is unused elsewhere (surrounded by blanks).
    Insert one dummy blank at the beginning of the text.
    Change all multiple consecutive blanks to single blanks.
    Remove first character from text (must be a blank).
    Repeat until done:
       Extract first character into result, remove from text.
       Locate first blank in text, remove all characters up to that position.
    Repeat end
    Change all punctuation marks from "blank punctuation blank" to "punctuation".  
    Change selected punctuation marks to "punctuation blank" (periods, commas, etc.)  

     

    RESULT:
    O u a t,  t w a o n S.  

     

    S l i a 1- r"  c"  m o i!  

     

    C a p m t"  b p b" .  
    C C- L t a s c B t i u e  (s b b).  
    I o d b a t b o t t.  
    C a m c b t s b.  
    R f c f t  (m b a b).  
    R u d
    E f c i r,  r f t.  
    L f b i t,  r a c u t t p.  
    R e
    C a p m f"  b p b"  t"  p" .  
    C s p m t"  p b"   (p,  c,  e. )

  12. 10 minutes ago, acantor said:

    "Quick Search" has a limitation. If a text box happens to have keyboard focus, pressing the single quote character inserts the character instead of initiating the command.

    That's the first thing I discovered when testing out Quick Search.  But yes, your neutral area technique works.

     

    13 minutes ago, acantor said:

    The advantage is that Ctrl + F works whether or not a text box is focused.

    The biggest problem I have had with either one is, if the words being searched for appear more than once on the page -- how to get the right one.

  13. This command sequence works for me in Firefox, on several web sites, to log off.  The ESC keystroke is necessary.   Easy to test by doing it manually before incorporating it in a macro. 

     

      Text Type (Simulate Keystrokes): <CTRLD>f<CTRLU>
      Delay: 100 milliseconds
      Text Type (Simulate Keystrokes): log off
      Delay: 100 milliseconds
      Text Type (Simulate Keystrokes): <ESC>
      Delay: 100 milliseconds
      Text Type (Simulate Keystrokes): <ENTER>

     

  14. 1 hour ago, dgehman said:

    I'm going to have to learn how to search through the help file. "Parse" & "Parsing" didn't bring many hits.

    Getting familiar with the ME commands is something of a project.  You almost have to go through them one by one and look at all the options of each command, and use the Help file in conjunction with that.  It's often not obvious how the low-level commands can fit together to do a general function like "Parse". 

  15. 10 hours ago, acantor said:

    An impatient person might repeatedly press Esc in a futile attempt to force the hotkey to work. But what if the effort wasn't futile? The idea for the macro was that the window would close if you quickly pressed Esc enough times. I tried with three, four, and five presses in quick succession.

    Not so far-fetched.  I have a macro that is sort of a panic-button to kill runaway macros.  (I use it more often than you might think!)  It simulates typing the clumsy Macro Express key sequence to abort running macros, and does it multiple times "just in case", logging each time.  In fact what actually happens, almost always, is that the runaway, plus this abort macro itself, are both cancelled on the very first pass.  One odd thing is: if there are no other macros running, the ME box pops up telling me the abort macro itself has been halted; if there ARE other macro(s) running, everything is aborted but no pop-up appears.

     

    // Repeat abort sequence until this macro itself is aborted
    // Keystrokes defined in Macro Express Options | Preferences to abort macros
    Variable Set Integer %countr% to 0
    Repeat Start (Repeat 100 times)
      Variable Modify Integer %countr%: Increment
      Log Messages to "C:\Temp\MacroExpressProLogFiles\MacroExpressPro_Macro_Log_File.txt"
      "Macro Kybd_Abort_Running_Macros issuing abort %countr% time(s)"
      Text Type (Simulate Keystrokes): <WIN>`
      Delay: 500 milliseconds, without ability to halt
    End Repeat

     

  16. 11 hours ago, acantor said:

    I find that pressing "Alt+spacebar" followed by "c" closes almost all applications

    That's what my "kill" macro does -- courtesy of a previous post where you pointed out that method, thank you.  But I find that to be a clumsy key combination to press.  Maybe like the piano it would get easier with practice.  It's also pretty simple logic in a macro to locate the upper right corner of a window and click the X.  So the problem is not how to kill the application; the problem is how to get the macro to run in the first place when Windows blocks hotkey use.  Since Windows apparently does NOT block Macro Express from seeing the mouse, and since I often am using the mouse anyway, making use of it's movements is convenient.  It's a bit like flicking an app away on my wife's iPad or on the Android phone.  I wonder if there are others distinctive movements I could use for other functions ....

×
×
  • Create New...