I'm trying to make a script that pulls text from the clipboard, reads the first line and converts it into a set two letter code.
If it doesn't match one of the specified ones, I'd like to display an InputBox that lets the user enter the two letter code themselves.
My current code is this, but it's not working for some reason and I can't for the life of me figure out why.
I've also tried to solve this with switch and assocArrays, but that didn't work either. I'd be happy to accept solutions using those, since if-loops aren't the most beautiful code afterall.
Code: Select all
F8::
ArtText := Clipboard
cat_array := StrSplit(ArtText, "`n")
if InStr(cat_array[1], case1)
{
ArtCat := C1
}
if InStr(cat_array[1], case2)
{
ArtCat := C2
}
if InStr(cat_array[1], case3)
{
ArtCat := C3
}
if InStr(cat_array[1], case4)
{
ArtCat := C4
}
if (ArtCat = "")
{
InputBox, ArtCat, Unknown category, Unknown category`, please enter the two letter code.,,200,160
}
MsgBox % ArtCat