Announcements

Help Wizard

Step 1

NEXT STEP

FAQs

Please see below the most popular frequently asked questions.

Loading article...

Loading faqs...

VIEW ALL

Ongoing Issues

Please see below the current ongoing issues which are under investigation.

Loading issue...

Loading ongoing issues...

VIEW ALL

Applescript Minimise

Applescript Minimise

Device

Macbook Pro 2019

Operating System

macOS Catalina

 

My Question or Issue

I am writing a script to auto-play a song, but then I want Spotify to minimise - it is maximised because the script "activates" Spotify first.

 

None of the standard minimized commands work:

https://stackoverflow.com/questions/3564160/code-for-minimizing-application-window-in-mac

 

➜ osascript -e 'tell application "Spotify" to set miniaturized of every window to true'
30:70: execution error: Spotify got an error: Can’t make miniaturized of every window into type specifier. (-1700)
➜ osascript -e 'tell application "Spotify" to set minimized of every window to true'
30:67: execution error: Spotify got an error: Can’t make minimized of every window into type specifier. (-1700)

I have managed to get it working with System Events but the command is a little ugly and requires additional accessibility permissions

Reply
1 Reply

you can do:

osascript -e "tell application \"Finder\" to set visible of process \"Spotify\" to false"

 

Suggested posts

Type a product name

Did you find this article helpful?