How can I script selective minimization of documents in text edit when several files may be open?

apple.stackexchange https://apple.stackexchange.com/questions/415110

سؤال

From the Terminal, or in a shell file, I know how to open multiple files in a particular app in text edit from the command line and have all of their windows minimized like this:

open -a TextEdit.app ~/Documents/doc1.txt ~/Documents/doc2.txt ~/Documents/doc3.txt
osascript -e 'tell application "TextEdit" to set miniaturized of every window to true'

Is there a command to minimize not all of thow windows but just a particular one of them or equivalently, iterate over minimized windows to restore one by name like ~/Documents/doc1.txt?

هل كانت مفيدة؟

المحلول

Open the windows you want to minimize first, and the other(s) afterwards.

open -a TextEdit.app ~/Documents/doc2.txt ~/Documents/doc3.txt
osascript -e 'tell application "TextEdit" to set miniaturized of every window to true'
open -a TextEdit.app ~/Documents/doc1.txt 
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى apple.stackexchange
scroll top