Jump to content
Macro Express Forums

Window Activate error with Windows 10 20H2 ME 5.2.0.1


Recommended Posts

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[1]%, 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[6]% to topmost window title
 WINDOW ACTIVATE %T[6]%
 WAIT FOR WINDOW TITLE %T[6]%

 

I then upgraded from ME 5.1 to 5.2.0.1 - 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[6]%
 WAIT FOR WINDOW TITLE %T[6]%

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.

 

 

 

Link to post
Share on other sites
  • 3 weeks later...

I suggest re-doing the three lines. You can comment out the originals, or delete them. Then recreate the three lines from scratch.

 

I'm not convinced the logic you've outlined is what is needed. Also, Windows 10 File Explorer has a lot of focus-related problems that might be throwing off a script that was developed for earlier versions of Windows.

 

If you are making changes in the File Explorer window while the File Explorer is active, I don't think you need to activate the window. Maybe if renaming is taking time that is throwing of the synchronization, a refresh might be a better option. I believe the built-in hotkey for this is F5. So maybe something like this:

 

Quote

Text Type (Simulate Keystrokes): <F2> // Hotkey to rename a file or folder
Delay: 100 milliseconds // You may or may not need a short delay
Text Type (Simulate Keystrokes): Hello // Enter the new name
Text Type (Simulate Keystrokes): <ENTER> // Finalize the rename
Text Type (Simulate Keystrokes): <F5> // Refresh the screen, if needed

 

Link to post
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...