Jump to content

How to Script for a Program that Changes Class Names Every Time is Restarts?


Recommended Posts

I came over a pretty weird problem today while using AutoIt...

I'm trying to use WinMove to move a window to (0, 0) every time it opens, because for some reason, the program doesn't save its position when it's closed and re-opened again. The program is called Todoist. Since WinMove requires a Class name, I found it, copied it, and pasted it into the script. I restarted the program and ran the script, but the window didn't move. I carefully examined the code, finding nothing wrong with it. I tried it with Notepad and it worked fine. So I decided to check out the Class name again...

...sure enough, the name had completely changed on me.

After restarting the program a few more times, I discovered that the name changes every time the program is closed and re-opened. This means that in order to move an open window of the program to (0, 0), I need to find a way to have AutoIt check for the program's Class name every time the app starts (or every time I start the script) and use that as the Class name to successfully run the script. Is there any way to do this?

Can anyone think of a workaround if what I'm suggesting isn't possible to achieve? I'm not too advanced at this yet either, so the more code you can actually write out for me, the better. Thanks!

Link to comment
Share on other sites

You can use the title of the window like you have used the class name.

Have you tried that?

Edited by MikahS

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

We are here to help. :)

My pleasure. ;)

Edited by MikahS

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...