Indigo server doesn't' take condition in applescript

Posted on
Sun Jun 02, 2013 12:16 pm
domlazar offline
Posts: 24
Joined: Jan 18, 2012

Indigo server doesn't' take condition in applescript

My script works in applescript editor but doesn't take the condition to adjust Indigo variable as soon I try to execute it from IndigoServer.

here is the script, someone would have an idea

thanks


set the result to "0.0"
set theIP to "192.168.1.110"
set theTimeout to 20
set theResult to do shell script "/sbin/ping -qon -c 1 -W " & theTimeout & " " & theIP & " | /usr/bin/grep % | /usr/bin/sed \"s/.*,\\ //\" | /usr/bin/sed \"s/%.*//\""
if theResult is "" then
set theResult to 100
end if

if theResult = "0.0" then
tell application "IndigoServer"
set value of variable "iphone" to "home"
end tell
else
tell application "IndigoServer"
set value of variable "iphone" to "out"
end tell
end if

Mac OS Montery 12.2.1 macmini
Indigo Pro 2021.2
Powerlinc 2413U

Posted on
Sun Jun 02, 2013 3:52 pm
jay (support) offline
Site Admin
User avatar
Posts: 18224
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Indigo server doesn't' take condition in applescript

What do you mean by "doesn't take condition to adjust Indigo variable"?

Are you running this script as an embedded script or as a script file? You should run it as a script file because the do shell script (even though you set a timeout) could hang up.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Jun 04, 2013 8:34 am
domlazar offline
Posts: 24
Joined: Jan 18, 2012

Re: Indigo server doesn't' take condition in applescript

Sorry for my previous explanation, I wrote that just before leaving for work,... :oops:

I have a variable called "iPhone" in Indigo. If i'm away the variable should be "out" and "home" if i'm home. This is done by doing ping to my Iphone IP on my home network. With applescript editor everything is OK. The condition is respected applescript does the variable change in Indigo.

As soon I introduce the script in Indigo, as file or embedded the Indigo variable doesn't want to change as appropriate.

I've tried different scripts and the result is the same, outside Indigo (applescript editor)everything works fine, as soon as the script is in Indigo as file, the script return "out" in every situation.


here is a new script that I tried


tell application "IndigoServer"
set value of variable "iphone" to "home"
end tell
try
do shell script "ping -s 1 -i 11 -o -t 2 192.168.1.110"
on error
tell application "IndigoServer"
set value of variable "iphone" to "out"
end tell
end try

Mac OS Montery 12.2.1 macmini
Indigo Pro 2021.2
Powerlinc 2413U

Posted on
Tue Jun 04, 2013 8:43 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Indigo server doesn't' take condition in applescript

You need to use the full path to the ping executable (/sbin/ping), and I think it should work.

Image

Posted on
Tue Jun 04, 2013 9:35 am
domlazar offline
Posts: 24
Joined: Jan 18, 2012

Re: Indigo server doesn't' take condition in applescript

You're a wizard

thanks you so much,

after several of trial/errors that finally works

Mac OS Montery 12.2.1 macmini
Indigo Pro 2021.2
Powerlinc 2413U

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 25 guests