我已经编写了一个脚本,因此我可以快速获取服务器上文件和文件夹的链接。问题是我得到的字符串不会逃避空格。 有人能告诉我如何逃离“#20;%20' ?
tell application "Finder"
set sel to (the POSIX path of (the selection as alias))
set sel to ((characters 10 thru -1 of sel) as string)
set sel to "afp://myserver._afpovertcp._tcp.local/" & sel
set the clipboard to sel
end tell
请帮助谢谢!
答案 0 :(得分:0)
您可以使用text item delimiters
查找和替换字符
tell application "Finder" to set sel to POSIX path of (the selection as alias)
set the clipboard to "afp://myserver._afpovertcp._tcp.local/" & (my findReplace(text 10 thru -1 of sel, " ", "%20"))
on findReplace(t, toFind, toReplace)
set {tid, text item delimiters} to {text item delimiters, toFind}
set t to text items of t
set text item delimiters to toReplace
set t to t as text
set text item delimiters to tid
return t
end findReplace
答案 1 :(得分:0)
以下代码包括来自中的3 setToCheck = set(listToCheck)
for thing in things:
if thing in setToCheck:
https://macosxautomation.com/applescript/sbrt/sbrt-08.html
创建网址时的标准做法是 编码特殊字符(高级ASCII)和空格 十六进制当量。例如,转换URL中的空格 至:%20
脚本:
encoding routines