Applescript:Select 使用部分字符串的查找器文件夹
Applescript: Select a finder folder using part of a string
我正在寻找 way/code 到 select 特定文件夹中的文件夹,该文件夹包含来自变量的字符串的一部分
我有文件夹 A,文件夹 A 中有许多文件夹。 folderA 中的所有文件夹都以一个 5 位数字开头,后跟一个“_”,然后是一个简短的描述。即,12345_Folder 测试 1,54321_Folder 测试 2,99999_Folder 测试 3,等等...
tell application "Finder"
set folderA to folder "FolderA" of folder "Desktop" of folder "MacUser" of folder "Users" of startup disk
set jobNum to text returned of (display dialog "Enter 5 Digits Only:" default answer "")
open folderA
set selected_item to (folder whose name contains jobNum in folderA) -- This is what's failing for me.
-- from here on I would like to do other things such as run other parts of a script.
end tell
---脚本错误信息
Can’t get folder whose name contains jobNum of folder "FolderA" of
folder "Desktop" of folder "prepress_js" of folder "Users" of startup
disk of application "Finder". ----
非常感谢任何帮助!
尝试这一行:
set selection to item 1 of (get every folder in folderA whose name contains jobNum) -- This is what's failing for me.
我正在寻找 way/code 到 select 特定文件夹中的文件夹,该文件夹包含来自变量的字符串的一部分
我有文件夹 A,文件夹 A 中有许多文件夹。 folderA 中的所有文件夹都以一个 5 位数字开头,后跟一个“_”,然后是一个简短的描述。即,12345_Folder 测试 1,54321_Folder 测试 2,99999_Folder 测试 3,等等...
tell application "Finder"
set folderA to folder "FolderA" of folder "Desktop" of folder "MacUser" of folder "Users" of startup disk
set jobNum to text returned of (display dialog "Enter 5 Digits Only:" default answer "")
open folderA
set selected_item to (folder whose name contains jobNum in folderA) -- This is what's failing for me.
-- from here on I would like to do other things such as run other parts of a script.
end tell
---脚本错误信息
Can’t get folder whose name contains jobNum of folder "FolderA" of folder "Desktop" of folder "prepress_js" of folder "Users" of startup disk of application "Finder". ----
非常感谢任何帮助!
尝试这一行:
set selection to item 1 of (get every folder in folderA whose name contains jobNum) -- This is what's failing for me.