Giter Site home page Giter Site logo

Comments (6)

samknight avatar samknight commented on July 18, 2024

Hi,

I believe we're seeing a few issues with the delay being too short. Whilst I keep working on the beta can I suggest you add in your own delay between moving channels and pasting the message.

tell script "Slack"
        focus workspace "Work"
        focus channel "@platform-bot" 
        delay 0.5
	send message "whatis " & the_text
end tell
return msg```

from slack_applescript.

samknight avatar samknight commented on July 18, 2024

I've updated the library to 2.0.0.rc1 https://github.com/samknight/slack_applescript/releases/tag/2.0.0.rc1

please give this new version a try

from slack_applescript.

wabiloo avatar wabiloo commented on July 18, 2024

Hi @samknight,
Sorry for the delay in getting back to you...

I'm afraid it's still not working for me.
I've update to 2.0.0, and also added the focus+delay snipped as above.


tell script "Slack"
	focus workspace "my_company"
	focus channel "@my_channel"
	delay 2
	send message "whatis " & the_text
end tell

I ran into 2 issue with this code:

  1. execution error: System Events got an error: Can’t get menu item 1 of menu "Window" of menu bar 1 of process "Slack" whose name starts with "my_company". Invalid index. (-1719)

  2. I then commented the focus workspace line. After that, the change of channel does occur, but the cursor is not in the message box and therefore the send message command doesn't do anything...

If I'm already on the correct channel when triggering the workflow, then for some reason the cursor is on the text box and the message does get sent (but that's defeating the point slightly)

One workaround is to repeat the focus channel line after the delay, but again, that's a little suboptimal.

from slack_applescript.

samknight avatar samknight commented on July 18, 2024

Hi, I'm sorry this is not currently working for you.

  1. Please see my comment on the issue raised here #18
  2. Again sub optimal but you may wish to try
key code 44
delay 0.2
key code 53 

that should bring the text box into focus. Let me know if that works and I will add that in to the main library for release

from slack_applescript.

samknight avatar samknight commented on July 18, 2024

Hi @wabiloo Did this work for you?

I have noticed that if you have the avatar menu up. You need to escape out of that and then do the above commands but you would automatically mark your current channel as read if that menu is not up.

How have you got on with this?

from slack_applescript.

samknight avatar samknight commented on July 18, 2024

Closing due to inactivity but please feel to raise a new issue if you are still struggling

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.