CamHenlin / imessageclient

send and receive iMessages in a terminal or over ssh
866 stars 50 forks source link

Crash when sending message #18

Closed Haroenv closed 9 years ago

Haroenv commented 9 years ago

Messages.app is open

permissions are given screenshot to Terminal.app

error message:

we have a file to monitor!
Error: /Users/haroenviaene/git/imessageclient/sendmessage_single.AppleScript:170:262: execution error: System Events got an error: Can’t get window 1 of process "Messages". Invalid index. (-1719)

    at ChildProcess.<anonymous> (/Users/haroenviaene/git/imessageclient/applescript/lib/applescript.js:54:13)
    at ChildProcess.emit (events.js:110:17)
    at Process.ChildProcess._handle.onexit (child_process.js:1067:12)
CamHenlin commented 9 years ago

Hi Haroenv, sorry for the inconvenience. Could you revert back to commit 5827bfb875be5dba73cd73aaf3b3eba38bb5a532

by doing:

git checkout 5827bfb875be5dba73cd73aaf3b3eba38bb5a532 . 

And retrying and let me know if that fixes things for you?

Haroenv commented 9 years ago

I checked out, but when doing that, npm install gives an error:

npm WARN package.json imessageclient@1.0.0 No repository field.

and when sending a message (I didn’t reinstall, but it seemed to be different), it flashes the destination and then the message quickly, but it doesn’t send anything (not on the CLI, not on the app).

On 23 Mar 2015, at 22:16, Cameron Henlin notifications@github.com wrote:

Hi Haroenv, sorry for the inconvenience. Could you revert back to commit 5827bfb875be5dba73cd73aaf3b3eba38bb5a532

by doing:

git checkout 5827bfb875be5dba73cd73aaf3b3eba38bb5a532 .

And retrying and let me know if that fixes things for you?

— Reply to this email directly or view it on GitHub.

CamHenlin commented 9 years ago

Yeah the checkout shouldn't have required it another npm install. It was changing back the AppleScript files used to send the messages to an earlier revision. It seems to me that if it's flashing the app and everything on the screen, it is attempting to send. Is Messages.app signed in to an iMessage account? Is Messages.app popping up with any error dialogs?

Haroenv commented 9 years ago

nope, Messages just stays idle and open, nothing happens

On 23 Mar 2015, at 23:10, Cameron Henlin notifications@github.com wrote:

Yeah the checkout shouldn't have required it another npm install. It was changing back the AppleScript files used to send the messages to an earlier revision. It seems to me that if it's flashing the app and everything on the screen, it is attempting to send. Is Messages.app signed in to an iMessage account? Is Messages.app popping up with any error dialogs?

— Reply to this email directly or view it on GitHub https://github.com/CamHenlin/imessageclient/issues/18#issuecomment-85225810.

CamHenlin commented 9 years ago

Can you send the iMessages using only the AppleScript files in the imessageclient directory? You can give it a shot by using this:

osascript sendmessage_single.AppleScript "someimessage@emailaddresss" "test message" false false

Note that the first false might have to be true if you have "Full Keyboard Access" turned on in your System Settings

Haroenv commented 9 years ago

the output of that script is:

whoI@sended-it.to
    message

when using false false, and

whoI@sended-it.to 
        message

(so a different amount of tabs)

I’m on 10.10.3 beta though

CamHenlin commented 9 years ago

Okay, that script is actually silent so that means that the AppleScript is not able to grab the Messages.app window to type in the message. Are you clicking/cmd+tabbing away from the Messages window when it pops up? Or are you using a different locality setting on your Mac, and maybe the Messages window is named something else? I am looking for a process named "Messages" right now, maybe that isn't right for you?

Haroenv commented 9 years ago

There is a Messages process, I looked in top, and it's called the same.

As far as I see, the window is called Messages too

It doesn't switch to messages though, it just displays without leaving terminal

Haroenv commented 9 years ago

Wait a minute? It works when Terminal isn't full screen!

And so does your app

CamHenlin commented 9 years ago

Wow! So full screen breaks the App? Veeeery interesting

Haroenv commented 9 years ago

Could be an issue at my part though, I've had other issues concerning full screen I've still got to look at

CamHenlin commented 9 years ago

Nope, I just confirmed this on my end. Surprising that it hasn't come up sooner to be honest.

CamHenlin commented 9 years ago

Thanks for reporting this and helping figure out the problem. I'm hoping there's something I can do to fix it shortly

Haroenv commented 9 years ago

No problem, thanks for helping to figure it out.

The master now works too by the way

CamHenlin commented 9 years ago

Okay, I just pushed an update that basically activates the Messages app first, which will slide you out of the fullscreen terminal app to send the Message. Definitely sort of clunky but at least it doesn't fail

Haroenv commented 9 years ago

Now it crashes again in full screen

we have a file to monitor!
Error: /Users/haroenviaene/git/imessageclient/sendmessage_single.AppleScript:196:288: execution error: System Events got an error: Can’t get window 1 of process "Messages". Invalid index. (-1719)

    at ChildProcess.<anonymous> (/Users/haroenviaene/git/imessageclient/applescript/lib/applescript.js:54:13)
    at ChildProcess.emit (events.js:110:17)
    at Process.ChildProcess._handle.onexit (child_process.js:1067:12)

And messages sent don't seem to show up in the CLI

CamHenlin commented 9 years ago

Okay, I added another check, it should work for you now. Unfortunately the way it's working right now, it won't make it back to your full screen app so you'll need a cmd+tab to make it back there. I'm going to work on fixing that this evening

CamHenlin commented 9 years ago

Hi Haroenv, I just pushed another update to imessageclient which aims to fix the reliability issues with full screen. It seems to work about as well as is possible with AppleScript, so until https://github.com/CamHenlin/nodeprivatemessageskit is further along, it will have to do. Can you try out the latest version and let me know what you think so I can mark this issue as closed?

Haroenv commented 9 years ago

yep :+1: works perfectly!

On 24 Mar 2015, at 18:09, Cameron Henlin notifications@github.com wrote:

Hi Haroenv, I just pushed another update to imessageclient which aims to fix the reliability issues with full screen. It seems to work about as well as is possible with AppleScript, so until https://github.com/CamHenlin/nodeprivatemessageskit https://github.com/CamHenlin/nodeprivatemessageskit is further along, it will have to do. Can you try out the latest version and let me know what you think so I can mark this issue as closed?

— Reply to this email directly or view it on GitHub https://github.com/CamHenlin/imessageclient/issues/18#issuecomment-85602516.

Haroenv commented 9 years ago

That works smoothly

Haroen

On 24 Mar 2015, at 18:09, Cameron Henlin notifications@github.com wrote:

Hi Haroenv, I just pushed another update to imessageclient which aims to fix the reliability issues with full screen. It seems to work about as well as is possible with AppleScript, so until https://github.com/CamHenlin/nodeprivatemessageskit is further along, it will have to do. Can you try out the latest version and let me know what you think so I can mark this issue as closed?

— Reply to this email directly or view it on GitHub.

CamHenlin commented 9 years ago

Very good, thank you!