Re: mounting a volume with Applescript (Stefan Economou)
Re: mounting a volume with Applescript (Stefan Economou)
- Subject: Re: mounting a volume with Applescript (Stefan Economou)
- From: email@hidden
- Date: Fri, 21 Oct 2011 09:08:36 -0400
FWIW, we've had a few issues with the "mount
volume" command in the Finder on our network. Sometimes volume mountpoints
persist in the Finder, confusing the subsequent executions of the script.
I instead use the "mount_afp"
shell script command:
do shell script
"mount_afp 'afp://[username]:[password]@[IP
address]/[volume name]' '/Volumes/[volume name]'"
The last parameter defines the mountpoint on the local machine.
You then can use the "umount"
command to eject the volume, and then delete the mountpoint. It gives you
a little more control.
Hope this is of interest, --Stefan
On Oct 20, 2011, at 9:04 PM, DealTek wrote:
> Hi All,
>
> semi newbie question....
>
> I use a simple Applescript below tied to iCal to trigger a backup
of a folder to a folder on another computer on the network.
>
> It works fine if the other volume is already mounted - but fails if
not.
>
> Q: Is there any additional coding I can use to try and mount the volume
prior to running the rest of the script?
>
>
> THANKS IN ADVANCE - DAVE
>
I modified your script a little to add an error handler for the 'say' command,
so you know if it was successful or not
delay 1
set lstDisks to list disks
set strVolumeName to "thedistination" --> the drivename
if lstDisks does not contain strVolumeName then
set strSMB_AFP to "afp" --> smb for window or unix drives
set strUser to "username" --> username you use to log into
the server
set strPass to "password" --> for the login you use
set strIP to "10.0.0.254" --> your server ip
mount volume strSMB_AFP & "://" & strUser & ":"
& strPass & "@" & strIP & "/" &
strVolumeName & "/"
end if
set tSourceFolder to alias "mydrive:myfolder1:thisfolder"
set tDestFolder to alias "thedistination:putithere"
try
tell application "Finder" to duplicate tSourceFolder to tDestFolder
with replacing
say "ended successfully"
on error
say "ended with error"
end try
------------------------------
* * * * * * *
Stefan Economou
Creative Operations Director
Communications
(617) 760-8089
This message is intended for the recipient only and is not meant to be forwarded or distributed in any other format. This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument, or security, or as an official confirmation of any transaction. Putnam does not accept purchase or redemptions of securities, instructions, or authorizations that are sent via e-mail. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of Putnam Investments, LLC (DBA Putnam Investments) and its subsidiaries and affiliates. If you are not the intended recipient of this e-mail, please delete the e-mail.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden