Freigabe von Objekten erforderlich? Topic is solved

Stelle Fragen zur Programmierung mit Autohotkey

Moderator: jNizM

Rohwedder
Posts: 7616
Joined: 04 Jun 2014, 08:33
Location: Germany

Freigabe von Objekten erforderlich?

Post by Rohwedder » 19 Jan 2022, 09:43

Hallo,
mein SendWait(KeysNow, KeysLater, Time)
sendet den String KeysNow sofort und dann Time ms später KeysLater.
Hotkey Q sendet zuerst alle Großbuchstaben der Reihe nach und später nach dem Zeilenwechsel, umgekehrt.
Frage zu den hierfür erstellten 26 Objekten: Werden diese nach Ablauf der Timer automatisch freigegeben?

Code: Select all

q::
A := Asc("A"), T := 2000
Loop, 26
    SendWait(Chr(A), Chr(A++), T -= 30)
Send, `n
Return

SendWait(KeysNow:="", KeysLater:="", Time:=0)
{   SendInput,% KeysNow ; Sends 'KeysNow' now
    IF (KeysLater > "") ; and 'KeysLater' later
    {   Timer:=Func("SendWait").Bind(KeysLater)
        SetTimer,% Timer,% -Max(Abs(Time),1)
}}

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Freigabe von Objekten erforderlich?  Topic is solved

Post by swagfag » 19 Jan 2022, 09:53

  • [v1.0.46.16+]: If Period is negative, the timer will run only once. For example, specifying -100 would run the timer 100 ms from now then disable the timer as though SetTimer, Label, Off had been used.

    [v1.1.24+]: If Label is an object created by the script (not an actual function or label), the timer is automatically deleted after the timer function returns, unless the timer was re-enabled. This allows the object to be freed if the script is no longer referencing it, but it also means the timer's Period and Priority are not retained.

Rohwedder
Posts: 7616
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Freigabe von Objekten erforderlich?

Post by Rohwedder » 19 Jan 2022, 10:55

Thanks!

Post Reply

Return to “Ich brauche Hilfe”