我需要编写一些代码才能执行此操作,但Applescript编辑器无法查看文件(ewqe_file)是否存在。 (它存在)
答案 0 :(得分:0)
路径应以这种格式编写:
"Macintosh HD:Users:username:Desktop:file.txt"
答案 1 :(得分:0)
以这种方式尝试:
set fullPath to (POSIX path of (path to desktop folder as text)) & "aFolderOnMyDesktop/44034_D.pdf"
tell application "System Events"
if exists file fullPath then
log fullPath
-- do your stuff
end if
end tell
来自StandardAdditions的 path to
命令:
path to v : Return the full path to the specified folder
path to application support/applications folder/desktop/desktop pictures folder/documents folder/downloads folder/favorites folder/Folder Action scripts/fonts/help/home folder/internet plugins/keychain folder/library folder/modem scripts/movies folder/music folder/pictures folder/preferences/printer descriptions/public folder/scripting additions folder/scripts folder/services folder/shared documents/shared libraries/sites folder/startup disk/startup items/system folder/system preferences/temporary items/trash/users folder/utilities folder/workflows folder/voices/apple menu/control panels/control strip modules/extensions/launcher items folder/printer drivers/printmonitor/shutdown folder/speakable items/stationery : the folder to return
[from system domain/local domain/network domain/user domain/Classic domain] : where to look for the indicated folder
[as type class] : the type to return: alias or string (default is alias)
[folder creation boolean] : Create the folder if it doesn’t exist? (default is true)
→ alias : the path to the specified folder