我正在尝试测试服务器(我的NAS(是否已安装。我不能使用磁盘的名称,因为AppleScript返回了NAS卷的名称,而不是NAS的名称,所以我尝试了:
tell application "Finder"
tell application "System Events" to set theVolumes to every disk
repeat with thisVolume in theVolumes
set isLocal to thisVolume's local volume
if (not isLocal) then
set thisDisk to thisVolume's server -- > unable to coerce the data to the desired type
end if
end repeat
end tell
脚本调试器返回以下错误:无法将数据胁到所需的类型
谢谢。
代码完全属于 System Events
。发现器根本不涉及。
发生错误是因为您尝试在Finder
告诉块中解决System Events
术语。用System Events
替换Finder
,然后在第二行中删除tell
零件。
tell application "System Events"
set theVolumes to every disk
repeat with thisVolume in theVolumes
set isLocal to thisVolume's local volume
if (not isLocal) then
set thisDisk to thisVolume's server -- > unable to coerce the data to the desired type
end if
end repeat
end tell