F1::
ClipSaved := ClipboardAll ; save clipboard
Loop
{
If GetKeyState("F2","P") ; terminate the loop whenever you want by pressing F2
break
clipboard = ; empty the clipboard (start off empty to allow ClipWait to detect when the text has arrived)
; Send, +^{Left} ; select text by whole words to the left
Send, +{Left} ; select text by single characters to the left
Send, ^c ; copy selected text
ClipWait ; wait until the clipboard contains data
StringLeft, OutputVar, clipboard, 1 ; save the first character from the left side of the clipboard in the variable OutputVar
If OutputVar = - ; if the specific character "-" has been found
break ; terminate the loop
}
clipboard := ClipSaved ;restore original clipboard
return
link