当文件被引用时,我有一个工作正常的脚本,但是当我尝试添加一个对话框来选择文件时,我总是会收到错误
set p to "/Users/kevin/Desktop/Time"
set plistfile_path to POSIX file p
set config_file to choose file with prompt "Locate your .plist config file and click OK" of type "plist" default location plistfile_path
tell application "System Events"
set p_list to property list file (config_file)
set startTimeValue to value of property list item "startTime" of p_list
end tell
错误:
错误“系统事件出错:无法生成文件”Macintosh HD:用户:kevin:桌面:时间\“进入类型整数。”编号-1700从文件“Macintosh HD:用户:凯文:桌面:时间”到整数
我的原始脚本使用以下格式:
将plistfile_path设置为“〜/ Desktop / Time / myTime29_March.plist”
如何修复对话框问题?
property list file
的参数不能是AppleScript alias
说明符。
将别名强制转换为文本
set p_list to property list file (config_file as text)