Quantcast
Channel: AutoHotkey Community
Viewing all articles
Browse latest Browse all 579

Ask for Help (v2) • Can't figure out warning "This variable appears to never be assigned a value."

$
0
0
I am trying to replace certain letters with others while pressing F2, the code seems fine and all, but on line 34 the interpreter throws this warning: "This variable appears to never be assigned a value.".
Some solutions I read online stated that I should initialise the variable pressedKey beforehand, but even when I do that the same problem occurs. Am I doing something wrong?

Here is my code:

CODE:

 ;lowercase
lowercase := {
a : "ä",
o : "ö",
u : "ü",
s : "ß"
}

uppercase := {
a : "Ä",
o : "Ö",
u : "Ü",
s : "SS"
}

ReplaceWithUmlaut(key) {
; Get shift and capslock state
caps := GetKeyState("CapsLock", "T")
shift := GetKeyState("Shift")

if(caps || shift){ ; uppercase
return (uppercase[key])
}
else { ;lowercase
return (lowercase[key])
}
}


; Calling function
~F2::{
pressedKey := Input(L1 T1)
ReplaceWithUmlaut(pressedKey)
return
}

Statistics: Posted by Kronos_png — Today, 08:06



Viewing all articles
Browse latest Browse all 579

Trending Articles