Here's the snippet that sets an Indigo variable via applescript:
- Code: Select all
on setIndigoVariable(theVariable, theValue)
set theProtocol to "http" -- vs https
set theServer to "127.0.0.1" -- dns name will work if it is resolvable
set thePort to "8176" -- the Indigo default, change this to match your settings
set theUserPass to "myUsername:myPassword" -- your Indigo remote access username/password
set theURL to theProtocol & "://" & theServer & ":" & thePort & "/variables/" & theVariable
do shell script "/usr/bin/curl --digest -u " & theUserPass & " -X PUT -d value=" & theValue & " " & theURL
return ""
end setIndigoVariable
the rest of my EnterProximity.scpt file looks like this:
- Code: Select all
set PROX to "Here: "
set {computer name:compName, home directory:userHome} to system info
set currTime to current date
set {LF, CR} to {ASCII character 10, ASCII character 13}
set theFilePath to (userHome as string) & "Dropbox:personal:proximity:" & compName & ".txt"
set theFileReference to open for access theFilePath with write permission
set theText to PROX & (currTime as string) & LF
write theText to theFileReference starting at eof
close access theFileReference
setIndigoVariable("jimIphoneLocation", compName)
Hopefully some of this will be useful to others.
jim