BBO Posted November 6, 2020 Report Share Posted November 6, 2020 Self-taught very basic Macro Express hack. Been running ME for years. Mostly to rename/number lists of files. Upgraded to W10 & then ME 5.1 couple months ago. Saw that when i upgraded to 5.1, the variables changed format from T%1% to %T%, and the upgrade seemed to have automatically upgraded all my macro variables. So far, so good. Everything kept working fine. Then, about a week ago, when i went to run macros that have been running fine since the upgrades, i started getting this error: The following error was encountered: Undefined variable or the variable is the wrong type "20results" Macro Name: File REPLACE jpeg with jpg Line Number: 2 Here are the first three lines of that macro: VARIABLE SET STRING %T% to topmost window title WINDOW ACTIVATE %T% WAIT FOR WINDOW TITLE %T% I then upgraded from ME 5.1 to 188.8.131.52 - no change. Still getting the errors. The thing is, they worked one day. Didn't work the next. These macros were written a long time ago, and have been running fine for years. When i remove the VARIABLE SET STRING command and the remaining occurrences of the focusing algorithm: WINDOW ACTIVATE %T% WAIT FOR WINDOW TITLE %T% the macros still work fine. My goal with these lines is to focus the macro on the Windows Explorer window where the files are and then wait for it to be active. Otherwise, because sometimes the renaming changes the order of the files, and windows now insists on refreshing the view every time there's a change, sometimes the refresh takes longer than i have timed for in the macro, and the macro starts working on the wrong file. This was my solution since probably ME 2 or 3 to keep the macro and the window in sync. What am i doing wrong? Is there a better way to do this? Any thoughts would be greatly appreciated. Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.