• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Scripting Screen sharing.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scripting Screen sharing.


  • Subject: Re: Scripting Screen sharing.
  • From: deivy petrescu <email@hidden>
  • Date: Sat, 21 Jun 2008 13:05:10 -0400


On Jun 18, 2008, at 21:09, Robert Tillyard wrote:

Hello,

I'm very new to Applescript and wonder if anyone has scripted the Leopard Screen Sharing application could offer some help.

I can use the script at the bottom to get Screen Sharing to run and then enter a host but if Screen Sharing is already connected to another server it just sends the user and password to the current Screen Sharing window.

I'd like to know how to say open a new connection to $HOME using $USER and $PASS.

Started with...

tell application "Screen Sharing"
 activate
 tell application "System Events"
   keystroke "N" using command down
   keystroke "$HOST"
   keystroke return
   delay 1
   keystroke "$PASS"
   keystroke tab
   keystroke "$USER"
   keystroke return
 end tell
end tell


I get slightly better with...

tell application "Screen Sharing"
 activate
 open location "vnc://$HOST"
 tell application "System Events"
   delay 1
   keystroke "$PASS"
   keystroke tab
   keystroke "$USER"
   keystroke return
 end tell
end tell

But by default the dialog starts with my current user name and is ready for the password.

Thanks, regards, Rob.

Rob,
you should able able to use the following script no matter how many windows you have open in ScreenSharing.
Since you said your name is already there (so is mine) make the appropriate changes.
By the way, if you saved the password, then you can skip the Auth part.



<script>
set MyHost to "Ahost"
set Passwd to "Apassword"
tell application "System Events"
set frontmost of process "Finder" to true
tell process "Finder"
tell window 1 to tell splitter group 1 to tell scroll area 1 to tell list 1 to tell UI element MyHost to perform action "AXOpen"
delay 1
tell window MyHost to tell splitter group 1 to tell UI element 3 to tell button "Share Screen…" to click
end tell
repeat
if exists window 1 of process "NetAuthAgent" then exit repeat
end repeat
set frontmost of process "NetAuthAgent" to true
tell process "NetAuthAgent"
tell window 1
tell text field 2 to keystroke Passwd
delay 1
keystroke return
end tell
end tell
end tell


</script>


Deivy _______________________________________________ Do not post admin requests to the list. They will be ignored. AppleScript-Users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
References: 
 >Scripting Screen sharing. (From: Robert Tillyard <email@hidden>)

  • Prev by Date: Re: Problem Adding an Application to the Dock
  • Next by Date: Re: Applescript, RSync and Tutorials
  • Previous by thread: Scripting Screen sharing.
  • Next by thread: .sdef file parameter code question
  • Index(es):
    • Date
    • Thread