Capturing username for script that mounts server
Capturing username for script that mounts server
- Subject: Capturing username for script that mounts server
- From: Ed Wiederer <email@hidden>
- Date: Wed, 30 Mar 2005 10:00:42 -0500
I've got a script that I am using as a folder action that takes files saved to the folder and copies them to specific places on different servers. I've managed to cobble something together that will also mount the servers if they aren't already there. The scripting may be a little rough (I am new to this and I'm just adapting bits and pieces wherever I find them), but it's working like a charm on my machine, where the script has my username written into it.
The trick is, I want to distribute this to my coworkers and I want to make it as easy as possible -- i.e. no need for them to open Script Editor and type in their user name. So I'm trying to come up with something that will pop up a dialog box that will capture their user name. But I only want that box to come up the very first time they run the script, and have the script retain that information from there on out.
Below is roughly what I have done, but this pops up the dialog box every time the script is run, even when the servers are mounted. I imagine I could move the set myUser line down to the if thelist does not contain lines, though that would make me repeat it for each server. In any case, it doesn't solve the bigger problem I'm having, which is getting the script to retain that user name so you only get the dialog box the very first time you run it.
Any help is greatly appreciated.
property dialog_timeout : 90 -- set the amount of time before dialogs auto-answer.
property myUser : ""
on adding folder items to this_folder after receiving these_items
tell application "Finder"
if myUser is "" then
set myUser to text returned of (display dialog "Enter your user name" default answer myUser)
end if
try
set thelist to do shell script "ls -a /Volumes/"
if thelist does not contain "Server1" then
mount volume "smb://" & myUser & ":@10.10.10.10/Server1"
end if
if thelist does not contain "Server2" then
mount volume "smb://" & myUser & ":@10.10.10.10/Server2"
end if
end try
duplicate these_items to disk "Server1"
duplicate these_items to disk "Server2"
end tell
end adding folder items to
View/reply at
RE: need a script to mount a networked mac's disk
You must visit the conference to reply. Email replies are not allowed and will be returned.
Use the
unsubscribe form to cancel your email subscription.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden