AppleScript Passing Password to TMUTIL

Discussion in 'AppleScript' started by Nathan Nimori, Oct 24, 2016.

  1. Nathan Nimori

    Nathan Nimori New Member

    Joined:
    Oct 24, 2016
    Messages:
    2
    Likes Received:
    0
    I'm extremely new to AppleScript as in I only started playing with it last week. I wrote a script to mount a share and set up a time machine destination based on the user's name. This works fine unless the user's password has an @ sign in it. I was hoping that I could use tmutil setdestination -p so that it would prompt for the password but it won't do that if it's executed via applescript. So I was wondering how I can get the password into tmutil either by passing the password or getting the prompt visible from tmutil.

    Below is a sample of my script:

    This mounts the volume:
    mount volume mvolafp as user name uname with password pword

    This configures time machine only if the user's password does not contain an @ sign:
    do shell script "tmutil setdestination \"afp://" & uname & ":" & pword & "@" & mvol & "\"" with administrator privileges

    I'm even starting to think of crazy ideas like having applescript create a shell script with the tmutil command and then have it execute that script.

    Any ideas? It may seem easier to teach the users how to set up time machine but that would be the very last resort. Thank you.
     
    Nathan Nimori, Oct 24, 2016
    #1
    1. Advertisements

  2. Nathan Nimori

    Cory Cooper Moderator

    Joined:
    May 19, 2004
    Messages:
    4,562
    Likes Received:
    120
    Hello and welcome.

    Most of us here don't have much experience with AppleScript/Automator either. There is a good forum that has knowledgeable folks over at MacScripter. Maybe they can shed some light.

    C
     
    Cory Cooper, Oct 29, 2016
    #2
    1. Advertisements

  3. Nathan Nimori

    Nathan Nimori New Member

    Joined:
    Oct 24, 2016
    Messages:
    2
    Likes Received:
    0
    Thank you!
     
    Nathan Nimori, Oct 31, 2016
    #3
    1. Advertisements

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
  1. Alan Munn
    Replies:
    2
    Views:
    442
    Alan Munn
    Jul 10, 2009
  2. Luke
    Replies:
    6
    Views:
    755
  3. wiredcharlie

    Passing variables between applescript frames

    wiredcharlie, Oct 10, 2013, in forum: Automator
    Replies:
    0
    Views:
    352
    wiredcharlie
    Oct 10, 2013
  4. M McErlean

    Applescript result not passing to automator

    M McErlean, Aug 21, 2015, in forum: AppleScript
    Replies:
    1
    Views:
    534
    Cory Cooper
    Aug 22, 2015
  5. YoJeff
    Replies:
    1
    Views:
    482
    Cory Cooper
    Jun 21, 2016
  6. Chriske
    Replies:
    3
    Views:
    474
    honestone
    Jul 19, 2016
  7. Muvuth
    Replies:
    1
    Views:
    254
    Cory Cooper
    Sep 4, 2016
  8. Tom Irvin
    Replies:
    2
    Views:
    263
    honestone
    Oct 6, 2016
Loading...