tell application "Screen Sharing" to launch
tell application "System Events"
repeat until visible of process "Screen Sharing" is false
set visible of process "Screen Sharing" to false
end repeat
set visible of process "Screen Sharing" to true
tell process "Screen Sharing"
set value of text field 1 of window 1 to "ip.address"
click button "Connect" of window 1
end tell
repeat while (exists window "Screen Sharing" of application process "Screen Sharing")
delay 0.2
end repeat
tell process "Screen Sharing"
set value of text field 1 of window 1 to "username"
set value of text field 2 of window 1 to "password"
click button "Sign In" of window 1
end tell
end tell