Tam bir cevabım yok, ama bugün, el yazısını kullanarak bu konuda iyi bir bıçaklamaya başladım. Aşağıdaki Applescript işin yaklaşık yarısını yapar. Her masaüstünde açık olan her uygulamanın tüm pencerelerini bildirir. Bir sonraki adım, tüm bunları bir dosyaya kaydetmek ve ardından yeniden başlattıktan sonra pencereleri yeniden dağıtmak için bir komut dosyası uygulamaktır:
--This applescript reports a list of application windows present on each desktop
--This is only a sample script intended to eventually be used to restore all application windows to their pre-reboot desktops
tell application "System Events"
set windows_string to ""
set numDesktops to (first paragraph of (do shell script "strings ~/Library/Preferences/com.apple.spaces.plist | grep -c ^\\\\$")) + 1
--the following tcsh command can determine the number of desktops:
-- @ x = ( `strings ~/Library/Preferences/com.apple.spaces.plist | grep -c '^\$'` + 1 ); echo $x
-- switch to the first desktop:
repeat with aDesktop from 1 to numDesktops
key code 123 using {control down}
end repeat
repeat with aDesktop from 1 to numDesktops
set windows_string to windows_string & return & return & "Desktop " & (aDesktop as string) & return
delay 1
get (the name of every application process whose class of windows contains window)
repeat with P in the result
set windows_string to windows_string & return & return & P & return
get (every window of process (contents of P) whose value of attribute "AXMinimized" is false)
repeat with W in the result
set window_name to ((name of W) as string)
--Stickies window names can be multi-line, so this trims from the first hard return onward
set better_window_name to (my replacePattern:"[\\n].*" inString:window_name usingThis:"")
if window_name is not equal to "" then
try
set windows_string to windows_string & better_window_name & return
on error
set windows_string to windows_string & "couldn't get window name" & return
end try
end if
end repeat
end repeat
--switch to the next desktop
key code 124 using {control down}
end repeat
display dialog "List of windows on this desktop: " & return & return & windows_string
end tell
--Call like this: set res to my replacePattern:"\\s+" inString:"1 subtratcing-these: -2 3 4" usingThis:"-"
use framework "Foundation"
use scripting additions
on replacePattern:thePattern inString:theString usingThis:theTemplate
set theRegEx to current application's NSRegularExpression's regularExpressionWithPattern:thePattern options:0 |error|:(missing value)
set theResult to theRegEx's stringByReplacingMatchesInString:theString options:0 range:{location:0, |length|:length of theString} withTemplate:theTemplate
return theResult as text
end replacePattern:inString:usingThis:
İşte elde ettiğim sonuç penceresinin ne olduğuna bir örnek:
List of windows on this desktop:
Desktop 1
iTunes
MiniPlayer
FluidApp
Found 626 tickets
Stickies
useful commands
System Config Notes
Special characters
Profile where a python scri…
XEMacs Tricks
Terminal Tips
Messages
Messages (3 unread)
FluidApp
Found 626 tickets
Slack
Slack - Princeton NPLC
FluidApp
Found 626 tickets
Desktop 2
iTunes
MiniPlayer
FluidApp
Found 626 tickets
Stickies
DAI
Messages
Messages (3 unread)
FluidApp
Found 626 tickets
Slack
Slack - Princeton NPLC
FluidApp
Found 626 tickets
Desktop 3
iTunes
MiniPlayer
Finder
Searching “Scripts”
Searching “Scripts”
Searching “Scripts”
FluidApp
Found 626 tickets
Stickies
RPST
Issues to resolve with RPST…
Messages
Messages (3 unread)
FluidApp
Found 626 tickets
Terminal
Terminal — -csh
TextEdit
Untitled 35.txt
Untitled 34.txt
Untitled 27.txt
Untitled 15.txt
Slack
Slack - Princeton NPLC
Safari
AppleScript: Essential Sub-Routines
Using Applescript to Execute a Complicated Keystroke - Stack Overflow
How to restore windows to their original desktops after reboot? - Ask Different
Script Editor
Untitled.scpt
Untitled 4.scpt
Untitled 3.scpt
paste_file_contents.scpt
Untitled 2.scpt
FluidApp
Found 626 tickets
Automator
Subtract.workflow (Quick Action)
Desktop 4
iTunes
MiniPlayer
FluidApp
Found 626 tickets
Stickies
GALAXY
Messages
Messages (3 unread)
FluidApp
Found 626 tickets
Terminal
Terminal — -bash
???c7??? 8yc`?h=??'?]b?c??k?k????Ԫ??m??d+ — -bash
Slack
Slack - Princeton NPLC
FluidApp
Found 626 tickets
Desktop 5
iTunes
MiniPlayer
FluidApp
Found 626 tickets
Stickies
TREEVIEW
When you start to work on a…
TreeView stats, legend, & d…
DATE OF SUBMISSION:
Messages
Messages (3 unread)
FluidApp
Found 626 tickets
Slack
Slack - Princeton NPLC
FluidApp
Found 626 tickets
Desktop 6
iTunes
MiniPlayer
FluidApp
Found 626 tickets
Stickies
ALIZZI
Messages
Messages (3 unread)
FluidApp
Found 626 tickets
Slack
Slack - Princeton NPLC
FluidApp
Found 626 tickets
Desktop 7
iTunes
MiniPlayer
FluidApp
Found 626 tickets
Stickies
GARCIA
Messages
Messages (3 unread)
FluidApp
Found 626 tickets
Slack
Slack - Princeton NPLC
FluidApp
Found 626 tickets
Desktop 8
iTunes
MiniPlayer
FluidApp
Found 626 tickets
Stickies
EMILIA
Messages
Messages (3 unread)
FluidApp
Found 626 tickets
Slack
Slack - Princeton NPLC
FluidApp
Found 626 tickets