Hi… im very new to apple script. I have a background in vb, but cant figure this out…
I am trying to mount a drive off a windows box, and use the following script
mount volume “smb://squad leader:w@server ip/drive”
when i run that i get a netword file permission error… so i ran it with out the password… so that i would ahve to manually type the password in, and in the username it has SQUAD%20LEADER, so thats where my problem is… how can i get it to recognize the space between the 2 words???
thanks in advance
Thanks alot… but that doesnt seem to work… that was the first thing i tried…
I put the password as squad%20leader, and it comes out as squad%25%20leader… so im very confused, could this just be an obstical that cannot be overcome in 10.2.8? Thanks
I can’t test this (no SMB volumes available) but maybe it will work. Modify the first three lines to suit your needs.
set usr to "squad leader" -- user name
set pwd to "w" -- password
set ip_ to "server ip/drive"
set url_ to "smb://" & my encode_text(usr, false, false) & ":" & pwd & "@" & ip_
mount volume url_
on encode_text(this_text, encode_URL_A, encode_URL_B)
set the standard_characters to ¬
"abcdefghijklmnopqrstuvwxyz0123456789"
set the URL_A_chars to "$+!'/?;&@=#%><{}[]"~`^\|*"
set the URL_B_chars to ".-_:"
set the acceptable_characters to the standard_characters
if encode_URL_A is false then ¬
set the acceptable_characters to ¬
the acceptable_characters & the URL_A_chars
if encode_URL_B is false then ¬
set the acceptable_characters to ¬
the acceptable_characters & the URL_B_chars
set the encoded_text to ""
repeat with this_char in this_text
if this_char is in the acceptable_characters then
set the encoded_text to ¬
(the encoded_text & this_char)
else
set the encoded_text to ¬
(the encoded_text & encode_char(this_char)) as string
end if
end repeat
return the encoded_text
end encode_text
on encode_char(this_char)
set the ASCII_num to (the ASCII number this_char)
set the hex_list to ¬
{"0", "1", "2", "3", "4", "5", "6", "7", "8", ¬
"9", "A", "B", "C", "D", "E", "F"}
set x to item ((ASCII_num div 16) + 1) of the hex_list
set y to item ((ASCII_num mod 16) + 1) of the hex_list
return ("%" & x & y) as string
end encode_char