is there a way besides
tell application "indigoserver"
set xx to (get value of variable "xyz")
end tell
to get parameters as part of the call to the applescript?
Thanks
Karl
parm 1,2 then they can change after (outside myapplescript) the call is initiated
import urllib2
def setCameraLevels(theIPnumber="192.168.1.71", Brightness=0, Contrast=0, Saturation=0, Antiflicker=1, MirrorOnOff=0):
map = ["1", "14", "26", "39", "51", "64", "77", "90", "193", "115", "128"]
if Brightness >= 6: Brightness = 5
if Brightness <= -6: Brightness = -5
setBrightness = map[(Brightness +5)]
if Contrast >= 6: Contrast = 5
if Contrast <= -6: Contrast = -5
setContrast = map[(Contrast +5)]
if Saturation >= 6: Saturation = 5
if Saturation <= -6: Saturation = -5
setSaturation = map[(Saturation +5)]
if Antiflicker >= 1: setAntiflicker = '1'
if Antiflicker <= 0: setAntiflicker = '0'
if MirrorOnOff >= 1: setMirrorOnOff = '1'
if MirrorOnOff <= 0: setMirrorOnOff = '0'
data = "&ReplySuccessPage=image.htm"
data = data + "&ReplyErrorPage=errrimg.htm"
data = data +"&BrightnessControl="+ setBrightness
data = data +"&ContrastControl="+setContrast
data = data +"&SaturationControl="+setSaturation
data = data +"&AntiFlickerEnable="+setAntiflicker
data = data +"&Mirror="+setMirrorOnOff
data = data +"&ConfigSystemStream=Save"
url = 'http://'+theIPnumber+'/setSystemStream'
theUserid="uuuu"
thePassword="pppp"
passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
passman.add_password(None, url, theUserid, thePassword)
urllib2.install_opener(urllib2.build_opener(urllib2.HTTPBasicAuthHandler(passman)))
response = urllib2.urlopen(url=url,data=data).read
import setCameraLevels #file name without .py at the end is the module
# syntax is modulename.methodname()
setCameraLevels.setCameraLevels(PARAMS)
Users browsing this forum: No registered users and 32 guests