我有一些我想要通用的例程:在描述文件夹路径时,我想坚持用户当前用户(“〜/”)而不是选定的文件夹。
所以我的问题是,如果我在automator中选择一个带有“Get Specified Finder Items”的文件夹,它会输出一个像这样的-non applescript-list :(“path / to / my / folder”),我该如何复制它与Applecript。注意圆括号而不是括号!
首先,我只想使用它:
on run
return {"~/path/to/my/folder/under/current/user"}
end run
然后我会添加“获取文件夹内容”块..
谁能告诉我为什么这不起作用? 提前谢谢!
答案 0 :(得分:1)
好吧,我不妨发布一下我为你打字的内容: - )
set folderTest1 to "test1"
set folderTest2 to "test2"
set homePath to POSIX path of (path to home folder as text) as text
set attachmentsFolder to (homePath & folderTest1 & "/" & folderTest2) as text
--OR
set homePath to POSIX path of (path to home folder as text) as text
set attachmentsFolder to (homePath & "test1/test2") as text
POSIX PATH 将HFS +路径更改为unix类型路径
回家路径文件夹转到用户主文件夹
文档路径获取用户文档文件夹的路径
POSIX文件将unix类型路径更改为HFS +路径
set homePath to POSIX path of (path to home folder as text) as text
set theHFSPath to (POSIX file homePath)
tell application "Finder"
--The finder looks for the folders in the alais path of theHFSPath
set theFolders to folders of (theHFSPath as alias) as alias list
--> returns is a list of folders in the form of alais paths
end tell
答案 1 :(得分:0)
我用以下代码解决了它:
on run
return { POSIX path of ((path to home folder as text)) & "/path to my folder" as text, .. }
end run