Comments (13)
Thanks!
from vd.ahk.
interesting..
using a debugger, you can see exactly which line causes a crash
vscode https://marketplace.visualstudio.com/items?itemName=zero-plusplus.vscode-autohotkey-debug
with https://marketplace.visualstudio.com/items?itemName=mark-wiemer.vscode-autohotkey-plus-plus
I ran on Windows 11, no crash
fresh Windows install
how do you get a fresh Windows install that easily ? Vmware ?
I shall use that to get Windows 10
it's interesting that you can use
"ahk_id" hwnd
instead of
"ahk_id " hwnd
from vd.ahk.
I ran your code on windows 10 vmware, no crash
by "explorer shell", do you mean explorer.exe ? with taskbar and desktop ?
from vd.ahk.
The windows that cause the problem seem to be invisible to the user, which means that the built in commands return blank strings for the process path or class name
then what's the wintitle ? VD.getDesktopNumOfWindow
should return -1 for empty "" wintitle
Maybe it's your AHK version ? as last hope ?
mine is 1.1.33.10
MsgBox % Clipboard:=A_AhkVersion
from vd.ahk.
how do you get a fresh Windows install that easily ? Vmware ?
I got the fresh install using the Windows Sandbox.
And I also just tried it with vmware, same result sadly.
The ahk version is 1.1.33.11 and the Windows 10 version is 21H2
by "explorer shell", do you mean explorer.exe ? with taskbar and desktop ?
using a debugger, you can see exactly which line causes a crash
I already tried using a debugger yesterday, but I will try again as soon as I have the time to.
then what's the wintitle ?
I will try to identify the wintitle
from vd.ahk.
Also, if I run the code from the global_functions
branch, then the shell does not crash.
from vd.ahk.
I got it, I got the bug, now I can try to fix it (on Win11 and Win10)
ahk classes are a pain to debug
if I use If (d > -1)
instead of if (d != -1)
then the problem becomes apparent that I didn't include the class
I thought it would throw an error if the class isn't included, but nothing happens, it just runs
the class VD
isn't even included and these 2 methods run without throwing...
VD.init()
VD.getDesktopNumOfWindow("ahk_id" hwnd)
needed #Include _VD.ahk
at the top
Also, if I run the code from the global_functions branch, then the shell does not crash.
good news, then it's fixable
Windows Sandbox. ? wow I forgot about that. seeing it being used for debugging makes me want to try it
thank you
from vd.ahk.
ahk classes are a pain to debug
Yeah, ahk in general is not that much fun to debug...
Ah yes, it can be really frustrating that ahk just ignores errors
I use Windows Sandbox all the time. It's really useful if you just want to try out a new program, but you don't want to install it on your main machine and it boots much faster than normal VMs. But if I remember correctly it only works on the Pro versions and not Home
from vd.ahk.
Windows Shell Experience Host
ahk_class Windows.UI.Core.CoreWindow
ahk_exe ShellExperienceHost.exe
Inside of class, I was setting DetectHiddenWindows Off
, so no WinTitle..
from vd.ahk.
Ah I see
from vd.ahk.
I think I could locate the problem: It has to be somewhere inside of the _getFirstValidWindow(wintitle)
method, because I modified the method to just return the hwnd that it received and now there are no crashes anymore.
from vd.ahk.
you may want to do it like this
;VD.getDesktopNumOfWindow will filter out invalid windows`
#Include ..\VD.ahk
foundProcesses := ""
; Make sure to get all windows from all virtual desktops
DetectHiddenWindows On
WinGet, id, List
Loop %id%
{
hwnd := id%A_Index%
;VD.getDesktopNumOfWindow will filter out invalid windows
desktopNum_ := VD.getDesktopNumOfWindow("ahk_id" hwnd)
If (desktopNum_ > -1) ;-1 for invalid window, 0 for "Show on all desktops", 1 for Desktop 1
{
WinGet, exe, ProcessName, % "ahk_id" hwnd
foundProcesses .= desktopNum_ " " exe "`n"
}
}
MsgBox % foundProcesses
I think I should add this code block in the README.md
https://github.com/FuPeiJiang/VD.ahk/blob/da6445cfadfce8ddef1e70751ee319507422d461/other%20examples/foundProcesses_min.ahk
https://github.com/FuPeiJiang/VD.ahk/blob/da6445cfadfce8ddef1e70751ee319507422d461/other%20examples/foundProcesses.ahk
from vd.ahk.
Yeah, ahk in general is not that much fun to debug...
Ah yes, it can be really frustrating that ahk just ignores errors
oh, ahkv2 fixed it, so that's not ahk's issue, I think ahkv2 is 10x easier to debug
from vd.ahk.
Related Issues (20)
- After pinning with AH2 version, I get an error when switching desktops by number.
- Script sending "Q" to discord | Desktop switch failure. HOT 2
- getDesktopNumOfWindow sometimes returns -1 rather than the correct num HOT 4
- Error HOT 10
- open Application directly on one virtual desktop in background HOT 2
- "Error: (0x80004002) No such interface supported" after updating Windows 11 (Beta insider channel) HOT 13
- sending keypress to specified virtual desktop only.
- Ah2: Desktop Looping & Switching + Other Feature Regression from Commit ee2f54f626914273f00853306c1daaf803f756cb HOT 2
- It doesn't work on Windows 11 Build 22621.2215 (22H2) HOT 2
- A problem with the new Windows update 11 HOT 18
- Virtual desktop Tasksbar icons HOT 4
- renaming desktops HOT 1
- Switching to Relative Desktop fails initially HOT 2
- Current desktop count is always zero
- New Windows Build 23606: VD.getCurrentDesktopNum() always returns 0 HOT 4
- Windows Server 2022 version HOT 3
- It doesn't work on Windows 11 Build 22631.3085 (23H2) HOT 13
- v2_port分支没有 TogglePinApp,PinApp,UnPinApp HOT 2
- WinExist in another virtual desktop HOT 7
- Previous Desktop HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vd.ahk.