我曾经使用以下苹果脚本在我的显示器上找到实际的壁纸图像(双模式)并在finder中显示。在El Capitan下,脚本运行正常。安装Mac OS Sierra后,脚本显示错误消息
"错误"“Finder”帽子einen Fehler erhalten:Die Routine kann Objekte dieser Klasse nicht bearbeiten。"编号-10010"
英文翻译:
"错误"“Finder”收到错误:该例程无法使用此类对象。“number - 10010"。脚本中突出显示的对象是"显示rotationImage"
我不是苹果脚本专家。不幸的是,我无法在网上找到任何帮助。可能是什么问题?
tell application "System Events"
set posix_path to (pictures folder of desktop 1)
set picPath to (POSIX file posix_path) as string
end tell
set thePictures to (do shell script "sqlite3 ~/Library/Application\\ Support/Dock/desktoppicture.db \"SELECT data.value FROM preferences INNER JOIN data on preferences.key=16 and preferences.picture_id=5 and preferences.data_id=data.ROWID\"")
set fullPath to picPath as string
set rotationImage to fullPath & thePictures
tell application "Finder"
reveal rotationImage
activate
end tell
tell application "Finder"
get selection
repeat with moose in result
if original item of moose exists then
reveal original item of moose
end if
end repeat
end tell
答案 0 :(得分:0)
该脚本即使在Sierra上也可以在我的机器上运行,失败的原因可能是reveal
需要文件引用而不是文字字符串。
这是您脚本的略微优化版本:
tell application "System Events"
set posix_path to (pictures folder of desktop 1)
set picPath to (POSIX file posix_path) as string
end tell
set thePictures to (do shell script "sqlite3 ~/Library/Application\\ Support/Dock/desktoppicture.db \"SELECT data.value FROM preferences INNER JOIN data on preferences.key=16 and preferences.picture_id=5 and preferences.data_id=data.ROWID\"")
set fullPath to picPath as string
set rotationImage to fullPath & thePictures
tell application "Finder"
try
set aliasItem to item rotationImage
if class of aliasItem is alias file then
reveal original item of aliasItem
end if
end try
end tell