Re: how to use mount volume with timeout argument in AppleScript.
Re: how to use mount volume with timeout argument in AppleScript.
- Subject: Re: how to use mount volume with timeout argument in AppleScript.
- From: Ryan Britton <email@hidden>
- Date: Thu, 3 Aug 2006 08:00:05 -0700
If you're just interested in mounting an SMB share, you can do this
in Carbon with better results.
//These are defined elsewhere
NSString *server;
NSString *user;
NSString *password;
NSString *path;
FSVolumeRefNum mountReference;
//Mounting
NSURL *url = [NSURL URLWithString:[[NSString stringWithFormat:@"smb://
%@/%@", server, path]
stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]];
if (!url)
{
return NO;
}
OSStatus result = FSMountServerVolumeSync((CFURLRef) url, NULL,
(CFStringRef) user, (CFStringRef) password, &mountReference, 0);
//Get the mount path
FSRef volPathRef;
OSErr err = FSGetVolumeInfo(mountReference, 0, NULL, kFSVolInfoNone,
NULL, NULL, &volPathRef);
if (err != noErr)
{
return nil;
}
char *pathChars = (char *) malloc((PATH_MAX + 1) * sizeof(char));
OSStatus result = FSRefMakePath(&volPathRef, pathChars, PATH_MAX);
pathChars[PATH_MAX] = 0;
if (result != noErr)
{
free(pathChars);
return nil;
}
NSString *mountPath = [NSString stringWithUTF8String:(char *)
pathChars];
free(pathChars);
//Unmounting
pid_t dissenter;
OSStatus result = FSEjectVolumeSync(mountReference, 0, &dissenter);
On Aug 3, 2006, at 12:33 AM, Amit Jain wrote:
Hi All,
Is there any way to reduce the searching time of mac while trying to
mount any IPAddress
through apple script. I had tried but I am unable to use an argument
for timeout in the following command:
tell application "Finder"
mount volume "smb://any-user:password@ipaddress/sharedVolume"
end tell
where shud I put the timeout argument or if anyone knows a better way
to do the same.
I am using this code in my application but it hangs for longtime when
I enter a wrong IPAddress which I have to reduce.I think I have tried
my best to explain my problem.
Please help ASAP.
Thanks in advance..
Regards..
Amit
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden