Dialectic Indigo Script

Posted on
Fri Apr 20, 2012 11:03 am
ckeyes888 offline
Posts: 2417
Joined: Nov 26, 2009
Location: Kalispell, MT

Dialectic Indigo Script

Hey,

Trying to setup triggering Indigo from incoming caller ID from an app called Dialectic.
I see Dialectic has an AS posted on their site that would turn on a light in Indigo but
am not seeing how I might execute an Indigo action based on the incoming caller ID.

Here's their code:
Code: Select all
(*

This script will turn on a device controlled by Indigo when an incoming call is detected.

For more information on Indigo, please see:

http://www.perceptiveautomation.com/

If you don't adjust the device_name property at the top o the script, you will be prompted for the
device to turn on each time the script is triggered.

*)

property device_name : "" -- name of device to controll

on handle_incoming_call_action(contact_name, contact_number, phone_or_modem_name)
   try
      my turn_on_device()
   on error the_error
      activate
      display dialog "Error: " & the_error buttons {"OK"} default button 1 with icon 0 giving up after 20
   end try
end handle_incoming_call_action

on turn_on_device()
   if (my get_device_name()) = false then return
   tell application "IndigoServer" to turn on device device_name
end turn_on_device

on turn_off_device()
   if (my get_device_name()) = false then return
   tell application "IndigoServer" to turn off device device_name
end turn_off_device

on get_device_name()
   if device_name is not "" then return device_name
   set all_device_names to my get_on_off_devices()
   activate
   set this_device_name to (choose from list all_device_names default items {item 1 of all_device_names} with prompt "Select the device to control:" OK button name "Select")
   if this_device_name = false then return false
   set device_name to item 1 of this_device_name
end get_device_name

on get_on_off_devices()
   tell application "IndigoServer" to return name of every device whose supports on off of it = true
end get_on_off_devices


Anyone have any info on how to set that up?

Thanks,

Carl

Posted on
Fri Apr 20, 2012 11:14 am
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Dialectic Indigo Script

I don't have the software and have no idea how the incoming numbers are formatted, but something like this should get close:

Code: Select all
(*

This script will turn on a device controlled by Indigo when an incoming call is detected.

For more information on Indigo, please see:

http://www.perceptiveautomation.com/

If you don't adjust the device_name property at the top o the script, you will be prompted for the
device to turn on each time the script is triggered.

*)

property device_name : "" -- name of device to controll

on handle_incoming_call_action(contact_name, contact_number, phone_or_modem_name)
   try
      my turn_on_device()
      my execute_action_group(contact_number)
   on error the_error
      activate
      display dialog "Error: " & the_error buttons {"OK"} default button 1 with icon 0 giving up after 20
   end try
end handle_incoming_call_action

on execute_action_group(contact_number)
   tell application "IndigoServer_d"
      # Log the number so we can see what it is
      log "call from " & (contact_number as string)
      # Check to see if there's an action group named the same thing as contact_number
      if action group named contact_number exists then
         # If so, execute the action group
         execute group contact_number
      end if
   end tell
end execute_action_group

on turn_on_device()
   if (my get_device_name()) = false then return
   tell application "IndigoServer_d" to turn on device device_name
end turn_on_device

on turn_off_device()
   if (my get_device_name()) = false then return
   tell application "IndigoServer_d" to turn off device device_name
end turn_off_device

on get_device_name()
   if device_name is not "" then return device_name
   set all_device_names to my get_on_off_devices()
   activate
   set this_device_name to (choose from list all_device_names default items {item 1 of all_device_names} with prompt "Select the device to control:" OK button name "Select")
   if this_device_name = false then return false
   set device_name to item 1 of this_device_name
end get_device_name

on get_on_off_devices()
   tell application "IndigoServer_d" to return name of every device whose supports on off of it = true
end get_on_off_devices


BTW, let me know if you get it working - this might be a good replacement for the incoming calling features I still use in PhoneValet (which has been discontinued). It even works with the PV hardware so I won't have to buy a USB modem.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Apr 20, 2012 12:13 pm
ckeyes888 offline
Posts: 2417
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: Dialectic Indigo Script

Thanks Jay. I hope to get this working this weekend, I'll post how it all goes.

I'm thinking maybe the easiest thing to do would be to pass the name and number
to Indigo variables to trigger my control page displays etc.

Just to make things interesting, and the fact I have no phone outlet near my Indigo
server, I'm running Dialectic on a remote machine.
This code works fine to send Indigo whatever may be necessary from that machine.

tell application "IndigoServer" of machine "eppc://TV-Mac-Mini.local:xxx@192.168.1.80"
set the value of variable "CIDname" to "???????"
end tell


Could I bug you for a sample of code how that might be done?

Many thanks,

Carl

P.S. Dialectic does have a 14 day, fully functional, free trial.

Posted on
Fri Apr 20, 2012 1:09 pm
ckeyes888 offline
Posts: 2417
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: Dialectic Indigo Script

Does this look at all close? ...don't have a modem yet to test.

Code: Select all
on handle_incoming_call_action(contact_name, contact_number, phone_or_modem_name)
   try
      
      my set_my_number(contact_number)
      my set_my_name(contact_name)
      
   on error the_error
      activate
      display dialog "Error: " & the_error buttons {"OK"} default button 1 with icon 0 giving up after 20
   end try
end handle_incoming_call_action

on set_my_number(contact_number)
   tell application "IndigoServer" of machine "eppc://TV-Mac-Mini.local:xxx@192.168.1.80"
      # Log the number so we can see what it is
      log "call from " & (contact_number as string)
      set the value of variable "CIDnumber" to (contact_number as string)
   end tell
end set_my_number

on set_my_name(contact_name)
   tell application "IndigoServer" of machine "eppc://TV-Mac-Mini.local:xxx@192.168.1.80"
      # Log the name so we can see who it is
      log "call from " & (contact_name as string)
      set the value of variable "CIDname" to (contact_name as string)
   end tell
end set_my_name



Thanks,

Carl

Posted on
Fri Apr 20, 2012 3:04 pm
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Dialectic Indigo Script

Looks right to me.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sun Apr 22, 2012 1:11 pm
ckeyes888 offline
Posts: 2417
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: Dialectic Indigo Script

For some reason when I try to load/compile this script on a remote machine
I'm always prompted to enter the user name and password..

tell application "IndigoServer" of machine "eppc://TV-Mac-Mini.local:xxx@192.168.1.80"
set value of variable "CIDnumber" to "xxxxx"
end tell

If I replace the "TV-Mac-Mini.local"
in the prompt with "TV Mac Mini", it works fine but I have to enter that each time the script is loaded.

Any idea how to fix that?

Thanks,

Carl
Attachments
Picture 1.png
Picture 1.png (23.29 KiB) Viewed 2725 times

Posted on
Sun Apr 22, 2012 1:21 pm
matt (support) offline
Site Admin
User avatar
Posts: 21411
Joined: Jan 27, 2003
Location: Texas

Re: Dialectic Indigo Script

You have to specify the username and password like:

Code: Select all
eppc://user:password@remotemachinename.local

Image

Posted on
Sun Apr 22, 2012 3:39 pm
ckeyes888 offline
Posts: 2417
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: Dialectic Indigo Script

Sorry, still having trouble with that. So something like?

tell application "IndigoServer" of machine "eppc://user:TV Mac Mini:password:xxx@192.168.1.80"

or

tell application "IndigoServer" of machine "eppc://user:TV-Mac-Mini.local:password:xxx@192.168.1.80"

Thanks,

Carl

Posted on
Sun Apr 22, 2012 4:09 pm
matt (support) offline
Site Admin
User avatar
Posts: 21411
Joined: Jan 27, 2003
Location: Texas

Re: Dialectic Indigo Script

If your username is carl and password is foo, then I believe you would use:

Code: Select all
tell application "IndigoServer" of machine "eppc://carl:foo@192.168.1.80"

Image

Posted on
Sun Apr 22, 2012 5:58 pm
ckeyes888 offline
Posts: 2417
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: Dialectic Indigo Script

Nuts...when I use:

tell application "IndigoServer" of machine "eppc://TV Mac Mini:xxx@192.168.1.80"

I get, "Can’t get application "IndigoServer" of machine "eppc://TV Mac Mini:xxx@192.168.1.80"

Sorry, this should be simple but whatever I try doesn't work.

Thanks,

Carl

Posted on
Sun Apr 22, 2012 6:42 pm
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Dialectic Indigo Script

The user name on your mac mini is really "TV Mac Mini"? That's what you use to log in to the computer?

I suspect not... ;)

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sun Apr 22, 2012 6:43 pm
ckeyes888 offline
Posts: 2417
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: Dialectic Indigo Script

To try simply I named it TV...but still no go.

see below.......

Thanks,

Carl
Attachments
Picture 1.png
Picture 1.png (60.01 KiB) Viewed 2696 times
Last edited by ckeyes888 on Sun Apr 22, 2012 7:05 pm, edited 1 time in total.

Posted on
Sun Apr 22, 2012 7:04 pm
ckeyes888 offline
Posts: 2417
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: Dialectic Indigo Script

This still isn't working:

tell application "IndigoServer" of machine "eppc://TV:xxx@192.168.1.80"
It returns "Unable to authenticate user."

What's odd is that I can send commands to a remote machine from the TV computer
that Indigo is running on using:

tell application "Finder" of machine "eppc://Carl-Mac-2.local:xxx@192.168.1.35" to open "Carl HD:Applications:HotTub:Flying.app"

Oddly, this does work:
tell application "Finder" of machine "eppc://TV.local:xxx@192.168.1.80" to open "Macintosh HD:Applications:CID Indigo:Indigo Test"



and a new screenshot showing the TV volume on the remote machine.

Thanks,

Carl
Attachments
Picture 1.png
Picture 1.png (49.23 KiB) Viewed 2694 times

Posted on
Sun Apr 22, 2012 9:25 pm
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Dialectic Indigo Script

It's not the name of the machine, it's the user name that's logged in to that machine running the IndigoServer. You're messing with the machine name which is irrelevant in terms of login credentials.

For instance, the name of my development Mac is FatMac, the user account that I log in with is "jay", and my password is "notreallymypassword". Thisis what I'd use from another Mac on my network:

Code: Select all
eppc://jay:notreallymypassword@FatMac.local

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sun Apr 22, 2012 10:59 pm
ckeyes888 offline
Posts: 2417
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: Dialectic Indigo Script

Here's a screenshot of the settings. It's TV for both computer account and user name.
Just won't work.

Thanks,

Carl
Attachments
Picture 1.png
Picture 1.png (50.38 KiB) Viewed 2675 times

Who is online

Users browsing this forum: No registered users and 12 guests

cron