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



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

在mac上,浏览器插件安装在名为"Internet插件"的文件夹中。您可以将此文件夹放在用户的Libray文件夹或主Library文件夹中。所以使用appescript我们可以检查那些文件夹。。。

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

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播放器将安装在系统中,您也可以在您的系统中查看已安装的程序

最新更新