[1.1.0] OS X 10.10.3 with Java 7+: App.open("Mail") doesn't work anymore --- also for some other Mac apps --- fixed 2015-04-25+

Bug #1445667 reported by Zed
28
This bug affects 4 people
Affects Status Importance Assigned to Milestone
SikuliX
Fix Committed
Critical
RaiMan

Bug Description

---- fixed 2015-04-25+ (using osascript tell app to activate)

----------- workaround
... for situations, where SikuliX App features crash, do not work as expected or are not available at all:
run AppleScript snippets inline, that do the job:
runScript("applescript tell application ...")

... would internally run the given snippet using osascript.

An example for this specific Mail situation: comment #3

... and using Java 7 seems to help

---------------------------------------------------------

For some reason I can no longer launch applications using App.open anymore with the latest night build.
It executes the code but the application does not actually launch.
ie,

App.open("/Applications/Mail.app")

Zed (zh2eou)
description: updated
RaiMan (raimund-hocke)
summary: - App.open doesn't work anymore on OS X 10.10.3 with Sikuli X 1.1.0
- Nightly
+ [1.1.0] OS X 10.10.3: App.open("Mail") doesn't work anymore --- specific
+ Mac problem
Revision history for this message
RaiMan (raimund-hocke) wrote : Re: [1.1.0] OS X 10.10.3: App.open("Mail") doesn't work anymore --- specific Mac problem

seems to be a specific problem with 10.10.3 and Mail.app, since App.open() generally works.

I tried other ways, to start Mail from SikuliX or from terminal: all not working.

the only, that worked in the Terminal was:
osascript -e "tell application \"Mail\" to activate"

(cannot be issued currently with the run() feature - working on that)

once Mail is running, App.close() and App.focus() still work.

Revision history for this message
RaiMan (raimund-hocke) wrote :

tested some variants - this is the only that worked:

cmd = ['osascript', '/Users/raimundhocke/astest.txt']
print run(cmd)

the file /Users/raimundhocke/astest.txt contains the AppleScript command:
tell application "Mail" to activate

using the direct osascript -e script mode does not work and returns the error -10810 (not documented)
cmd = ['osascript', '-e', 'tell application "Mail" to activate']

BTW: does not work either for any not open (Apple) application (like Safari, Calculator, ...)
... but Google Chrome opens

Changed in sikuli:
status: New → Confirmed
importance: Undecided → Medium
assignee: nobody → RaiMan (raimund-hocke)
milestone: none → 1.1.0
Revision history for this message
RaiMan (raimund-hocke) wrote : Re: [1.1.0] OS X 10.10.3: App.open("Mail") doesn't work anymore --- specific Mac problem --- workaround

I added some support for inline run of AppleScript snippets, which might help in such situations.

In this case, this works to open Mail:

# version to run a multiline AppleScript script
cmd = """
applescript
tell application "Mail" to activate
display alert "Mail should have started"
"""
if 0 != runScript(cmd):
  popup("did not work\nsee error message")
  exit(1)

wait(3); App.close("Mail"); wait(3)

# version to run a one-line AppleScript script
if 0 != runScript('applescript tell application "Mail" to activate'):
  popup("did not work\nsee error message")

# to get the textual output of the command
textResult = RunTime.get().getLastCommandResult()

summary: [1.1.0] OS X 10.10.3: App.open("Mail") doesn't work anymore --- specific
- Mac problem
+ Mac problem --- workaround
RaiMan (raimund-hocke)
description: updated
summary: [1.1.0] OS X 10.10.3: App.open("Mail") doesn't work anymore --- specific
- Mac problem --- workaround
+ Mac problem --- workaround (available 2015-04-20+)
RaiMan (raimund-hocke)
summary: [1.1.0] OS X 10.10.3: App.open("Mail") doesn't work anymore --- specific
- Mac problem --- workaround (available 2015-04-20+)
+ Mac 10.10 problem --- workaround (available 2015-04-20+)
Revision history for this message
Zed (zh2eou) wrote : Re: [1.1.0] OS X 10.10.3: App.open("Mail") doesn't work anymore --- specific Mac 10.10 problem --- workaround (available 2015-04-20+)

Hmm was this due to a change in how App.open is implemented? I pulled up an older version from a few months ago (the nightly build from 11-14-2014) and that seems to still work on 10.10.3.

Revision history for this message
RaiMan (raimund-hocke) wrote :

That is interesting.
I did not change anything in the code since then or even before. That all is still the same native C++ stuff as with X-1.0 RC3.
The only difference surely is, that the current respective module (libMacUtil.dylib) was built on (I guess ;-) 10.9.

Since I still have a 10.7 running, I will check the situation from there.

Changed in sikuli:
status: Confirmed → In Progress
importance: Medium → High
RaiMan (raimund-hocke)
summary: - [1.1.0] OS X 10.10.3: App.open("Mail") doesn't work anymore --- specific
- Mac 10.10 problem --- workaround (available 2015-04-20+)
+ [1.1.0] OS X 10.10.3 with Java 8: App.open("Mail") doesn't work anymore
+ --- specific Mac 10.10 problem --- workaround (available 2015-04-20+)
description: updated
RaiMan (raimund-hocke)
Changed in sikuli:
status: In Progress → Fix Committed
importance: High → Critical
summary: [1.1.0] OS X 10.10.3 with Java 8: App.open("Mail") doesn't work anymore
- --- specific Mac 10.10 problem --- workaround (available 2015-04-20+)
+ --- specific Mac 10.10 problem --- fixed 2015-04-24+ (using osascript
+ tell app to activate)
description: updated
summary: [1.1.0] OS X 10.10.3 with Java 8: App.open("Mail") doesn't work anymore
- --- specific Mac 10.10 problem --- fixed 2015-04-24+ (using osascript
- tell app to activate)
+ --- specific Mac 10.10 problem --- fixed 2015-04-24+
summary: [1.1.0] OS X 10.10.3 with Java 8: App.open("Mail") doesn't work anymore
- --- specific Mac 10.10 problem --- fixed 2015-04-24+
+ --- also for some other Mac apps --- fixed 2015-04-24+
RaiMan (raimund-hocke)
summary: - [1.1.0] OS X 10.10.3 with Java 8: App.open("Mail") doesn't work anymore
- --- also for some other Mac apps --- fixed 2015-04-24+
+ [1.1.0] OS X 10.10.3 with Java 7+: App.open("Mail") doesn't work anymore
+ --- also for some other Mac apps --- fixed 2015-04-25+
description: updated
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.