msibleyj Posted December 19, 2023 Report Share Posted December 19, 2023 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 Quote Link to comment Share on other sites More sharing options...
acantor Posted December 19, 2023 Report Share Posted December 19, 2023 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]% 1 Quote Link to comment Share on other sites More sharing options...
rberq Posted December 19, 2023 Report Share Posted December 19, 2023 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. 1 Quote Link to comment Share on other sites More sharing options...
acantor Posted December 19, 2023 Report Share Posted December 19, 2023 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. 1 Quote Link to comment Share on other sites More sharing options...
msibleyj Posted December 19, 2023 Author Report Share Posted December 19, 2023 Putting in some short delays helped. But, I also noticed that the problem occurred during debugging while stepping through. It works much better when just invoking the macro. Quote Link to comment Share on other sites More sharing options...
Samrae Posted December 19, 2023 Report Share Posted December 19, 2023 The Wait for Text Playback may help: Text Type (Simulate Keystrokes): %dirNG%%T[1]% Wait for Text Playback 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.