Closed jonblatho closed 1 year ago
Hahah yeah I have the same issues.
I made a script that sets the status as the spotify song I'm listening to.... and you can imagine the mess
So I think I will try to do this improvement. I think that apple script may have some feature to help us do it.
(in the very moment I was typing rn it did that hahaha lol)
Okay, just found out that the cmd + shift + y keystroke does the job for setting the status specifically
Imma try to change that
Hi both, ensuring the message box is focused has been a big headache for me, ensuring it's empty as well adds an extra layer of complication. Would either of you run an experiment for me? Could you add these commands above the slack commands? - this essentially selects all and deletes within the slack application
tell application "Slack"
activate
keystroke "a" using command down
delay 0.5
key code 51
end tell
Hello, I could just run it now. It does not really function properly. Another thing is that we need to call "System Events" to send key code
and keystroke
commands. So my quick fix was:
tell application "Slack"
activate
tell application "System Events"
tell process "Slack" to keystroke "a" using command down
tell process "Slack" to key code 51
end tell
delay 0.5
end tell
When I run it and I am inside a chat, with the checkbox selected, it selects whatever is inside the message box. But in many other cases, like if I am just scrolling messages, it selects all the visible chat. (Let'sn't forget that slack uses electron) We could try to force that the message box is selected maybe...
Another thing is: is there any possibility to prevent a desktop switch? It is super annoying to call this script via another automation tool (I use hammerspoon to do some weird behaviour that will set my slack status as the song I am listening to on spotify, I know it's unprofessional but lol) And whenever the song switches the desktop switches and it's annoying and a mess and my only dream was to have a discord like feature so i can show off my music... anyway)
At the time of writing I maybe came up with a solution:
What y'all think?
This seems to get things close but doesn't work if you're focused on a thread. Also cmd+a works for me once I've used /
We could add that but with the caveat that this won't work for the main channel whilst your are in a thread
As for the desktop switch, due to electron app and non-first party support for these kind of scripts I don't think this will ever be possible. Very happy to be proven wrong though.
Ok I just found out that you can exit the thread with option + up/down, which will also move you from the current channel.
As for the desktop switch, due to electron app and non-first party support for these kind of scripts I don't think this will ever be possible. Very happy to be proven wrong though.
I am going to take a deeper look if there is any additional tool we can use to achieve that.
I think I have found a combination that works.
arrow up
arrow left
arrow down
Hi all. I've gone with a different approach using the functions outlined in the 2.1.0 release
https://github.com/samknight/slack_applescript/releases/tag/2.1.0
I'm not sure if this is even possible, but can a check be added to ensure that the message box is empty before attempting to enter a command, or could I be warned if it's not empty? I use this to simultaneously set myself as away/available on Slack and another application, and if I happen to have a message typed in the message box in Slack, this will send what I had typed with the command appended, like:
...which can be a bit embarrassing, particularly when the typed "message" happens to be just a space.
Anyway, it's a nice-to-have, not a need-to-have, for my forgetful moments. Thanks for this though, very nice being able to use AppleScript for this! I'm very inexperienced with AppleScript but would be happy to help out if there's anything I can do.