Jump to content
Macro Express Forums

Macro to copy large blocks of text -- delay between copy action poses problem


Recommended Posts

I'm using a "clipboard extender" that holds permanently everything copied to the clipboard.

 

My Macro Express Pro macro, then, copies (Ctrl-C) blocks -- some blocks quite large -- in sequence, one after the other.

 

Let's assume 100 copy actions, 100 blocks.

 

Examining the finished compilation, unfortunately, some blocks are getting dropped.

 

Say, only 79 blocks make it. 21 blocks get dropped.

 

It appears that the next copy action is happening too fast, before the current block (presumably particularly large) is completely copied to clipboard.

 

I've tried various lengths of DELAY -- 2, 4, 8 seconds -- between copy actions. With longer delays, fewer blocks get dropped.

 

What would be ideal, though, would be a DYNAMIC DELAY, that would not proceed to the next copy action until each full block is safely copied into the clipboard, regardless of its size.

 

Does such DYNAMIC DELAY currently exist in Macro Express Pro??

 

I see there is a "Wait for Control" possibility. Would that be the solution, as opposed to the "Delay" I presently use?

 

Any help will be greatly appreciated.

 

Nicholas Kormanik

Link to comment
Share on other sites

My suggestion is to follow the logic below:

Repeat until all variables have been copied to the clipboard
 repeat until %n[1]% <> %n[1]% (i.e. for ever)
copy Var1 value to clipboard
read clipboard value into Var2
if Var1 = Var2 exit inner repeat
delay 500ms
 end inner repeat
end outer repeat

 

You can make this more sophisticated by counting the failures and terminating the macro after dome specified number of failures within the inner loop.

Link to comment
Share on other sites

You might try empty clipboard, copy to clipboard, then set variable to clipboard. Then you could have a loop with a short delay like 200mS that would only continue when clipboard does not equal nothing.

Link to comment
Share on other sites

  • 3 months later...

Has anyone written a macro for MEP to copy text from text files located in a folder and appending the text sequentially to make an independent large text file containing all the text from the other text files?

 

The text files are from a batch run on an OCR program called Tesseract OCR 3.01 run under GUI interface called VietOCR ( PS its FREE)

Link to comment
Share on other sites

  • 3 months later...

You can just do this with plain old DOS copy command. Assuming all the text files are in one folder and you want the final file to be in the same folder, you just need cd to the right location and type:

 

copy *.txt mergedfile.txt

 

You can also make use of DOS in MEP to achieve similar results - just use Program Launch with cmd.exe, which is the command-line interpreter, i.e. the Dos prompt. You don't have to include the full path for cmd.exe. You can then put these in the Program Parameters:

 

/K copy "C:\Users\Lemming\Desktop\test\*.txt" "C:\Users\Lemming\Desktop\test\mergedfile.txt"

 

The /K option keeps the Dos window open after the command is finished. This would also pause your script till the window is closed. If you want the window to close immediately, change /K to /C. You'll also need to specify the full path for your files.

 

 

Has anyone written a macro for MEP to copy text from text files located in a folder and appending the text sequentially to make an independent large text file containing all the text from the other text files? The text files are from a batch run on an OCR program called Tesseract OCR 3.01 run under GUI interface called VietOCR ( PS its FREE)
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...