How do I check if a (virtual) device ist on or off?

Posted on
Sat Jul 22, 2017 10:47 am
Umtauscher offline
User avatar
Posts: 434
Joined: Oct 03, 2014
Location: Cologne, Germany

How do I check if a (virtual) device ist on or off?

The headline sais it all.

Code: Select all
tell application "IndigoServer"
   if on state of "Loudspeaker2" is true then ...

I get the error "can't get On state of Loudspeaker2"
What am I doing wrong here?
TIA

Posted on
Sat Jul 22, 2017 1:54 pm
FlyingDiver offline
Posts: 3463
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: How do I check if a (virtual) device ist on or off?

Use Python, not AppleScript. :lol:

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Sun Jul 23, 2017 4:03 pm
jay (support) offline
Site Admin
User avatar
Posts: 15690
Joined: Mar 19, 2008
Location: Austin, Texas

Re: How do I check if a (virtual) device ist on or off?

I agree with FlyingDiver - do it in Python:

Code: Select all
dev = indigo.devices[IDOFDEVICEHERE]
if dev.onState:
    # Do whatever here


If for some reason you can't, however, you've got the AppleScript syntax wrong:

Code: Select all
tell application "IndigoServer"
   if on state of device "Loudspeaker2" is true then ...


you have to specify that it's a device you're looking at (device "Loudspeaker2").

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Mon Jul 24, 2017 12:21 am
Umtauscher offline
User avatar
Posts: 434
Joined: Oct 03, 2014
Location: Cologne, Germany

Re: How do I check if a (virtual) device ist on or off?

Thanks Jay

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest