如何使用Applescript或Java检查安装在Mac上的Adobe Flash Player?

时间:2012-11-30 06:41:27

标签: java applescript

我正在尝试以编程方式安装AdobeFlashPlayer,之前我需要chk是否已安装?,如果是,那么我需要获得相同的版本。由于Flash播放器将作为插件添加,我需要在Safari和Firefox浏览器中使用相同的功能。请建议如何使用Applescripts实现相同的功能(如果可能,不使用SWFObject)。

2 个答案:

答案 0 :(得分:2)

在Mac上,浏览器插件安装在名为“Internet Plug-Ins”的文件夹中。您可以将此文件夹放在用户的Libray文件夹或主库文件夹中。所以使用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

答案 1 :(得分: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);
   }

Adob​​e flash player将安装在系统中,您可以检入系统安装的程序