This should accomplish that:
Begin Boolean Compare : [>>{CMDWHENISAY}waiting] Equals True
End Condition - Exit when condition met
Set Boolean [>>{CMDWHENISAY}waiting] to True
Set date [~timeout] to [~timeout] plus [300] milliseconds
Set Boolean [~waitingForRelease] to True
Start Loop While : [~timeout] Is After Current Date/Time
Begin Device State Check : Keyboard Key 'A' Is Pressed
Begin Boolean Compare : [~waitingForRelease] Equals False
Set integer [~pressCount] to [~pressCount] plus 1
Begin Integer Compare : [~pressCount] Equals 2
Loop Break
End Condition
Set date [~timeout] value to [Not Set]
Set date [~timeout] to [~timeout] plus [300] milliseconds
Set Boolean [~waitingForRelease] to True
End Condition
Else
Set Boolean [~waitingForRelease] to False
End Condition
End Loop
Begin Integer Compare : [~pressCount] Equals 0
Write [Blue] 'Single press' to log
Else If Integer Compare : [~pressCount] Equals 1
Write [Blue] 'Double press' to log
Else
Write [Blue] 'Triple press' to log
End Condition
Set Boolean [>>{CMDWHENISAY}waiting] to False
The way it's set up, you have 300ms after pressing a key to register a subsequent press. E.G. if you press once, you'll have 300ms in which you need to perform the second press, and 300ms after the second press in which you need to perform the third press.
These include the time the key is held down, E.G. if you hold down A for 150ms then release, you have another 150ms to press it again in order to register a second press.
It's also set up so holding a key down will still allow the command to function, E.G. if you press, release, then hold within 300ms and keep holding down the key, that will register as a double press.