首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何将object格式的Applescript输出解析为文本?

如何将object格式的Applescript输出解析为文本?
EN

Stack Overflow用户
提问于 2012-10-26 14:43:50
回答 1查看 415关注 0票数 0

目前我正在运行从Java的Applescript中检索窗口的全部内容,applescript正在返回类对象,如果我从java中运行相同的脚本,这是不会发生的,请建议如何格式化相同的内容。

代码语言:javascript
运行
复制
tell application "System Events"

    tell process "Install Adobe Flash Player"

      set tElements to entire contents of window 1

        end tell
end tell
tElements

输出:

代码语言:javascript
运行
复制
{button 1 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", button 2 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", button 3 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", scroll area 1 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", UI element 1 of scroll area 1 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", group 1 of UI element 1 of scroll area 1 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", image 1 of group 1 of UI element 1 of scroll area 1 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", group 2 of UI element 1 of scroll area 1 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", static text "Adobe Flash Player 11" of group 2 of UI element 1 of scroll area 1 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", progress indicator 1 of UI element 1 of scroll area 1 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", group 3 of UI element 1 of scroll area 1 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", static text "  " of group 3 of UI element 1 of scroll area 1 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", image 1 of UI element 1 of scroll area 1 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", group 4 of UI element 1 of scroll area 1 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", static text "Error: General installation error" of group 4 of UI element 1 of scroll area 1 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", button "Finish" of UI element 1 of scroll area 1 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", static text "Adobe Flash Player Installer" of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events"}
EN

回答 1

Stack Overflow用户

发布于 2012-10-26 22:03:00

你想瞄准他们中的一个..。哪个?你不用说。然而,通常你会得到其中一个对象的“值”。举个例子,你可以这样做。

代码语言:javascript
运行
复制
tell application "System Events"
    tell process "Install Adobe Flash Player"
       set theValue to value of group 2 of UI element 1 of scroll area 1 of window "Adobe Flash Player Installer"
    end tell
end tell

如果"value“不起作用,那么你可以获得对象的属性,看看你想要哪个属性……

代码语言:javascript
运行
复制
tell application "System Events"
        tell process "Install Adobe Flash Player"
           set theProperties to properties of group 2 of UI element 1 of scroll area 1 of window "Adobe Flash Player Installer"
        end tell
end tell
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13082060

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档