[ANSWERED]: Example AppleScript to turn device on and off

Posted on
Thu Oct 27, 2005 3:14 pm
martinc offline
Posts: 83
Joined: Oct 27, 2005

[ANSWERED]: Example AppleScript to turn device on and off

Hi,

I am very new to AppleScript but what I am trying to do it make an Apple Script that when run would set a device (lets say A1) to on or off, Could you please show me the code for this?

Thank you very much.

What I am trying to do is have Keyspans Express remote when pressed run an Apple Script to turn Indigo items on/off dim etc.

Thanks again.

Posted on
Fri Oct 28, 2005 10:20 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: AppleScript to set an Indigo device to on and off

You can use AppleScript to send raw X10 commands (A1 On), but I would recommend doing it by the device name in this case. Something like this should work:
Code: Select all
tell app "Indigo"
  turn on "office light"
end tell

Regards,
Matt

Posted on
Sat Dec 10, 2005 11:06 am
martinc offline
Posts: 83
Joined: Oct 27, 2005

(No subject)

OK will give that a try.

Can you dim aswell?
What would that script look like?

Thanks

Posted on
Mon Dec 12, 2005 8:56 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

(No subject)

Definitely. Looks like this:
Code: Select all
tell app "Indigo"
  brighten "office light" to 75
end tell

The complete AppleScript dictionary is available here.

Posted on
Mon Dec 12, 2005 9:23 am
martinc offline
Posts: 83
Joined: Oct 27, 2005

(No subject)

Great help.

Thank you very much.

Posted on
Tue Oct 03, 2006 10:14 pm
rickdees offline
Posts: 14
Joined: Dec 30, 2004

Can you name delayed turn off scripts?

Matt,

I've got an issue and can't come up with a solution. I want to turn off lights after they've been on for a while - for example 30 minutes. The problem I'm running into is say someone goes in and turns on a light. My script notices the light has been turned on and generates this from AppleScript.

....
turn off light in 30 minutes
...

this generates an entry in Indigo called "_delayed_action_<#>"

If the first person turns off the light, I want to be able to delete this action. Because what usually happens is another person goes in about 25 minutes later, turns on the light and then my delayed action kicks in kills the light - giving him the impression that I turned it off in only 5 minutes.

So I need a way to name these delayed actions or use some other mechanism that I'm not aware of to keep track of the numbers. Also, even if I knew the name this was given is there any way of finding that out?

thanks,

Rick Darenberg

Posted on
Wed Oct 04, 2006 4:44 am
macpro offline
User avatar
Posts: 765
Joined: Dec 29, 2005
Location: Third byte on the right

(No subject)

You can delete delayed actions for a device using AppleScript.
Here's the info for the command:
remove delayed actions -- Removes all delayed actions, or removes delayed actions for a specific device or trigger
[for device string] -- the device name to remove all delayed acions for (ex: remove delayed actions for device "office light")
[for trigger string] -- the trigger name to remove all delayed acions for (ex: remove delayed actions for trigger "porch motion detected")

So all you have to do is add the line
Code: Select all
remove delayed actions for device light

to your script before you issue the turn off light that will set the new delay.

[edit]typo[/edit]
Last edited by macpro on Wed Oct 04, 2006 5:30 am, edited 1 time in total.

Posted on
Wed Oct 04, 2006 5:26 am
rickdees offline
Posts: 14
Joined: Dec 30, 2004

(No subject)

Excellent - thanks for your help.

Posted on
Sat Dec 12, 2009 9:14 am
randysk offline
Posts: 48
Joined: Feb 26, 2007

Re: AppleScript to set an Indigo device to on and off

support wrote:
Something like this should work:
Code: Select all
tell app "Indigo"
  turn on "office light"
end tell



It tried this, but I got this message:

error "Indigo 4 got an error: Can’t continue turn." number -1708 to «class turn»

Can anyone tell me what this means? Thanks.

Posted on
Sat Dec 12, 2009 10:20 am
jay (support) offline
Site Admin
User avatar
Posts: 18230
Joined: Mar 19, 2008
Location: Austin, Texas

Re: AppleScript to set an Indigo device to on and off

randysk wrote:
support wrote:
Something like this should work:
Code: Select all
tell app "Indigo"
  turn on "office light"
end tell



It tried this, but I got this message:

error "Indigo 4 got an error: Can’t continue turn." number -1708 to «class turn»

Can anyone tell me what this means? Thanks.


Should be:

Code: Select all
tell application "IndigoServer"
    turn on "office light"
end tell


This is an ancient post from back when Indigo was at version 1.0. Have you checked out the AppleScript Dictionary for the "IndigoServer" application in this directory:

/Library/Application Support/Perceptive Automation/Indigo 4/

From Script Editor you should look at the dictionary - it'll give you all the commands and classes that Indigo provides for control.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sun Jan 31, 2010 11:12 am
peppop offline
User avatar
Posts: 104
Joined: Oct 18, 2006
Location: Mas

Re: Example AppleScript to turn device on and off

How would you control I/O-Linc Controller? Lets say you wanted to turn on and off output 1.

Posted on
Sun Jan 31, 2010 4:52 pm
jay (support) offline
Site Admin
User avatar
Posts: 18230
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Example AppleScript to turn device on and off

peppop wrote:
How would you control I/O-Linc Controller? Lets say you wanted to turn on and off output 1.


Check this thread for information on setting outputs via AppleScript.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed Mar 10, 2010 4:14 pm
miousic offline
Posts: 30
Joined: Jun 15, 2008

Re: Example AppleScript to turn device on and off

Jay, When running an applescript on a remote computer (running Indigo client), I have this message: "AppleScript support is an Indigo Pro only feature. You can upgrade from Lite to Pro for this functionality." Is there a way to run an applescript on this remote computer to control lights on the server?

Posted on
Wed Mar 10, 2010 4:28 pm
jay (support) offline
Site Admin
User avatar
Posts: 18230
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Example AppleScript to turn device on and off

If you are trying to run an AppleScript on Machine A that talks to the IndigoServer process is running on Machine B, then you need to tell the script to use IndigoServer on the remote Mac, not the local one:

Code: Select all
tell application "IndigoServer" of machine "eppc://USERNAME:PASSWORD@SERVERIPADDRESSHERE"


This tells the AppleScript to tell the IndigoServer application on the remote machine to do something. Note, you need to enable remote apple events in the sharing system preferences on the IndigoServer machine. The USERNAME and PASSWORD is the user account that the IndigoServer is running on Machine B.

The error you're seeing is coming from a local IndigoServer process that's running on Machine A - it's probably unlicensed which is why you get the error.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed Mar 10, 2010 6:23 pm
miousic offline
Posts: 30
Joined: Jun 15, 2008

Re: Example AppleScript to turn device on and off

Another happy customer! :)

Thanks

Who is online

Users browsing this forum: No registered users and 5 guests