-3

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....

  • 2
    in *what way* does it "not work"? – Stephan Oct 18 '20 at 20:12
  • to not automatically start Kodi, remove the second line. Within the Function add `MsgBox(0,"ok","Fuction called")` to test if the Function is correctly started. Ìf it is, there is something wrong with starting Kodi (maybe you need to add a working folder to `ShellExecute') – Stephan Oct 24 '20 at 12:18

1 Answers1

0

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.

garbb
  • 679
  • 5
  • 9