2

我正在尝试以编程方式安装 Adob​​eFlashPlayer,在此之前我需要检查它是否已经安装?如果是,那么我需要获取相同的版本。由于 Flash 播放器将作为插件添加,因此我需要在 Safari 和 Firefox 浏览器中进行相同的检查。请建议如何使用 Applescripts 实现相同的功能(如果可能,不使用 SWFObjects)。

4

2 回答 2

2

在 Mac 上,浏览器插件安装在名为“Internet Plug-Ins”的文件夹中。您可以在用户的​​库文件夹或主库文件夹中拥有此文件夹。所以使用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
于 2012-11-30T11:52:37.107 回答
0

Shockwave Flash 插件将安装在浏览器中运行以下代码以查找浏览器中安装的插件列表

for( var i = 0; navigator.plugins[ i ]; ++i ) {
      if( navigator.plugins[ i ].name.toLowerCase().indexOf( name ) > -1 )
        console.log(navigator.plugins[ i ].name);
   }

Adobe flash player 也将安装在系统中,您可以检查系统安装的程序

于 2012-11-30T09:05:35.250 回答