Automatically start a VNC connection upon login

Discussion in 'Mac Basics and Help' started by Lounge Deluxe, Aug 12, 2014.

  1. Lounge Deluxe macrumors regular

    Joined:
    Jun 1, 2009
    Location:
    Amsterdam
    #1
    Hi, I want my macbook Pro to automatically start a VNC connection with my Mac Mini upon login. However I cannot find a way to automate it.

    If I manually enter vnc://user name : password@Mac-Mini.local/ through "connect to server" in Finder (or command-k) then Screen Sharring.app automatically starts (which is exactly what I want), however I want to automate this when I login to my Macbook Pro (or restart).

    I tried to 'build' an Automator app by taking the command "Get Specified Server" and entering vnc://user name : password@Mac-Mini.local/ (with the proper name and password of course and without the spaces before and after the : sign--this creates an unintended smilie though in this forum so I entered spaces :) ) and then adding the command "connect to server". I get an error saying it can't open vmc (only smb/afp etc).

    Can someone help out how I can automate this? Thanks!
     
  2. snorkelman macrumors 6502a

    snorkelman

    Joined:
    Oct 25, 2010
    #2
    create an applescript with following

    Code:
    do shell script "open vnc://username:password@theLocalMac"
    save it as an app rather than a script

    go to settings users and groups

    select your account from the items on the left handside

    with your account selected click the login items button on the main right hand part of the window

    hit the add button just below the list of current login items

    browse to where you saved the app and add it to the list


    dependingon how quick you establish a network connection after login you might need to play around with the script a little to add a short delay before machine tries to establish the screen share

    e.g

    Code:
    delay 10
    do shell script "open vnc://username:password@theLocalMac"
    
    to wait 10 seconds before trying to establish a connection
     
  3. Lounge Deluxe thread starter macrumors regular

    Joined:
    Jun 1, 2009
    Location:
    Amsterdam
    #3
    Thanks a lot snorkelman, your script saved as an app works perfectly! I had to use a delay of 20 secs btw. Much appreciated.
     
  4. snorkelman macrumors 6502a

    snorkelman

    Joined:
    Oct 25, 2010

Share This Page