Not your average 'WinMove not working' problem...

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
jcbannister
Posts: 3
Joined: 15 Dec 2016, 11:58

Not your average 'WinMove not working' problem...

Post by jcbannister » 28 Jun 2022, 13:36

Hey guys got a bit of a sticky one here! I'm trying to get WinMove to work but it seems all that happens is that Windows 10 kills the script instead. Been ignoring this problem for about a year now, hoping an update or something would knock it into shape but no luck as yet. Latest version of Windows 10/ AHK & Avast Free Antivirus being used, and testing this issue on two separate PC's as well.

I have various scripts that I use daily, three of which utilize the WinMove command for one reason or another. Then one day a good while ago I noticed all three of them just stopped working. Wasn't a massive issue for me so just been living with it but it's really getting irritating now.

So I just created a bare minimum code to test in isolation to see what's happening, and found it wasn't actually WinMove failing per se, rather it seems windows is suspending and then terminating any code that uses the WinMove command. If i comment that line out in my code, the script will run, but as soon as I un-comment it, the script gets killed again.

I thought maybe this is an antivirus thing or even something in windows defender, so I have a spare PC to test this. I uninstalled the antivirus & checked windows defender wasn't doing anything too. The PC is effectively blank as I did a factory reset & multiple subsequent windows updates on it only a month ago.

Code: Select all

#c::
SplashTextOn, 400, 300, Clipboard, The clipboard contains:`n%Clipboard%
WinMove, Clipboard,, 0, 0
MsgBox, Press OK to dismiss the SplashText
SplashTextOff
What I noticed is the splashtext disappears a couple seconds after displaying (without me pressing ok to dismiss the splashtext), and when I check my processes the ahk script is gone. So Loading it back up again and running it while watching the ahk process, I see it's there at first, then I hit #c and then I see the code gets suspended before getting killed off altogether a moment later. This happens for any code I have that uses WinMove, however afaik all my other non-WinMove scripts are working just fine.

Certainly a weird one, hope someone can help!

gregster
Posts: 8992
Joined: 30 Sep 2013, 06:48

Re: Not your average 'WinMove not working' problem...

Post by gregster » 28 Jun 2022, 14:02

Can't reproduce it, if I understand correctly. Nothing suspends or terminates here.
For me, it moves the SplashText window (named Clipboard) to 0,0, then it waits until I press OK - then I can start again with the defined hotkey.

I would add a return, but that shouldn't matter for this supposed error, if I only run this snippet alone, with no code following.
Otherwise, code execution will fall through to following code (which might explain the unexpected behaviour you are seeing). So... you should add a return at the end oof the hotkey subroutine.

What are you typically having on the clipboard? Perhaps that's the key...


Could be relevant, if you would be using specific clipboard contents as the wintitle (which you are not doing right now):
Spoiler

PS: I deleted your only post on these forums before today (from years ago), because you emptied it back in the day after you got a response.
Please don't do that (again). That's not the idea of a forum, and also against the forum rules. Thank you!

jcbannister
Posts: 3
Joined: 15 Dec 2016, 11:58

Re: Not your average 'WinMove not working' problem...

Post by jcbannister » 28 Jun 2022, 15:19

Hey thanks for your reply! Yeah that was the entire contents of the file, so no need for a return as you say. I actually just cut paste it from the WinMove ahk help file to demonstrate the issue, so not relying on clipboard or anything.

After having an outsider's perspective though I decided to look again. It was actually AHK portable that's causing the issue - sorry I failed to mention I was using a portable version, I didn't even think it would matter. So I downloaded vanilla AHK & installed it and now my code runs fine.

It's a shame because being able to use AHK without installing comes in really handy a lot of the time, but it seems it's not getting the same level of support as 'normal' AHK?

Forgive my ignorance if the portable version is frowned upon or whatever, I'm not particularly fussy on how I get my solutions :monkeysee:

PS: Oh yeah, sorry that was a long time ago! No idea what tonic I was on back then, haha.

gregster
Posts: 8992
Joined: 30 Sep 2013, 06:48

Re: Not your average 'WinMove not working' problem...

Post by gregster » 28 Jun 2022, 15:38

jcbannister wrote:
28 Jun 2022, 15:19
After having an outsider's perspective though I decided to look again. It was actually AHK portable that's causing the issue - sorry I failed to mention I was using a portable version, I didn't even think it would matter. So I downloaded vanilla AHK & installed it and now my code runs fine.

It's a shame because being able to use AHK without installing comes in really handy a lot of the time, but it seems it's not getting the same level of support as 'normal' AHK?

Forgive my ignorance if the portable version is frowned upon or whatever, I'm not particularly fussy on how I get my solutions :monkeysee:
I have never really used the zip-version, but afaik, there is no difference between autohotkey.exe files of the portable and the installer version. The installer should be the only difference.

You might need the installer for creating some registry keys that assign the .ahk file extension automatically to autohotkey.exe, and for creating UIA support (but I didn't choose that option for my current installation), but I can't think of a reason that these differences would cause your problems. (Well, you can also update, uninstall and enable separate taskbar buttons with it, iirc.)

I just downloaded the latest zip version, unzipped it, and ran your snippet specifically with all three autohotkey.exe variants it contained. Sorry, I still can't reproduce the problem. 🤷‍♂️ Perhaps others have more insights...

gregster
Posts: 8992
Joined: 30 Sep 2013, 06:48

Re: Not your average 'WinMove not working' problem...

Post by gregster » 28 Jun 2022, 16:02

Looking closer at the AHK changelog, my guess is that you used version 1.1.29.00 (from 2018) before you updated...
https://www.autohotkey.com/docs/AHKL_ChangeLog.htm#v1.1.29.01 wrote:1.1.29.01 - June 2, 2018

Fixed WinMove crashing the program in some cases [broken by v1.1.29.00].
At least that could explain it... in that case, it wouldn't be a matter of installer/portable version after all.

gregster
Posts: 8992
Joined: 30 Sep 2013, 06:48

Re: Not your average 'WinMove not working' problem...

Post by gregster » 28 Jun 2022, 16:10

gregster wrote:
28 Jun 2022, 16:02
Looking closer at the AHK changelog, my guess is that you used version 1.1.29.00 (from 2018) before you updated...
To confirm, I downloaded the old 1.1.29.00 zip version (although it surely affected both variants) and tried your snippet - and it actually crashed the corresponding AHK process :problem:
If that's the reason, you were quite unlucky, because v1.1.29.00 was only the latest version for a week or so, then it already got superceded by v1.1.29.01 which contained a fix.
That would also explain why no one else complained in recent years, at least not that I remember. After all, we have a number of users which also use the zip-version for various reasons.

jcbannister
Posts: 3
Joined: 15 Dec 2016, 11:58

Re: Not your average 'WinMove not working' problem...

Post by jcbannister » 29 Jun 2022, 11:09

Unlucky - Yep that sums up most of my life's pursuits, haha. Ah ok so it seems I've been picking up my portable ahk versions from perhaps a less appropriate source. Until now I was actually unaware of the .zip version being freely available from the AHK main web page under 'other versions' *facepalm*. Guessing it's against forum rules to say where exactly I got it, but it's a popular portable app website I follow that is still hosting a dated version of what I'd assumed was the latest version of ahk.

Anyway, I've uninstalled ahk and tested with the .zip version and that thing is purring like a kitty now - WinMove 'til the cows come home. Cheers for the steer on that gregster, it's mega that you managed to help us out!

gregster
Posts: 8992
Joined: 30 Sep 2013, 06:48

Re: Not your average 'WinMove not working' problem...

Post by gregster » 29 Jun 2022, 21:04

Good to hear, you are welcome!

...not against the forum rules, but obviously we recommend to get your downloads from our website, or from lexikos' github.
lexikos (our main developer since 2009 or so) himself also updates the links on our downloads page, afaik.

His releases page on github only lists the installer version, it seems.
But since the installer is an self-extracting 7-zip archive, you should even be able to unzip that exe and use the contained files without installation. I think that's why lexikos doesn't provide a separate zip-version on github: it would be mostly redundant.


Here, I opened the installer with winrar:
unzipped installer.png
unzipped installer.png (61.01 KiB) Viewed 523 times

Or simply use the zip-link from our downloads page which you discoverd. ;)

Post Reply

Return to “Ask for Help (v1)”