Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old May 1, 2011, 02:11 PM   #1
dwright1974
macrumors 6502
 
Join Date: Aug 2007
Location: UK
AppleScript to mount Windows shares

Hello All

This is my first attempt at AppleScript to mount a network share from a Windows 2003 server on a Mac. When I mount the share manually, (Go > Connect to Server) it works perfectly.

When I try and do it through AppleScript it fails every time and I was wondering if someone could help me please?

Here is the script:

============
Code:
tell application "Finder"
	activate
	
	try
		display dialog "Making CC4 Drives available - Press OK to continue or Cancel to stop"
		mount volume "smb://cc4stdfs/rmshared%20documents"
		display dialog "RM Learning Resources are available in Finder"
	on error
		display dialog "This Mac is unable to access RM Learning Resources"
		
	end try
end tell
============

And here is the Event Log:

============
Code:
tell application "Finder"
	activate
	display dialog "Making CC4 Drives available - Press OK to continue or Cancel to stop"
		--> {button returned:"OK"}
	mount volume "smb://cc4stdfs/rmshared%20documents"
		--> error number -10004
end tell
tell application "AppleScript Editor"
	mount volume "smb://cc4stdfs/rmshared%20documents"
		--> error number -36
end tell
tell application "Finder"
	display dialog "This Mac is unable to access RM Learning Resources"
		--> {button returned:"OK"}
end tell
Result:
{button returned:"OK"}
============
I've Googled it but can't find anything to suggest what isn't working?

Any help anyone could be would be great!

Thanks in advance

- D

Last edited by r.j.s; May 1, 2011 at 07:48 PM. Reason: Added code tags
dwright1974 is offline   0 Reply With Quote
Old May 1, 2011, 02:46 PM   #2
subsonix
macrumors 68040
 
Join Date: Feb 2008
Are you sure you have the correct path? Error -10004 is:

Quote:
Mac OS error -10004 (telBadHandErr): bad handle specified
subsonix is offline   0 Reply With Quote
Old May 1, 2011, 03:06 PM   #3
cluthz
macrumors 68040
 
cluthz's Avatar
 
Join Date: Jun 2004
Location: Norway
Send a message via MSN to cluthz
You can use a shellscript to make it easier:


mount -t smbfs //user@server/sharename share


this wil require you the make a folder named "share" in the user folder

This wil also work, put it in login items if you want to log into it when you log on

Code:
tell application "Finder"
open location "smb://user:password@computername/sharename"
end tell
__________________
-tb
MacBook Air 13" i5 osx10.7.5
HackPro i7-4790k, 16GB RAM, GTX780GHz Edition, 3x SSD , win7+osx10.9.4

Last edited by r.j.s; May 1, 2011 at 07:49 PM. Reason: Post Merge - Please use edit
cluthz is offline   0 Reply With Quote
Old May 1, 2011, 05:36 PM   #4
dwright1974
Thread Starter
macrumors 6502
 
Join Date: Aug 2007
Location: UK
Hi all

Thanks for all your replies.

Will give them a try tomorrow.

Thanks again

- D
dwright1974 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Tags
applescript, mount, share, windows

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
iMac will mount eSata network shares, but not USB 3.0 striped share Lastmboy Mac OS X Server, Xserve, and Networking 0 Apr 20, 2013 11:18 PM
Mount ssh volume with Applescript MacPC Windows, Linux & Others on the Mac 2 Feb 18, 2013 05:36 AM
applescript help : Auto mount sparsebundle image at login MyRomeo OS X 10.8 Mountain Lion 1 Nov 13, 2012 09:25 AM
Problems Connecting to shares on ML Server from Windows caseyf3 OS X 10.8 Mountain Lion 2 Sep 29, 2012 11:44 AM
Applescript to unmount/mount drive on identifier other than volume name? mixvio OS X 10.8 Mountain Lion 0 Sep 6, 2012 04:20 AM

Forum Jump

All times are GMT -5. The time now is 12:13 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC