我有一个部分有效的脚本。我需要打印出正常工作的文件夹名称列表。但后来我需要将每个文件夹放到一个特定的路径中,然后打印出那些特定的文件夹名称。每当我尝试这样做时,我的文本文件都是空白的。我已将文本文件分开以尝试找到问题,无论我尝试什么,我都会得到相同的结果。第一个文本文件有效,但第二个文件始终为空白。理想情况下,我希望第二个文本文件使用脚本中指定的格式。任何指导都将不胜感激。
tell application "Finder"
with timeout of 3600 seconds
set src to (path to me) as string
set multiPath to (src & "Contents:Resources:Fixed multiSteps")
set zipFiles to {".zip"}
set allPlugins to get name of every folder in folder ("" & multiPath & "") whose name extension is not in zipFiles
set outputFile to ((path to desktop as text) & "pluginNames.txt")
set typeFile to ((path to desktop as text) & "types.txt")
set fileReference to open for access file outputFile with write permission
set filetypeReference to open for access file typeFile with write permission
try
repeat with a in allPlugins
write a & return to fileReference
set innerPath to (a & "Double Click to Install.app:Contents:Resources")
set innerFolders to get name of every folder in folder ("" & innerPath & "")
repeat with b in innerFolders
write a & " - " & b & return to filetypeReference
end repeat
end repeat
end try
end timeout
end tell
答案 0 :(得分:0)
好的所以我明白了。
tell application "Finder"
with timeout of 3600 seconds
set src to (path to me) as string
set multiPath to (src & "Contents:Resources:Fixed multiSteps:")
set zipFiles to {".zip"}
set allPlugins to get name of every folder in folder ("" & multiPath & "") whose name extension is not in zipFiles
set ListFile to ((path to desktop as text) & "List.txt")
set filetypeReferenceList to open for access file ListFile with write permission
try
repeat with a in allPlugins
set innerPath to (multiPath & a & ":Double Click to Install.app:Contents:Resources")
set typesForList to get name of every folder in folder ("" & innerPath & "")
write a & " - " & typesForList & return to filetypeReferenceList
end repeat
end try
end timeout
end tell