Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
31
Task/Queue-Definition/AutoHotkey/queue-definition.ahk
Normal file
31
Task/Queue-Definition/AutoHotkey/queue-definition.ahk
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
push("qu", 2), push("qu", 44), push("qu", "xyz") ; TEST
|
||||
|
||||
MsgBox % "Len = " len("qu") ; Number of entries
|
||||
While !empty("qu") ; Repeat until queue is not empty
|
||||
MsgBox % pop("qu") ; Print popped values (2, 44, xyz)
|
||||
MsgBox Error = %ErrorLevel% ; ErrorLevel = 0: OK
|
||||
MsgBox % pop("qu") ; Empty
|
||||
MsgBox Error = %ErrorLevel% ; ErrorLevel = -1: popped too much
|
||||
MsgBox % "Len = " len("qu") ; Number of entries
|
||||
|
||||
push(queue,_) { ; push _ onto queue named "queue" (!=_), _ string not containing |
|
||||
Global
|
||||
%queue% .= %queue% = "" ? _ : "|" _
|
||||
}
|
||||
|
||||
pop(queue) { ; pop value from queue named "queue" (!=_,_1,_2)
|
||||
Global
|
||||
RegExMatch(%queue%, "([^\|]*)\|?(.*)", _)
|
||||
Return _1, ErrorLevel := -(%queue%=""), %queue% := _2
|
||||
}
|
||||
|
||||
empty(queue) { ; check if queue named "queue" is empty
|
||||
Global
|
||||
Return %queue% = ""
|
||||
}
|
||||
|
||||
len(queue) { ; number of entries in "queue"
|
||||
Global
|
||||
StringReplace %queue%, %queue%, |, |, UseErrorLevel
|
||||
Return %queue% = "" ? 0 : ErrorLevel+1
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue