[ANSWERED]: Example AppleScript to turn device on and off
[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.
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.
- matt (support)
- Site Admin
- Posts: 21476
- Joined: Mon Jan 27, 2003 1:17 pm
- Location: Texas
- Contact:
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:
Regards,
Matt
Code: Select all
tell app "Indigo"
turn on "office light"
end tell
Matt
- matt (support)
- Site Admin
- Posts: 21476
- Joined: Mon Jan 27, 2003 1:17 pm
- Location: Texas
- Contact:
Definitely. Looks like this:
The complete AppleScript dictionary is available here.
Code: Select all
tell app "Indigo"
brighten "office light" to 75
end tell
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
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
You can delete delayed actions for a device using AppleScript.
Here's the info for the command:
to your script before you issue the turn off light that will set the new delay.
[edit]typo[/edit]
Here's the info for the command:
So all you have to do is add the lineremove 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")
Code: Select all
remove delayed actions for device light
[edit]typo[/edit]
Last edited by macpro on Wed Oct 04, 2006 5:30 am, edited 1 time in total.
Re: AppleScript to set an Indigo device to on and off
It tried this, but I got this message:support wrote:Something like this should work:Code: Select all
tell app "Indigo" turn on "office light" end tell
error "Indigo 4 got an error: Can’t continue turn." number -1708 to «class turn»
Can anyone tell me what this means? Thanks.
- jay (support)
- Site Admin
- Posts: 18411
- Joined: Wed Mar 19, 2008 11:52 am
- Location: Austin, Texas
- Contact:
Re: AppleScript to set an Indigo device to on and off
Should be:randysk wrote:It tried this, but I got this message:support wrote:Something like this should work:Code: Select all
tell app "Indigo" turn on "office light" end tell
error "Indigo 4 got an error: Can’t continue turn." number -1708 to «class turn»
Can anyone tell me what this means? Thanks.
Code: Select all
tell application "IndigoServer"
turn on "office light"
end tell
/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.
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.
- jay (support)
- Site Admin
- Posts: 18411
- Joined: Wed Mar 19, 2008 11:52 am
- Location: Austin, Texas
- Contact:
Re: Example AppleScript to turn device on and off
Check this thread for information on setting outputs via AppleScript.peppop wrote:How would you control I/O-Linc Controller? Lets say you wanted to turn on and off output 1.
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?
- jay (support)
- Site Admin
- Posts: 18411
- Joined: Wed Mar 19, 2008 11:52 am
- Location: Austin, Texas
- Contact:
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:
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.
Code: Select all
tell application "IndigoServer" of machine "eppc://USERNAME:PASSWORD@SERVERIPADDRESSHERE"
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.
Re: Example AppleScript to turn device on and off
Another happy customer!
Thanks
Thanks