java - 如何使用 Applescript 或 Java 检查 Mac 上安装的 Adob​​e flash Player?

标签 java applescript

我正在尝试以编程方式安装 Adob​​eFlashPlayer,在此之前我需要检查它是否已经安装?如果是,那么我需要获取相同的版本。由于 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 上安装的 Adob​​e flash Player?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13640260/

相关文章:

java - 我如何才能在 Java 中成功实现多线程 Selenium Server?

Java - 学习继承,使用Graphics2D,调整框架大小时重绘对象

applescript - 从 AppleScript 获取文件路径

macos - Applescript-将窗口置于前台

java - 如何对Java对象(类)进行编码并再次解码?

java - Jackson 数据不一致的编码

java - 如何获取模式匹配后的子字符串?并从初始字符串中删除找到的子字符串

applescript - 如何在 applescript 中获取选定的 ui 元素?

regex - Applescript 从 PDF 文件中提取数字对象标识符 (DOI)

xcode - 自动 Xcode Git 提交提示