Page 1 of 1

v2 Tutorial code doesnt work?

Posted: 07 Dec 2023, 21:20
by apollomagnus

Code: Select all

Run "notepad",,, &pid
WinWaitActive "ahk_pid " pid
SendText "Hello, world!"
I'm going through the tutorial documentation and I've been trying to get this code to work, but it wont go pas the WinWaitActive line.
This specific code example can be found in Tutorial- Run Programs- Run's Parameters


[Mod action: Moved topic from “Tutorials (v2)”.]

Re: v2 Tutorial code doesnt work?

Posted: 08 Dec 2023, 01:35
by AHK_user
It should normally work, please check if you have notepad installed on you computer.

This is certainly not the correct place for this post, Please move it to Bug reports.

Re: v2 Tutorial code doesnt work?

Posted: 08 Dec 2023, 03:55
by tranht17
Because the tutorial use the Classic Notepad version and you use the new UWP Notepad version.
On this new UWP Notepad version, you will not be able to get its correct pid if you use:

Code: Select all

Run "notepad",,, &pid
Use this code:

Code: Select all

Run "notepad"
WinWaitActive("ahk_exe notepad.exe")
SendText "Hello, world!"

Re: v2 Tutorial code doesnt work?

Posted: 08 Dec 2023, 04:20
by boiler
Moved from “Tutorials (v2)” to “Suggestions on Documentation Improvements” (as opposed to “Bug Reports”) since it is not an AHK bug and the resolution for making it work for all versions of Windows is to modify the tutorial’s example script.

Re: v2 Tutorial code doesnt work?  Topic is solved

Posted: 08 Dec 2023, 06:32
by Ragnar
Thanks for reporting. I've changed it to the following, which works on all supported OS versions:

Code: Select all

Run "mspaint",,, &pid
WinWaitActive "ahk_pid " pid
Send "^e"  ; Ctrl+E opens the Image Properties dialog.