Jump to content
Macro Express Forums

Text Type truncates values of variables


Recommended Posts

I have a macro to iterate through a directory of files, open each one and perform functions, which involve saving the processed file to a different filename. Unfortunately, the output of the directory and filename is truncated. The amount of truncation appears to be different from time to time. I using ME Pro 6

 

Name    Value
dirNG    C:\Users\abc123\Downloads\ABCD\QEEG\ABCDE\NG\
T[1]    ABCDE_20230210_EC.ng

 

Text Type (Simulate Keystrokes): %dirNG%%T[1]%

 

Output in file open dialog:
C:\Users\abc123\Downloads\ABCD\QEEG\ABCDE\NG\ABCDE_20230
--or--
C:\Users\abc123\Downloads\ABCD\QEEG\ABCDE\NG\ABCDE_2023010
--or--
C:\Users\abc123\Downloads\ABCD\QEEG\ABCDE\NG\ABCDE_2023010_EC
 

Link to comment
Share on other sites

Try inserting longish (500 ms?) pauses before and after each Text Type instruction.

 

If it works, reduce the length of the pauses.

 

You might also try breaking up the Text Types, from this:

 

Text Type (Simulate Keystrokes): %dirNG%%T[1]% 

 

To this... at least until you sort out what's causing truncation.

 

Text Type (Simulate Keystrokes): %dirNG% 
Text Type (Simulate Keystrokes): %T[1]% 

 

  • Like 1
Link to comment
Share on other sites

Just a shot in the dark -- do you have a command like this

 

Keystroke Speed: 30 milliseconds

 

at the beginning of your macro?

It may be that the "typing" is over-running the application -- characters being presented faster than the application can absorb them. 

 

Edit: My posting overlapped with acantor.  But I see we are thinking along the same lines.

  • Like 1
Link to comment
Share on other sites

Other thoughts:

 

1. It sounds like you are invoking the "Open" dialog to open specific documents. Good on you for entering the full path into the File name field, rather than the clunky alternative of using Macro Express to navigate through the Open dialog box to choose the folder. 

 

It takes time for the Open dialog to appear and be ready to accept input. You can either slip in a short delay, or monitor the presence of the Open dialog:

 

Variable Set Bool %IsOpenReady% to "False"
 
Text Type (Simulate Keystrokes): <CONTROL>o
 
Repeat Start (Repeat 10 times)
  Delay: 200 milliseconds
  If Window "Open" is focused
    Variable Set Bool %IsOpenReady% to "True"
    Repeat Exit
  End If
End Repeat
 
If Variable %IsOpenReady% Equals "False"
  MessageBox: The "Open" dialog did not appear!
  Macro Stop
End If
 
Text Type (Simulate Keystrokes): %FullPathToFile%

 

But this approach might be overkill, since a half-second delay will likely accomplish the same.

  • Like 1
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...