The code does this: When I press LShift and write 3 letters, a menu appears to select one of the options starting with those 3 letters. The menu closes only if I choose an option or press Enter.
What I want is this: If I don`t like any option from the menu to be able to continue writing where the cursor is, automatically closing the menu without pressing enter.
I tried everything, but in vain.
Can anyone help me with this?
Code: Select all
#Persistent
SendMode, Event
creditori := "LANGOS|MARTE|MARATHON"
SugestiiMenuExist := 0
SugestiiMenuVisible := 0
MenuExist() {
return SugestiiMenuExist
}
MenuVisible() {
return SugestiiMenuVisible
}
~LShift::
sugestiiCount := 0
userInput := ""
Input, userInput, L3 V
if (SugestiiMenuExist)
{
Menu, SugestiiMenu, DeleteAll
}
else
{
SugestiiMenuExist := 1
Menu, SugestiiMenu, Add
}
hasLowerCase := 0
Loop, Parse, userInput
{
if (Asc(A_LoopField) >= 97 && Asc(A_LoopField) <= 122)
{
hasLowerCase := 1
break
}
}
if (!hasLowerCase)
{
Loop, Parse, creditori, |
{
if (SubStr(A_LoopField, 1, 3) = userInput)
{
sugestiiCount++
sugestie := sugestiiCount ". " A_LoopField
Menu, SugestiiMenu, Add, % sugestie, SelectCreditor
}
}
if (sugestiiCount > 0)
{
SugestiiMenuVisible := 1
Menu, SugestiiMenu, Show
}
else
{
SugestiiMenuVisible := 0
}
}
return
SelectCreditor:
creditorSelectat := A_ThisMenuItem
creditor := SubStr(creditorSelectat, InStr(creditorSelectat, ". ") + 2)
Send, % SubStr(creditor, 4)
Clipboard := creditor
Send {Tab 3}
return
if (SugestiiMenuVisible)
{
Menu, SugestiiMenu, Show
GoSub, SelectCreditor
}
return