Edoardo Rebecchi
Edoardo Rebecchi

Reputation: 1

HotKeySet() issue

I cannot figure why this script does not work:

HotKeySet("^!k", "StartKodi")
StartKodi()

While 1
    Sleep(200)
WEnd

Func StartKodi()
   ShellExecute("C:\Program Files\Kodi\kodi.exe")
EndFunc

I would like to run the function only when the HotKeySet is pressed, But the HotKeySet does not start the function apparently....

Upvotes: -3

Views: 368

Answers (1)

garbb
garbb

Reputation: 679

The first line HotKeySet("^!k", "StartKodi") sets the hotkey CTRL + ALT + K to run the function StartKodi() and then the second line, StartKodi() directly runs the function StartKodi(), so if you had intended for the StartKodi() function to only run when the hotkey is pressed (and not when the script is run), then this would explain the unintended behavior.

I don't know how Kodi works, but some applications only allow one instance to be run at a time, so if you had intended to run Kodi once when the script is run and then also via the hotkey, this could explain why it would not run when the hotkey is pressed.

Upvotes: 0

Related Questions