Finder's "Connect to Server <smb share>" by shell script

Discussion in 'Mac Programming' started by Mac2013orlater, Mar 1, 2015.

  1. Mac2013orlater macrumors member

    Joined:
    Feb 2, 2014
    #1
    The goal is to reproduce Finder's Connect to Server .. in shell script.
    Whereby it is a smb share where the connection has to be made to.

    I wonder what are all the sub-operations conducted by Connect to Server, because when I write a shell script carrying out as following
    - mkdir <mount point>
    - chmod bla bla bla, for the mount point dir
    - mount <aimed-smb-path>
    all I miss is the smb share entry in Finder window which usually is created
    by Finder's Connect to Server but not when I run my script.
    What does my script miss?
     
  2. kryten2 macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #2
    You can use the mount volume command from AppleScript's File Commands suite in combination with osascript.

    Info : https://developer.apple.com/library/mac/documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_cmds.html#//apple_ref/doc/uid/TP40000983-CH216-SW17 - https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/osascript.1.html -
     

Share This Page