我似乎无法弄清楚如何将我的字符串转换为文件
参考。
--savestring4 is the directory listing "/Volumes/Jobs/Artwork/Howard Keys/7-17-14/Happy_Keys/KW_CHK1-CHK49"
--myCode1 is the filename "845849005126"
set p to savestring4 & "/" & myCode1 & ".eps"
set AppleScript's text item delimiters to "/"
set theTextItems to text items of p
set AppleScript's text item delimiters to ":"
set p2 to theTextItems as string
set AppleScript's text item delimiters to {""}
set AppleScript's text item delimiters to ":Volumes:"
set theTextItems2 to text items of p2
set AppleScript's text item delimiters to ""
set p to theTextItems2 as string
set AppleScript's text item delimiters to {""}
set mybarcodepath to a as alias
我不断收到错误,最后一个命令说它无法找到文件
返回p输出:
"工作:艺术品:Howard Keys:7-17-14:Happy_Keys:KW_CHK1-CHK49:845849005126.eps"
非常感谢任何帮助!
答案 0 :(得分:2)
您可以将posix路径字符串转换为如下别名:
set filePosixPath to "/Volumes/Jobs/Artwork/Howard Keys/7-17-14/Happy_Keys/KW_CHK1-CHK49"
set fileRef to (POSIX file filePosixPath) as alias