airmessage / airmessage-server

AirMessage's native message relay server for Mac
Apache License 2.0
183 stars 12 forks source link

Fixes for Invalid Index errors. #33

Closed j4byers closed 1 year ago

j4byers commented 1 year ago

@tagavari Hey, I replied to you on Discord -- these are the fixes that have eliminated those AppleScript Invalid Index errors for me. Basically makes use of some repeat loops to detect the presence of the buttons we're looking for, and uses try catch exceptions to prevent stopping on irrelevant errors.

In the future, I might try speeding up the execution of these scripts by replacing some of the arbitrary delays with similar loops.

tagavari commented 1 year ago

Thanks a lot! I've never been able to recreate the invalid index errors, but I've run this through my test cases and everything continues to work as expected.

Are you running AirMessage on an older Mac? I'm wondering because I've done almost all my testing for FaceTime on an M1 Mac, so I'm curious if older / slower machines have an impact on how well these scripts succeed.

mkitchingh commented 1 year ago

I'm running it on an m1 mini. It has no keyboard or mouse, but does have a webcam hooked up to it. I can place a FaceTime call from the Mac through a VNC session. I get this every time when attempting through airmessage. AppleScript error -1719: System Events got an error: Can’t get sheet 1 of window 1 of process "FaceTime". Invalid index.

tagavari commented 1 year ago

There goes my theory. @mkitchingh do you notice anything in common between the times you get this error?

mkitchingh commented 1 year ago

Nothing at all. It has never worked a single time for me. I believe The air changed from the very first version that supported FaceTime to the next versions, but it has been getting this one consistently for a while. I try every time there is an update.