我正在尝试以编程方式安装 AdobeFlashPlayer,在此之前我需要检查它是否已经安装?如果是,那么我需要获取相同的版本。由于 Flash Player 将作为插件添加,因此我需要在 Safari 和 Firefox 浏览器中进行相同的检查。请建议如何使用 Applescripts 实现相同的目的(如果可能的话,不使用 SWFObjects)。
最佳答案
在 Mac 上,浏览器插件安装在名为“Internet Plug-Ins”的文件夹中。您可以将此文件夹放在用户的 Libray 文件夹或主 Library 文件夹中。因此,使用 applescript 我们可以检查这些文件夹...
set pluginName to "Flash Player.plugin"
set pluginsMainFolder to (path to library folder from local domain as text) & "Internet Plug-Ins:"
set pluginsUserFolder to (path to library folder from user domain as text) & "Internet Plug-Ins:"
-- check the folders and get the version if found
set theVersion to missing value
tell application "System Events"
try
set f to first file of folder pluginsMainFolder whose name is pluginName
set theVersion to short version of f
end try
if theVersion is missing value then
try
set f to first file of folder pluginsUserFolder whose name is pluginName
set theVersion to short version of f
end try
end if
end tell
if theVersion is missing value then
display dialog pluginName & " is not installed!"
else
display dialog pluginName & " is installed!" & return & "Version: " & theVersion
end if
关于java - 如何使用 Applescript 或 Java 检查 Mac 上安装的 Adobe flash Player?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13640260/