v2 Tutorial code doesnt work? Topic is solved

Share your ideas as to how the documentation can be improved.
apollomagnus
Posts: 1
Joined: 07 Dec 2023, 20:45

v2 Tutorial code doesnt work?

07 Dec 2023, 21:20

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)”.]
AHK_user
Posts: 515
Joined: 04 Dec 2015, 14:52
Location: Belgium

Re: v2 Tutorial code doesnt work?

08 Dec 2023, 01:35

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.
tranht17
Posts: 52
Joined: 03 May 2017, 02:55

Re: v2 Tutorial code doesnt work?

08 Dec 2023, 03:55

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!"
User avatar
boiler
Posts: 16978
Joined: 21 Dec 2014, 02:44

Re: v2 Tutorial code doesnt work?

08 Dec 2023, 04:20

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.
User avatar
Ragnar
Posts: 614
Joined: 30 Sep 2013, 15:25

Re: v2 Tutorial code doesnt work?  Topic is solved

08 Dec 2023, 06:32

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.

Return to “Suggestions on Documentation Improvements”

Who is online

Users browsing this forum: No registered users and 40 guests