I alredy make a pretty auto map drive script based on a text file located in user home directory. it work fine no prob at all. feel free tu use it if necessary. the point is: i would like to had a feature on my script based on droplet possibility. it would be fine to drop allredy connected network drive to add them into the text file. My problem come from the dual nature of file, folder, alias and all that stuff. I cant get info from file, folder but not alias. Finaly, the Network Alias is a weird beast.
heres what i need to get : afp://email@example.com/Archive
Here’s the code:
(*Get the user password*) set the_password to text returned of (display dialog "SVP entrez votre mot de passe rÃ©seau de Rogers:" default answer "" buttons "OK" default button 1 with hidden answer) set the_user to getcurrentuser() (*Open text file where network add are written*) set drivelistpath to "/Users/" & the_user & "/drivelist.txt" set fileContents to readFile(drivelistpath) set listDrive to every paragraph of fileContents (*call mapdrive fonction with network path (POSIX)*) repeat with x in listDrive mapdrive(x, the_user, the_password) end repeat (*Close unneed app*) tell application "Finder" quit application "ConnITv3" end tell (*Get short unser name fonction*) on getcurrentuser() set the_user to the second word of (characters (offset of "Users" in path to ¬ preferences as string) through (length of (path to preferences as string)) of ¬ (path to preferences as string) as string) return the_user end getcurrentuser (*Map drive by adding necessary infos*) on mapdrive(PosixOfDrive, the_user, the_password) tell application "Finder" set ConnexionString to "afp://" & PosixOfDrive mount volume ConnexionString as user name the_user with password the_password end tell end mapdrive