【发布时间】:2019-10-11 06:21:37
【问题描述】:
我确实在 automator 中制作了这个脚本。
property unset : 0
property orange : 1
property red : 2
property yellow : 3
property blue : 4
property purple : 5
property green : 6
property grey : 7
property tmplFileName : "__ReadMe" as string
property fileType : ".txt" as string
property labelTag : red
on run {input, parameters}
tell application "Finder"
set currentPath to insertion location as text
-- set filePath to POSIX path of currentPath
set txtfilename to tmplFileName & fileType
set txtFile to make new file at insertion location as alias with properties {name:txtfilename}
set the label index of the item (txtFile as alias) to my labelTag
select txtFile
open txtFile
end tell
return input
end run
它给了我以下结果。一个幻影或仅可见的禁用文件。
我做错了什么?仅当我设置标签时才会发生这种情况。关于这一行
set the label index of the item (txtFile as alias) to my labelTag
有什么建议吗?谢谢。
【问题讨论】:
-
我猜应该停止脚本,但脚本已经结束,文件仍然不可选择。以及为什么是 -1,有人可以解释一下。
-
猜猜看,我做到了。仍然存在,但是正确的代码解决方案是什么。
-
不,无处不在。在我的用户文件夹中,在 diff USB 驱动器上,在附加的 TB3 设备上以及在 NAS afp 上。有没有办法重新加载取景器?但还是想知道为什么是-1?
-
奇怪,马特,你的一些反应消失了。删除了吗?
-
当我尝试删除该文件时,我确实收到一条通知,指出有一个应用程序正在使用该文件。 - 我应该使用标签而不是标签吗?有什么建议可以让它发挥作用吗?
标签: applescript macos-mojave macos-catalina