Is there a way to automatically have Messages open the text chat thread with a specific person in a new window? I am often chatting with my wife and would love a macro that would open our chat thread in a separate window, without having to go to the Messages app and double-clicking on the left-hand bar.
OMG, of course!!! Thank you. Hardcoded this to my wife, and made it a hot key. Even threw it in an If statement, in case the window is already open. So helpful, THANKS!
Hello @richtack,
could you take a screenshot of your macro item? You gave me an idea with your question.
But for me the selection of the existing contact with the action "Insert Txt by Pasting" does not work.
If I select a contact with a new message I cannot select the menu "Select Show a Menu Item action to select File > Open Conversation in Separate Window". This action is then highlighted in light grey.
So I cheated a bit, and took some Applescript I found to select a chat based on a specific email address.
I wonder if this would work by passing a KM variable to the script for targetBuddyHandle? You certainly could do a list of variables in a popup box.
Note, I put the "open conversation in a separate window" menu command in an IF statement, that is checking to see if there is already a window open with that name. Mostly because when I ran the macro a 2nd time, the macro was crapping out. (Because that window was already open, so it is selecting the separate window that automatically exists and the menu item was greyed out)
FYI, I have the window then resizing and moving after this last action, I just couldn't fit it, and it wasn't relevant to your question.
I hope this helps!
tell application "Keyboard Maestro Engine"
setvariable "km_var_name" to asTextValue
end tell
tell application "Keyboard Maestro Engine"
set myAppleScriptVariable to getvariable "km_var_name"
end tell
See the wiki for more and ask questions if needed.
Are you minimizing the main chat window and then making the separate chat window active again before the macro ends? I started to play with that and got distracted by my actual job!!!
I noticed that you're using three If Then Else actions to have the macro do different things depending on what the Name variable is. While this obviously works, I thought you might want to know that there is another action designed exactly for this sort of purpose (i.e. branching actions depending on the contents of a single variable) that is both easier to manage and more efficient, because it doesn't execute every If Then Else action every time the macro is run. It's called Switch/Case, and it can be used to improve your macro like this:
All the same actions that are in your original macro are still here, but in this collapsed form, you can see how the macro branches based on the Name variable's value, all in a single enclosing Switch/Case action. Once you know about this action and what it can do it can be very useful, so I hope you find this example helpful.
Okay, I loved your idea, but i'm very lazy, and I hate the idea of having to toggle to a different name if I don't have to. So I created a popup prompt like you did, but I used a variable as the default value. In an applescript before this, I set the value of that variable based on time. So if's before 10:30am, Bryan is the default name, but after 10:30am, Gen is the default.
I also passed the variable into the applescript, and set the actual email address there. This way I don't have to have multiple branches to run. if I want to add, I can just add to the popup and to the applescript.
The applescript to set the variable and pass to the prompt in KM is:
set ToD to (time of (current date))
if ToD < 36000 then
set msgdefaultAS to "Bryan"
else
set msgdefaultAS to "Gen"
end if
tell application "Keyboard Maestro Engine"
setvariable "msgdefault" to msgdefaultAS
end tell
And on the other side, my main applescript is:
tell application "Keyboard Maestro Engine"
set textaddress to getvariable "toText"
end tell
if textaddress is "Bryan" then set targetBuddyHandle to "xxx@gmail.com"
if textaddress is "Gen" then set targetBuddyHandle to "yyy@yahoo.com"
tell application "Messages"
set thisBuddy to first buddy whose handle is targetBuddyHandle and service type of service of it is iMessage
set thisChat to make new text chat with properties {participants:{thisBuddy}}
end tell
I'm fairly new to all this, so i'm cobbling together what I find from others. There is likely a more streamlined way to do, which i'm very interested in learning!
I feel the same way @richtack I am only since 2013 in the Apple world and use KM only since one year somewhat more intensively.
I am every day here in the forum to discover new again. One gets also always very fast help.