File AppleScript:无法引用文件

File AppleScript:无法引用文件,file,integer,applescript,posix,plist,File,Integer,Applescript,Posix,Plist,当文件被引用时,我有一个工作正常的脚本,但是当我尝试添加一个对话框来选择文件时,我总是会得到一个错误 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 pl

当文件被引用时,我有一个工作正常的脚本,但是当我尝试添加一个对话框来选择文件时,我总是会得到一个错误

  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:Users:kevin:Desktop:Time\“输入整数。”数字 -1700从文件“Macintosh HD:Users:kevin:Desktop:Time”到整数

我的原始脚本使用以下格式:

将plistfile\u路径设置为“~/Desktop/Time/myTime29\u March.plist”


如何解决对话框问题?

属性列表文件的参数不能是AppleScript
别名
说明符

将别名强制为文本

set p_list to property list file (config_file as text)