active-window icon indicating copy to clipboard operation
active-window copied to clipboard

Add try-catch for the window title check script on OSX.

Open tarvainen opened this issue 9 years ago • 5 comments

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.

tarvainen avatar Oct 30 '16 22:10 tarvainen

Sounds a good solution!

robsonvn avatar Nov 29 '16 04:11 robsonvn

Hi @octalmage, could you check it out?

robsonvn avatar Jan 06 '17 04:01 robsonvn

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?

sebszocinski avatar Feb 03 '17 07:02 sebszocinski

@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.

tarvainen avatar Mar 11 '17 17:03 tarvainen

@robsonvn you're a collaborator now so feel free to approve and merge this!

octalmage avatar Jun 29 '17 19:06 octalmage