Closed latenitefilms closed 7 years ago
Are you checking the return value of the performAction method? If it returns nil, then an error occurred, most likely a timeout. Errors that occur on the Objective-C side are currently logged at the verbose level under the LuaSkin generic label, so the best way to see them is to type in hs.logger.printHistory()
in the console. (Note to self, use the module logger now that it's been created)
I will add the ability to change the timeout value tonight and we'll see if that helps.
Good to know. Next time I run into the same issue, I'll try and fault-find. Thanks!
The newest version up now now has a setTimeout
method... use it like this: object:setTimeout(#):performAction("AXPress")
where # is the timeout in seconds (it can be a floating point number)
Apple doesn't tell us what the default is anywhere that I could find, and there is no function I can find to query for it, so your guess is as good as mine as to what a good number to try is... the docs do say that if you set it to 0, it reverts to the current process's system wide default (the process here being Hammerspoon)... if object
is ax.systemWideElement()
, then you're setting the processes's default timeout... set that to 0 to reset back to Apple's default.
I'll work on full documentation and observers/watchers this weekend.
Legend, thank you!
For what it's worth... I noticed this on the previous version of your script, but it's still doing it on the current version... sometimes performAction simply won't work on a UI element. For example, I have a button that simply does nothing when I performAction("AXPress") - even though I know it should. If I perform the same action using UI Browser it works fine - so something must be going wrong somewhere along the line. I've tried looking at your code, but it goes WAY over my head.
As a workaround, I've just been "clicking" the button with the mouse, which works fine, but would be better if I didn't have to do this obviously.