samknight / slack_applescript

AppleScript bundle for Slack methods
274 stars 19 forks source link

Respect hidden Slack during operation #38

Open jgm-ktg opened 1 year ago

jgm-ktg commented 1 year ago
    tell application "System Events"
        set visible of application process "Slack" to false
    end tell

Sending a message in the above context seems to make Slack visible again. Can this be avoided?

samknight commented 1 year ago

Thanks for sharing this script - I hadn't found a way to get this to work in the background before but I think this might be solution to a lot of problems.

I've done some testing today and found that I still need to precede setting th visibility to false with

tell application "Slack"
activate
//set visibility
//send commands
end tell

This has the problem of: 1: Flashing Slack onto the screen initially

  1. having to reset the visibility status inside of each command in my script

Do you have any suggestions on how I can solve this?