Last active
March 8, 2016 20:55
-
-
Save unbibium/6472677 to your computer and use it in GitHub Desktop.
I'm trying to get ManyCam to switch to my FaceTime camera. It activates ManyCam, and makes sure the Cameras menu is expanded, and even makes FaceTime LOOK selected, but I can't get it to actually switch the input to FaceTime. If I get this working, I'll be able to write another one for a second input, and be able to switch between the two with s…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
activate application "ManyCam" | |
global targetPosition | |
tell application "System Events" to tell window 1 of process "ManyCam" | |
click radio button "Sources" of radio group 1 | |
local cameraGroupRow | |
local cameraGroup | |
local StillImageRow | |
local clickme | |
local clickmetoo | |
tell scroll area of splitter group 1 | |
click | |
log "one" | |
set c to entire contents | |
set allElements to first item in c | |
log "twoe" | |
log class of allElements | |
repeat with element in allElements | |
log element's class & ": " & element's value | |
if element's class is outline then | |
log (name of every action of element) as list | |
log (name of every attribute of element) as list | |
end if | |
-- make sure Cameras menu, and any others, are expanded. | |
if element's class is UI element then | |
if value of element's attribute "AXValue" is equal to 0 then | |
tell element to perform action "AXPress" | |
end if | |
end if | |
-- find row containing facetime | |
if element's class is row then | |
try | |
set rowName to value of first text field of element | |
if rowName contains "FaceTime" then | |
set clickme to element | |
set clickmetoo to first text field of element | |
end if | |
get value of element's attribute "AXChildren" | |
set derp2 to it | |
end try | |
end if | |
end repeat | |
end tell | |
-- this is the only thing that seems to do anything | |
tell application "System Events" to select clickme | |
tell application "System Events" to select clickmetoo | |
tell application "System Events" to click clickme | |
tell application "System Events" to click clickmetoo | |
set targetPosition to clickme's position | |
set children to value of clickme's attribute "AXChildren" | |
log "target position of clickme: " & targetPosition | |
log children | |
click at targetPosition | |
-- here i try to send the click to the text field | |
set targetPosition to clickmetoo's position | |
set children to value of clickmetoo's attribute "AXChildren" | |
log children | |
log "target position of clickmetoo: " & targetPosition | |
click at targetPosition | |
-- this should create a slightly different position, | |
-- but it doesn't. | |
set targetToo to {(first item of targetPosition as number) + 3, (second item of targetPosition as number) + 3} | |
log "add'l target position of clickmetoo: " & targetPosition | |
click at targetToo | |
log derp2 | |
log "end" | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment