[Request] Wait control flow

Discuss the future of the AutoHotkey language
iseahound
Posts: 1434
Joined: 13 Aug 2016, 21:04
Contact:

[Request] Wait control flow

Post by iseahound » 01 Apr 2021, 13:30

This is a vague post, but a lot of the time I find myself writing custom code that tries to mimic ClipWait or WinWait. There should be some kind of built in control flow to write custom wait statements. The motivation is that Windows is often slow especially over remote connections, so simple tasks like creating a file need to be checked otherwise the code will fail. Some of the functionality requested:
  • takes a condition that evaluates to True
  • the ability to define the the seconds to wait, the number of checks, and how often to check (e.g. exponential backoff)
  • be able to raise an error on timeout, with a custom error message
  • include an optional callback on success or failure
  • and be non-blocking. (This is already true for all AHK code).
I know this is asking for a lot, but it would definitely help develop the language to handle more automation focused tasks. I'm not asking for FileWait, but it's obvious how important wait statements already are in AHK. Finally it should be simple for new users. I'm aware of promises, async etc. so I don't know if simplicity is possible.

Return to “AutoHotkey Development”