1) Python script to take a snapshot image of a control page and save on the desktop as "ISL-Thumb.jpg". (not sure where the "Thumb" comes from and I think I had to add webkit to python to get this to work)
- Code: Select all
import subprocess as sub
try:
p = sub.Popen(['/usr/local/Cellar/webkit2png/0.7/bin/webkit2png', '-T', 'http://10.0.6.10:8176/controlpage?name=ISLMainLS', '-D', '/Users/williammoore/Desktop', '-s', '.5', '-o', 'ISL'],stdout=sub.PIPE,stderr=sub.PIPE)
output, errors = p.communicate()
errorMsg = ''
if errors != '':
errorMsg = 'Error Detected with webkit2png : %s' % errors
indigo.server.log('WEBKIT2PNG: %s\n%s' % (output, errorMsg))
except OSError, e:
indigo.server.log('OSError invoking webkit2png: %s' % e)
The second half is where things go astray and the second half I use for other stuff as well.... like copying a static image from a folder and saving it as my "R.jpg" image when there isn't a better live image to capture (from a camera or webpage, etc...)
- Code: Select all
property outputPNGFN : "Users:williammoore:Desktop:IPCamRotate:R.jpg"
property noMotionFN : "Users:williammoore:Desktop:ISL-thumb.png"
property targetSize : 256
on run
my outputPlaceholderImage(noMotionFN)
end run
to outputPlaceholderImage(filename)
set outputFileHandle to (open for access (outputPNGFN as alias) with write permission)
try
write (read (filename as alias)) to outputFileHandle starting at 0
close access outputFileHandle
on error err_msg
close access outputFileHandle
end try
end outputPlaceholderImage
Any help would be great.