Hi,
Can anyone help me with a script for Spotify please?
When the option 'open minimized' is selected in the settings of the app, it still opens op on windows boot in a minimized windows.
I would like it to boot into tray only.
I have the script below but this does not work (entirely). It does prevent the window from opening but the app still pops up as an opened application on the taskbar.
if WinExist("Spotify Premium") WinClose ; Use the window found by WinExist.
Anyone could help me with this?
Thank you
Open Spotify to tray on start up
Re: Open Spotify to tray on start up
Code: Select all
runApp("Spotify")
WinWait, ahk_exe Spotify.exe,, 30
If ErrorLevel
Return
Sleep, 500
PostMessage, WM_SYSCOMMAND := 0x0112, SC_CLOSE := 0xF060
runApp(family, appID := "") {
Loop, Files, % StrReplace(A_AppData, "Roaming", "Local\Packages\*" family "*"), D
RunWait, % "explorer shell:appsFolder\" A_LoopFileName "!" (appID = "" ? family : appID)
}
Code: Select all
runApp(appName) { ; Run a Windows Store app
; https://www.autohotkey.com/boards/viewtopic.php?p=422260#p422260
pkgExisted := FileExist(out := A_MyDocuments "\packages.txt")
Loop, 2 {
If !FileExist(out)
RunWait, powershell -NoProfile -Command & {get-appxpackage > %out%},, Hide ; Create file about packages
FileRead, packages, %out% ; Info about Windows packages
RegExMatch(packages, "InstallLocation : \K.*?" appName ".*", dir) ; App's directory
If !(dirExist := FileExist(dir)) && A_Index = 1 && pkgExisted ; If file existed & no dir
FileRecycle, %out% ; recycle file, & try again
} Until !pkgExisted || dirExist ; Stop if dir found or no pkg
If !dirExist
Return
RegExMatch(packages, "PackageFamilyName : \K.*?" appName ".*", family) ; App's family name
FileRead, appInfo, %dir%\AppxManifest.xml ; Info about the app
RegExMatch(appInfo, "Application Id=""\K\w+", appID) ; Application ID
RunWait, explorer shell:appsFolder\%family%!%appID% ; Run the app
}