Giter Site home page Giter Site logo

Comments (8)

samknight avatar samknight commented on July 18, 2024 1

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

from slack_applescript.

henriquenunez avatar henriquenunez commented on July 18, 2024

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)

from slack_applescript.

henriquenunez avatar henriquenunez commented on July 18, 2024

Okay, just found out that the cmd + shift + y keystroke does the job for setting the status specifically

Imma try to change that

from slack_applescript.

samknight avatar samknight commented on July 18, 2024

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

from slack_applescript.

henriquenunez avatar henriquenunez commented on July 18, 2024

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:

  • If you type / on slack it will open the prompt and you can type anything to send in the message box.
  • But what it actually does is that it does not really send the message, it just focus the message box.
  • We can then delete the N characters from the message box, select all, copy to a temp storage
  • Send our actual slack command
  • Restore the message box w/ the content of that temp storage.

What y'all think?

from slack_applescript.

samknight avatar samknight commented on July 18, 2024

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 /

  • type /
  • escape
  • cmd+x (to cut the existing text)
  • do the message
  • cmd+v

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.

from slack_applescript.

henriquenunez avatar henriquenunez commented on July 18, 2024

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.

from slack_applescript.

samknight avatar samknight commented on July 18, 2024

I think I have found a combination that works.

arrow up
arrow left
arrow down

from slack_applescript.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.