Re: Trouble escaping @
Re: Trouble escaping @
- Subject: Re: Trouble escaping @
- From: "Nigel Garvey" <email@hidden>
- Date: Mon, 11 Dec 2017 21:40:25 +0000
"Jacopille, David" wrote on Thu, 7 Dec 2017 17:08:17 +0000:
>I’m trying to automatically mount a webdav share but am having
difficulty
>escaping a @ in the password.
>
>property username : "superuser"
>property pass : "Bl@ckberry"
>
>tell application "Finder"
>mount volume "http://" & username & ":" & pass &
>"@servername:5100/content/dam"
>end tell
>
>I get the error: there was a problem connection to the server
>ckberry@servername.
I think you possibly need to percent-encode the "@" in the password:
"Bl@ckberry". You can either write it like that in the script, or get
the script to encode it for you:
use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "Foundation"
property username : "superuser"
property pass : "Bl@ckberry"
set myPassword to current application's class "NSString"'s
stringWithString:(pass)
set passwordAllowedCharacters to current application's class
"NSCharacterSet"'s URLPasswordAllowedCharacterSet()
set encodedPassword to myPassword's
stringByAddingPercentEncodingWithAllowedCharacters:(passwordAllowedCharacters)
mount volume ("http://" & username & ":" & encodedPassword &
"@servername:5100/content/dam")
NG
_______________________________________________
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