Re: mounting a volume with applescript
Re: mounting a volume with applescript
- Subject: Re: mounting a volume with applescript
- From: wayne melrose <email@hidden>
- Date: Thu, 20 Oct 2011 22:24:21 +0200
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
_______________________________________________
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