gui scripting
Terry Warren
terry at trwarren.com
Fri Jul 12 15:52:30 PDT 2013
thanks Kaydell -
this is basically what I am trying to do, but the problem is the following:
using this approach (i.e. via "System Events" application) it turns out that I can actually access the java app's ui elements and extract their values and properties as expected but cannot control them. The basic issue seems to be that to control the ui you need to "activate" the app's process in case its not the current active app and the following script snippet does not accomplish this:
tell application "System Events"
if process "MyJavaApp" exists then
log "found my process"
set tf to value of text field 1 of window 1 of process "MyJavaApp"
log tf
tell process "MyJavaApp"
activate
end tell
end if
end tell
the log messages do get written but the process doesn't activate so, for example, you can't focus to text field 1 and set its value. It appears that the jvm somehow is not letting these types of ui messages to be sent on to the running java app. It might be that the app has to be addressed in a different way?
Terry
so
On Jul 12, 2013, at 3:03 PM, Kaydell Leavitt <kaydell.leavitt at icloud.com> wrote:
> Hi Terry,
>
> I think that this will be useful to you:
>
> http://www.macosxautomation.com/applescript/uiscripting/
>
> I don't think that it matters whether Java supports GUI scripting or not. I believe that GUI scripting is for apps that don't support scriptability through AppleEvents. Going through AppleEvents is like having a second user-interface which is especially made for scripting language such as AppleScript that use AppleEvents to control apps.
>
> Using GUI Scripting is resorted too if scripting language needs to control an app that isn't "scriptable".
>
> The scripts in the link above, turn on accessibility, enabling GUI scripting for "non-scriptable' applications.
>
> So, it's better to go through AppleEvents, but if you have to, you can do GUI Scripting.
>
> -- Kaydell
> kaydell.leavitt at icloud.com
> http://learnbymac.com
>
>
>
>
> On Jul 12, 2013, at 11:01 AM, terry at trwarren.com wrote:
>
>> Hi - I apologize in advance if this is not the appropriate forum for my
>> question.
>>
>> I am trying to understand whether the Oracle jdk port of 1.7 supports gui
>> scripting using applescript. I have created a mac os x app via the app
>> bundler from Oracle and the app itself works fine but (with assistive
>> devices enabled in System Preferences) I cannot access the gui elements of
>> the app from applescript even though the application seems to be
>> recognized (eg with if process "app name" exists). Anyone had experience
>> with this?
>>
>> thanks
>> Terry Warren
>>
>
More information about the macosx-port-dev
mailing list