1

我有一些我想通用的例程:在描述文件夹路径时,我想坚持用户当前用户(“~/”),而不是选定的文件夹。

所以我的问题是,如果我在 automator 中选择一个带有“Get Specified Finder Items”的文件夹,它会输出一个像这样的 -non applescript- 列表:(“path/to/my/folder”),我如何用 applescript 复制它. 注意圆括号而不是大括号!

首先我只是想用这个:

on run
  return {"~/path/to/my/folder/under/current/user"}
end run

然后我会添加“获取文件夹内容”块..

谁能告诉我为什么这行不通?提前致谢!

4

2 回答 2

2

好吧,我还是把我为你打的东西贴出来吧:-)

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
于 2013-04-26T14:07:01.413 回答
0

我用以下代码解决了它:

on run
return { POSIX path of ((path to home folder as text)) & "/path to my folder" as text, .. }
end run
于 2013-04-26T13:49:45.697 回答