RE: Help with Script to mount SMB
RE: Help with Script to mount SMB
- Subject: RE: Help with Script to mount SMB
- From: "Ball, Dan" <email@hidden>
- Date: Wed, 14 Oct 2015 02:50:30 +0000
- Thread-topic: Help with Script to mount SMB
No, it mounts the share fine. Its the "on error" part not working. The OS X clients use kerberos, so the logged in user credentials are used automatically and no need for username and password to be in the code.
So say you run it, it mounts the share fine. But if you run it again it should error and display a dialog box saying the share is already mounted and timeout after 10 seconds. Its not erroring anymore.
Playing around in Script Editor if I put in just smb://server.apple.com/share it mounts and if you run it again no error happens which is why the on error isn't working in the script. Something must of changed in one of the version of OS X as it worked before.
I guess the only way to fix it is to make it more difficult and put in an if statement of some sort to check to see if its mounted already or something. Was hoping someone would have an idea on why the on error display dialog part stopped working and if there is an easier way to get it working again and keeping it simple?
Hopefully thats clear enough?
This part isn't working:
on error
tell application "Finder"
activate
display dialog "I cannot locate share or you already have it mounted!" buttons {"Cancel"} default button "Cancel" with icon caution giving up after 10
end tell
Thanks,
Dan
________________________________________
From: Alex Zavatone [email@hidden]
Sent: Tuesday, October 13, 2015 9:50 PM
To: Ball, Dan
Cc: email@hidden
Subject: Re: Help with Script to mount SMB
Username and password?
scheme://username:password@path
On Oct 13, 2015, at 9:47 PM, Ball, Dan wrote:
> Hi all,
>
> Hoping someone can help with this script? I have a small xcode app I made years ago that gives users a GUI to mount shares off of our servers. I opened it up here just to make some small changes and I’m noticing the on error part not working anymore. I know this used to work, but not sure when it stopped.
>
> Script:
>
> tell application "Finder"
>
> try
>
> mount volume "smb://server.apple.com/share"
>
> on error
>
> tell application "Finder"
>
> activate
>
> display dialog "I cannot locate share or you already have it mounted!" buttons {"Cancel"} default button "Cancel" with icon caution giving up after 10
>
> end tell
>
> end try
>
> end tell
>
>
>
> What I want the script to do is try and mount the share smb://server.apple.com/share and have it mount. If for some reason they try to mount it again which would be before throw an error and give a message to the user I cannot locate FacShare or you already have it mounted!
>
>
> I copied the code out and into Script Editor to play with it and its still not working.
>
>
> What am I missing?
>
>
> Thanks,
>
>
> Dan
>
> _______________________________________________
> 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
_______________________________________________
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