I'm new to the forum but not AHK since i've used it to streamline many steps at my workplace.
But now i'm at a stand still, i'm trying to do a script that fetches a license plate number from our Customer service software. The Customer fills in a form and adds his or hers licenseplate number in a specific field. So the text could be anywhere between 1 to 1000 lines.
Example:
Fråga:
Hi!
This is a test!
Best regards
Registreringnummer: ABC123
Kontaktas via: epost
Namn: John Doe
So what i'm trying to do is to fetch the word next after "Registreringsnummer:", the placement changes depending on the length of the e-mail but the word stays the same. My own tries with Instr, StringGetPos, SubStr and RegExMatch has fallen short with either no data or the whole e-mail.
The software is proprietary so to get the whole text i've done like this to get the whole e-mail copied.
Code: Select all
::reg::
Clipboard =
send ^{end}^+{home} ;Select all
Send ^c
Clipwait, 1
data := Clipboard ;Clipboard contents becomes var
FoundPos := InStr(data, Registreringsnummer) ;search text for "Registreringsnummer"
Regnr := Substr(FoundPos, , 7) ;get the text with license plate number, which could be up to 7 characters
Clipboard = %Regnr% ;add license plate number to clipboard