Auto Connect to Server on Network with Active Directory

Discussion in 'Mac Programming' started by Randy53215, Dec 14, 2010.

  1. Randy53215 macrumors newbie

    Joined:
    Jan 2, 2007
    Location:
    Greenfield, WI (U.S.A.)
    #1
    I posted this on Apple supports site forum and I figured I might have better luck here.

    property user_name : ""
    property pass_word : ""
    property network_share : ""

    tell application "Finder"
    if user_name is "" then
    set dialog_1 to display dialog "Please enter your username: " default answer ""
    set the user_name to the text returned of dialog_1
    end if

    if pass_word is "" then
    set dialog_2 to display dialog "Please enter your password: " default answer "" with hidden answer
    set the pass_word to the text returned of dialog_2
    end if

    set network_share to "smb://" & user_name & ":" & pass_word & "@mjds5.mjds.org/Students/"

    mount volume network_share
    make new Finder window
    set target of Finder window 1 to folder "mjds5.mjds.org/Students/ & user_name &"
    delay 2
    if (exists folder "Students") then
    display dialog ("It's there")
    else
    display dialog ("It's not there")
    end if

    end tell


    Above I found some code and decided to utilize it, everything works except...
    set target of Finder window 1 to folder "mjds5.mjds.org/Students/ & user_name &"

    I want to find a way for finder to open a finder window with the students user_name being what they entered which is also the name on the network server.

    Any help would be greatly appreciated.


    -----------------------

    This was a response from a user there:

    There seems to be an error in your line:

    set target of Finder window 1 to folder "mjds5.mjds.org/Students/ & user_name &"

    it should read:

    set target of Finder window 1 to folder "mjds5.mjds.org/Students/" & user_name

    (you are concatenating the variable with the user name with the server name string)

    I don't have a server with Active Directory to play with, but if that doesn't work you could try this line in place of the one you're getting problems with:

    set target of Finder window 1 to folder user_name of folder "Students" of disk "mjds5.mjds.org"

    -------------

    This was my response back to that:


    I tried both solutions and I feel like we're right there as far as an answer. :p

    The first one you provided returned an error: Finder got an error: Can't get folder "mjds5.mjds.org/Students/".

    The second one returned: Finder got an error: Can't set disk "mjds5.mjds.org" to folder "dazimov17" of folder "Students" of disk "mjds.mjds.org".

    Any other help you may be able to provide would be greatly appreciated, if you need more info let me know.

    The directory looks like...

    mjds5/
    ..Students/
    ..account/
    ..account 2/
    ..account 3/
    ..account etc/


    --------

    I have still not had any luck with this, if anyone could help that would be appreciated. :)

    Not really familiar with AppleScript.
     
  2. Matthew Yohe macrumors 68020

    Joined:
    Oct 12, 2006
    #2
    OS X can auto mount a user's home folder. If they automount (without scripts) on your windows machines, you can get it working on OSX without resorting to a script like this.
     
  3. Randy53215 thread starter macrumors newbie

    Joined:
    Jan 2, 2007
    Location:
    Greenfield, WI (U.S.A.)
    #3
    Can you be a bit more descriptive? I am afraid you have me confused a little now. :p
     

Share This Page