0
votes

I wrote a script using autohotkey, which has to execute a few clicks inside a window. Mostly, I used the ControlClick function to do the job, and it works well. I had to click a chechbox, and for that I used the MouseClick function.

I used relative coordinates for the functions (relative meaning x and y starting from the top left corner of the current active window).

If I run the script on my PC, it activates the window I want it to correctly and does what I programmed it to, but when I compile an executable and run it on a different workstation (I change only the workstation, not the programs in use, not even the operating system), it just doesn't work, I have the feeling it confuses x coordinates with y coordinates, the sleep function doesn't work anymore...

My actual question would be how can I make sure the script runs the same in any conditions? How can I make sure I select the right window, can't I select it using something different than it's title? Maybe a class, or something more specific?

Thanks a lot :D !

1
Sharing your script code can help us help you. This link explains "How to create a Minimal, Complete, and Verifiable example": stackoverflow.com/help/mcveDoron Yakovlev-Golani
I thought about sharing the code, but there are privacy therms... I can't :))Sergiu Jugarean
Any thoughts on "why my code works on one machine, and doesn't work on another similar machine"Sergiu Jugarean
It could be one of a million reasons - different configuration, environment variables, OS version, etc...Doron Yakovlev-Golani

1 Answers

0
votes

It was woking differently because the screen resolutions were not the same, so if I clicked at x100 y100 on 1280x1024, it was not the same as x100 y100 on 1920x1080 (relative coordinates), so I had to scale the coordinates, and after doing this, it worked.

If one has same problem as I did, I hope this will be useful :D .