Jump to content

HotKeySet variable


Recommended Posts

Hi,

I am using ini files wich can set different (variable)  key combinations in the script. i have a settings button wich opens a gui where the ini file can be editted and only the key that combines with the CTRL in the HotkeySet

But the problem i have is that the hotkeyset does nothing when i use the variable, when i hardcode a letter to the combination it does work.

What am i doing wrong.

$GUI = GUICreate("Hotkey", 207, 121, -1, -1)
$Combo = GUICtrlCreateCombo("", 16, 40, 161, 25, BitOR($CBS_DROPDOWNLIST, $WS_VSCROLL))
        If FileExists(@ScriptDir & "\INI\Namen\names.ini") Then
                $var = IniReadSection(@ScriptDir & "\INI\Namen\names.ini", "Names")
                    If @error <> 1 Then
                        GUICtrlSetData($COMBO, "")
                            For $x = 1 To $var[0][0]
                                    GUICtrlSetData($COMBO, $var[$x][0])
                            Next
                    EndIf
        EndIf
GUICtrlCreateLabel("Naam:", 16, 16)
$SETTINGS = GUICtrlCreateButton("Instellingen", 16, 72, 75, 25)

GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $SETTINGS
            SETTINGS()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $COMBO
            SETHOTKEY()
    EndSwitch
WEnd

Func SETHOTKEY()

    $NAME       = GUICtrlRead($COMBO)
    $VARDEFAULT = IniRead(@Scriptdir & "\INI\Namen\" & $NAME & ".ini", "standaard", "Q", "")
        MsgBox(4096, "Test", $VARDEFAULT)
    HotKeySet("^" & $VARDEFAULT, "TIMESTAMP")
EndFunc
;====================================================================================================================================================================================

Func TIMESTAMP()
    $NAME   = GUICtrlRead($COMBO)
    $var    = IniRead(@ScriptDir & "\names.ini", "names", $NAME, "")
    ControlSend("", "", "", $var & " | " & @MDAY & "-" & @MON & "-" & @YEAR & "  |  " & @HOUR & ":" & @MIN & " | ", 0)
    Sleep(50)
EndFunc

 

Link to comment
Share on other sites

One last question, i am trying to limit the input box to lowercase only with the code:

 

$DEFAULT = GUICtrlCreateInput("", 72, 40, 33, 21, $ES_LOWERCASE)

But now i can still type UPPERCASE characters in the input. Any idea's?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...