Closed tarvainen closed 10 months ago
Sounds a good solution!
Hi @octalmage, could you check it out?
hey @tarvainen i'm experiencing crashes in OSX as well, but can't seem to be able to pinpoint what's causing it. May I ask how you managed to work out what was causing it to crash? Do you know of a way to log osascript crashes?
@rockethouse I was actually using the gkm module for listening my keyboard and mouse activity. On mac the java application launched so that it didn't open visible window but still focused that application. Then the active-window kindly responsed me with an error
node_modules/active-window/scripts/mac.scpt:319:324: execution error: System Events got an error: Can’t get window 1 of process "java" whose value of attribute "AXMain" = true. Invalid index. (-1719)
Then just try-catching the script's parts one by one I could find out the main reason causing this issue. When I was trying to get familiar with osascript I just ran the script from the terminal with osascript mac.scpt
.
@robsonvn you're a collaborator now so feel free to approve and merge this!
This cool script failed and my node application crashed when the windowless Java app was started in the background and automatically got 'focused' on OSX El Capitan 10.11.6. Instead of crashing lets just return empty string as a active window title.