Skip to content

Instantly share code, notes, and snippets.

@dariusz-wozniak
Last active January 15, 2021 22:22
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dariusz-wozniak/963915650a827307d7f8eaba3fd46227 to your computer and use it in GitHub Desktop.
Save dariusz-wozniak/963915650a827307d7f8eaba3fd46227 to your computer and use it in GitHub Desktop.
Run Slack Minimized (AutoHotkey script)
Run, %USERPROFILE%\AppData\Local\slack\Update.exe --processStart "slack.exe", , Normal
WinWait, ahk_exe slack.exe
Loop, 50
{
WinHide, ahk_exe slack.exe
Sleep, 200
}
@seasonshu
Copy link

That was a lifesaver, thank you. Also used the script for the more annoying Skype to start minimized.

Suggestion: use this as the first line instead:
Run, %USERPROFILE%\AppData\Local\slack\Update.exe --processStart "slack.exe", , Normal

I also replaced WinHide with WinMinimize so that the icon is kept on the taskbar.

ALL: to autostart, read about "shell:startup" on W10.

@brenak
Copy link

brenak commented Oct 16, 2018

This pointed me in the right direction for using the Windows 10 Slack App. I modified the script as follows:

Run, %USERPROFILE%\AppData\Local\Microsoft\WindowsApps\slack.exe, , Hide

WinWait, ahk_exe slack.exe

Loop, 50
{
	WinClose, ahk_exe slack.exe
	Sleep, 200
}

Changing Normal on the first line to Hide stops the initial flicker with the loading. You still get a slight flicker when the app itself closes. I modified the WinHide to WinClose in the loop. If you use WinHide, CPU levels remain higher as if the application was displaying. When you close, slack still pushes to the tray, then free's up memory and reduces CPU to near 0. Note for the close to work, the preferences in slack under Advanced, Other Options require the "Leave app running in notification area when the window is closed" option checked off, which I believe it is by default.

@yani
Copy link

yani commented Apr 11, 2019

For me, Slack was installed at "C:\Program Files (x86)\Slack\Slack.exe"

@brian-gates
Copy link

Hi, I tried

Run, %USERPROFILE%\AppData\Local\Microsoft\WindowsApps\slack.exe, , Hide

But it does not work, despite %USERPROFILE%\AppData\Local\Microsoft\WindowsApps\slack.exe working via command line.

Any thoughts why this might be?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment