System Events and key code

Posted on
Mon Feb 17, 2020 11:44 am
ELWOOD offline
Posts: 225
Joined: Feb 11, 2007
Location: Ramsey, NJ

System Events and key code

Been using simple apple script to control Kodi for a few years and want to update them to python. Kodi can
be controlled using key board presses. I have a dozen actions that runs a 5 line apple script to send a key
press to Kodi, on a control page I can press a button that will start play, other buttons for navigation. With
about 15 buttons I have full control of Kodi from the control page.

Here is the apple script:


Code: Select all
try
   tell application "System Events"
      
      key code 35
      
   end tell
end try

All the scrips are the same except for the “key code”

So can python use “system events” and send “key codes” can’t figure out how to do this with python.
Any help would be greatly appreciated.

Thanks
Elwood

Posted on
Mon Feb 17, 2020 12:42 pm
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: System Events and key code

Since that script doesn't talk to Indigo, just make it an external AppleScript and execute it that way. No reason to do anything else really.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Mon Feb 17, 2020 1:09 pm
ELWOOD offline
Posts: 225
Joined: Feb 11, 2007
Location: Ramsey, NJ

Re: System Events and key code

Thanks Jay
I thought that might be one option, still trying to learn python so is it possible to do with a python script.
I will make them external scripts, is there a preferred location to locate the external scripts ?

Thanks, as usual for a fast response.

Elwood

Posted on
Mon Feb 17, 2020 1:58 pm
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: System Events and key code

We recommend putting them here:

Code: Select all
/Library/Application Support/Perceptive Automation/Scripts/


Starting with Indigo 7.4.1, we'll make sure that folder exists in all installs. If it doesn't exist (because you haven't upgraded to 7.4.1 yet), then you can create it yourself, just make sure that it has the same permissions that other folders in /Library/Application Support/Perceptive Automation/ have.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 3 guests