samknight/slack_applescript

Slack's new "Shortcuts" (rolling out now) breaks this

Closed this issue · 14 comments

The new "Shortcuts" functionality that's rolling out to orgs now appears to break this.

When sending a command through "Slack" now, it just sends to the channel because the "Shortcuts" are removing the slash functionality and moving them to their own menu.

Thanks - I'll see if I can set aside some time soon to relook at this

Can confirm it just post to whatever channel/DM I'm on vs doing whats expected

Working on an update now, not too far off

I've now added a new beta version. Please let me know id this resolves any issues you have https://github.com/samknight/slack_applescript/releases/tag/2.0.0-beta.1

I can test right now! Gimme a few to get it set up

@samknight definitely working better! Instead of automatically updating my status, it adds /status <automated status update here> and I need to press enter to set it. Before it was doing that automatically, but not sure if it's possible now (wish I knew more about apple script to help out lol)

Hmm it also moves the window context over to slack if I'm not in the window when the automated update triggers, not sure if that's something avoidable

Hmm it also moves the window context over to slack if I'm not in the window when the automated update triggers, not sure if that's something avoidable

Sorry not sure I fully understand what you're experiencing here

@samknight definitely working better! Instead of automatically updating my status, it adds /status <automated status update here> and I need to press enter to set it. Before it was doing that automatically, but not sure if it's possible now (wish I knew more about apple script to help out lol)

Thanks for testing! Potential fix here:
https://github.com/samknight/slack_applescript/releases/tag/2.0.0-beta.2

@samknight yes that latest beta works as expected! As for the context switch, I think that's an issue on my end using the script so no worries there. Basically, if I'm not in slack and the command to automate triggers, it will switch my window to slack. Ideally I'd want this to happen in the background, but I think I can fix it on the apple script side.

Thanks a lot for fixing!

Thanks @quinnlangille - Unfortunately there won't be a fix due to the way applescripts work. As there are no APIs I can hook into for the desktop app I have to rely on the UI. Other people resolve this by using Slack's web API for which there are other AppleScript libraries out there.

If however you do somehow manage to resolve that, please let me know. I'd be very interested in adding support/adding to the README.

For now though, I will close this issue. Thank you for taking the time to confirm the issue and helping to test the resolution

Can confirm this is working for me now, too. Thanks @samknight !

One odd thing though, one of my Status updates is pasting text in weird.

It's coming through as: "I’m in a meeting and will get back to yo:date:"
But my AppleScript is:
on alfred_script(q) tell script "Slack" set status "I'm in a meeting and will get back to you shortly." with icon ":calendar:" end tell end alfred_script

I also tried:

on alfred_script(q) tell script "Slack" set status ":calendar: I'm in a meeting and will get back to you shortly." end tell end alfred_script

I've tested this a few times and can't reproduce. It's likely something to do with the artificial delay lengths for input which is quite hard to get right. If you're comfortable editing the library yourself I would increase those delays. Otherwise I need to think of an approach where I can balance the speed of the script vs reliability for everyone.

I ended up modifying some of the texts I'd had built to shorter ones and it alleviated this.