WinWaitNotActive Timeout - Wait Forever Topic is solved

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
JJohnston2
Posts: 204
Joined: 24 Jun 2015, 23:38

WinWaitNotActive Timeout - Wait Forever

Post by JJohnston2 » 12 Jun 2023, 00:20

WinWaitNotActive WinTitle, WinText, Timeout, ExcludeTitle, ExcludeText
  • ...
  • Timeout
    Type: Integer or Float
    How many seconds to wait before timing out and returning 0. Leave blank to allow the function to wait indefinitely.
  • ...

I use variables sometimes to denote the argument meaning in functions where either A) I tend to forget what the argument order is or B) skip some of the arguments in the function call.

For the WinWaitNotActive command, if I want to have it wait forever, the timeout has to be blank, so something like this:
  • WinWaitNotActive(winTitle,,)
If I wanted to assign a variable name for a 'forever' timeout (which I would typically do for clarity and explicitness), such that the code looks something like this below, what would be assigned to that variable to make it 'blank'?
  • WinWaitNotActive (winTitle,,forever:=???)
These do not work:
  • WinWaitNotActive (winTitle,,forever) ; Warning: This variable appears to never be assigned a value.
  • WinWaitNotActive (winTitle,,forever:=0) ; No timeout / exits immediately
  • WinWaitNotActive (winTitle,,forever:=-1) ; Error: Parameter #3 of WinWaitNotActive is invalid.
  • WinWaitNotActive (winTitle,,forever:="") ; Error: Parameter #3 of WinWaitNotActive requires a Number, but received an empty string.

ntepa
Posts: 439
Joined: 19 Oct 2022, 20:52

Re: WinWaitNotActive Timeout - Wait Forever  Topic is solved

Post by ntepa » 12 Jun 2023, 01:44

Try

Code: Select all

WinWaitNotActive(winTitle,,forever?)
https://www.autohotkey.com/docs/v2/Language.htm#optional-parameters wrote:The maybe operator (var?) can be used to pass or omit a variable depending on whether it has a value.

JJohnston2
Posts: 204
Joined: 24 Jun 2015, 23:38

Re: WinWaitNotActive Timeout - Wait Forever

Post by JJohnston2 » 13 Jun 2023, 23:20

Most excellent, thank you much...

Post Reply

Return to “Ask for Help (v2)”