OK, I have this script I wrote. Ot changed the settings for up to 4 isights in the computer program securityspy. I do not het any errors when I run it. I have Cronnix routinly changing the settings via this script 2 times per day. Cronnix has a button in which you can exucte a tast. I get no errors there. But, when it comes time to have Cronnix exucute the scipt on iys own, if requently throws an error. So, I thought I would post the script here and see if anyone here had any suggestions for improvements…to clean, reduce errors, speed up, ect. Thanks in advance!
PS- the reason I tell the app to close and then open is to allow the program to see if any cameras have lost connection. so it does not try to edit a camera that another app started to use. The only way to tell is when the program restarts, which is no problem.
The script will check to see what camera are in use. There are then 4 if/then statements that will run dependin on how many cameras are found upon program restart in Video Device Setup.
tell application "SecuritySpy"
quit
end tell
delay 2
activate application "SecuritySpy"
delay 7
tell application "System Events"
tell process "SecuritySpy"
--------------------------------
set frontmost to true
keystroke "J" using command down
delay 2
set {X, y} to position of radio button "Local devices" of tab group 1 of window "Video Device Setup"
tell application "Extra Suites"
ES move mouse {X + 5, y + 5}
ES click mouse
end tell
delay 1
tell pop up button 5 of group 1 of tab group 1 of window "Video Device Setup"
click
set nCamera to name of menu items of menu 1
click menu item 1 of menu 1
end tell
keystroke return
-----------------------------------
keystroke "K" using command down
delay 2
---=======================
if nCamera contains "iSight" then
set frontmost to true
set {X, y} to position of pop up button 2 of window 1
tell application "Extra Suites"
ES move mouse {X, y}
ES click mouse
end tell
set {m, n} to position of menu item "Living Room" of menu 1 of pop up button 2 of window "Camera Setup" -----name of camera 1
tell application "Extra Suites"
ES move mouse {m + 5, n + 5}
ES click mouse
end tell
get name of UI elements of tab group 1 of window 1
set {X, y} to position of UI element "setup" of tab group 1 of window 1
tell application "Extra Suites"
ES move mouse {X + 5, y + 5}
ES click mouse
end tell
set {X, y} to position of button 5 of group 1 of tab group 1 of window 1
tell application "Extra Suites"
ES move mouse {X + 4, y + 4}
ES click mouse
end tell
delay 2
set {X, y} to position of radio button "Adjustments" of tab group 1 of window "Video"
tell application "Extra Suites"
ES move mouse {X + 40, y + 30}
ES click mouse
end tell
keystroke tab
keystroke tab
keystroke "325" ----------brightness adjustment #1
keystroke tab
keystroke return
delay 3
end if
---===========================
if nCamera contains "iSight #2" then
set frontmost to true
set {X, y} to position of pop up button 2 of window 1
tell application "Extra Suites"
ES move mouse {X, y}
ES click mouse
end tell
set {m, n} to position of menu item "Front Yard" of menu 1 of pop up button 2 of window "Camera Setup" -----name of camera 2
tell application "Extra Suites"
ES move mouse {m + 5, n + 5}
ES click mouse
end tell
get name of UI elements of tab group 1 of window 1
set {X, y} to position of UI element "setup" of tab group 1 of window 1
tell application "Extra Suites"
ES move mouse {X + 5, y + 5}
ES click mouse
end tell
set {X, y} to position of button 5 of group 1 of tab group 1 of window 1
tell application "Extra Suites"
ES move mouse {X + 4, y + 4}
ES click mouse
end tell
delay 2
set {X, y} to position of radio button "Adjustments" of tab group 1 of window "Video"
tell application "Extra Suites"
ES move mouse {X + 40, y + 30}
ES click mouse
end tell
keystroke tab
keystroke tab
keystroke "260" ----------brightness adjustment #2
keystroke tab
keystroke return
delay 3
end if
---==================================
if nCamera contains "iSight #3" then
set frontmost to true
set {X, y} to position of pop up button 2 of window 1
tell application "Extra Suites"
ES move mouse {X, y}
ES click mouse
end tell
set {m, n} to position of menu item "Kitchen" of menu 1 of pop up button 2 of window "Camera Setup" -----name of camera 3
tell application "Extra Suites"
ES move mouse {m + 5, n + 5}
ES click mouse
end tell
get name of UI elements of tab group 1 of window 1
set {X, y} to position of UI element "setup" of tab group 1 of window 1
tell application "Extra Suites"
ES move mouse {X + 5, y + 5}
ES click mouse
end tell
set {X, y} to position of button 5 of group 1 of tab group 1 of window 1
tell application "Extra Suites"
ES move mouse {X + 4, y + 4}
ES click mouse
end tell
delay 2
set {X, y} to position of radio button "Adjustments" of tab group 1 of window "Video"
tell application "Extra Suites"
ES move mouse {X + 40, y + 30}
ES click mouse
end tell
keystroke tab
keystroke tab
keystroke "325" ----------brightness adjustment #3
keystroke tab
keystroke return
delay 3
end if
---============================
if nCamera contains "iSight #4" then
set frontmost to true
set {X, y} to position of pop up button 2 of window 1
tell application "Extra Suites"
ES move mouse {X, y}
ES click mouse
end tell
set {m, n} to position of menu item "XXXX" of menu 1 of pop up button 2 of window "Camera Setup" -----name of camera 4
tell application "Extra Suites"
ES move mouse {m + 5, n + 5}
ES click mouse
end tell
get name of UI elements of tab group 1 of window 1
set {X, y} to position of UI element "setup" of tab group 1 of window 1
tell application "Extra Suites"
ES move mouse {X + 5, y + 5}
ES click mouse
end tell
set {X, y} to position of button 5 of group 1 of tab group 1 of window 1
tell application "Extra Suites"
ES move mouse {X + 4, y + 4}
ES click mouse
end tell
delay 2
set {X, y} to position of radio button "Adjustments" of tab group 1 of window "Video"
tell application "Extra Suites"
ES move mouse {X + 40, y + 30}
ES click mouse
end tell
keystroke tab
keystroke tab
keystroke "XXX" ----------brightness adjustment #4
keystroke tab
keystroke return
delay 3
end if
---======================
keystroke return
end tell
end tell