AppleScript Desktop

[desktoppr]デスクトップ・ピクチャーを変更する(コマンドラインツール)

https://github.com/scriptingosx/desktoppr
モニタID別の設定も対応しています
バイナリーパッケージは↓のところにあります
20221013_1_580x399

|

[sqlite3]デスクトップ・ピクチャーを変更する(断念)

display_uuidとspace_uuidと紐づいているようなのだが…
今一歩理解出来なかった…断念



/usr/bin/sqlite3 $HOME/Library/Application\ Support/Dock/desktoppicture.db


.tables

-->

data         displays     pictures     preferences  prefs        spaces 



.mode column


select * from data;

-->/System/Library/Desktop Pictures/Solid Colors/Red Orange.png

select * from displays;

-->display_uuid  

select * from pictures;

-->space_id  display_id

select * from preferences;

-->key  data_id  picture_id

select * from prefs;

-->null

select * from spaces;

-->space_uuid




delete from data;


insert into data values('/System/Library/Desktop Pictures/Solid Colors');

insert into data values('/System/Library/Desktop Pictures/Solid Colors/Silver.png');

update data set value = '/System/Library/Desktop Pictures/Solid Colors/Silver.png'


select * from data;



.schema

-->

CREATE TABLE pictures (space_id INTEGER, display_id INTEGER);

CREATE TABLE preferences (key INTEGER, data_id INTEGER, picture_id INTEGER);

CREATE TABLE spaces (space_uuid VARCHAR);

CREATE TABLE displays (display_uuid);

CREATE TABLE data (value);

CREATE TABLE prefs (key INTEGER, data);

CREATE INDEX pictures_index ON pictures (space_id, display_id);

CREATE INDEX preferences_index ON preferences (picture_id, data_id);

CREATE INDEX spaces_index ON spaces (space_uuid);

CREATE INDEX displays_index ON displays (display_uuid);

CREATE INDEX data_index ON data (value);

CREATE INDEX prefs_index ON prefs (key);

CREATE TRIGGER space_deleted AFTER DELETE ON spaces BEGIN DELETE FROM pictures WHERE space_id=OLD.ROWID;END;

CREATE TRIGGER display_deleted AFTER DELETE ON displays BEGIN DELETE FROM pictures WHERE display_id=OLD.ROWID;END;

CREATE TRIGGER picture_deleted AFTER DELETE ON pictures BEGIN DELETE FROM preferences WHERE picture_id=OLD.ROWID; DELETE FROM displays WHERE ROWID=OLD.display_id AND NOT EXISTS (SELECT NULL FROM pictures WHERE display_id=OLD.display_id); DELETE FROM spaces WHERE ROWID=OLD.space_id AND NOT EXISTS (SELECT NULL FROM pictures WHERE space_id=OLD.space_id);END;

CREATE TRIGGER preferences_deleted AFTER DELETE ON preferences BEGIN DELETE FROM data WHERE ROWID=OLD.data_id AND NOT EXISTS (SELECT NULL FROM preferences WHERE data_id=OLD.data_id);END;


.quit


|

[mobileconfig]デスクトップ・ピクチャーを変更する

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

<plist version="1.0">

<dict>

  <key>PayloadContent</key>

  <array>

    <dict>

      <!-- 変更不可の場合はTRUE-->

      <key>locked</key>

      <true/>

      <!-- 変更するピクチャーへのUNIXパス-->

      <key>override-picture-path</key>

      <string>/System/Library/Desktop Pictures/Solid Colors/Red Orange.png</string>



      <key>PayloadDisplayName</key>

      <string>Desktop Picture Override</string>

      <key>PayloadIdentifier</key>

      <string>com.apple.desktop.3EF04708-096E-49A0-B803-C83E303BDB05</string>

      <key>PayloadType</key>

      <string>com.apple.desktop</string>

      <key>PayloadUUID</key>

      <string>3EF04708-096E-49A0-B803-C83E303BDB05</string>

      <key>PayloadVersion</key>

      <integer>1</integer>


    </dict>

  </array>

  <key>PayloadDisplayName</key>

  <string>com.apple.desktop</string>

  <key>PayloadDescription</key>

  <string>Desktop Picture Override</string>

  <key>PayloadOrganization</key>

  <string>quicktimer.cocolog-nifty.com</string>

  <key>ConsentText</key>

  <dict>

    <key>default</key>

    <string>デスクトップピクチャーを変更します</string>

  </dict>

  <key>PayloadIdentifier</key>

  <string>com.apple.desktop.C76A6BD2-6796-48AC-BF9D-D2C352DBDE3E</string>

  <key>PayloadType</key>

  <string>Configuration</string>

  <key>PayloadScope</key>

  <string>User</string>

  <key>PayloadUUID</key>

  <string>C76A6BD2-6796-48AC-BF9D-D2C352DBDE3E</string>

  <key>PayloadVersion</key>

  <integer>1</integer>

  <key>TargetDeviceType</key>

  <integer>5</integer>

</dict>

</plist>


|

[Finder]デスクトップ・ピクチャーを変更する


tell application "Finder"
set desktop picture to POSIX file "/System/Library/Desktop Pictures/Solid Colors/Red Orange.png"
(*
Turquoise Green.png
Ocher.png
Plum.png
Red Orange.png
Rose Gold.png
Silver.png
Soft Pink.png
Dusty Rose.png
Electric Blue.png
Gold 2.png
Gold.png
Blue Violet.png
Black.png
Yellow.png
*)

end tell

|

[System Events]デスクトップ・ピクチャーを変更する

デュアルモニタも全て変更

tell application "System Events"
tell every desktop
set picture to (POSIX file "/System/Library/Desktop Pictures/Solid Colors/Red Orange.png")
(*
Turquoise Green.png
Ocher.png
Plum.png
Red Orange.png
Rose Gold.png
Silver.png
Soft Pink.png
Dusty Rose.png
Electric Blue.png
Gold 2.png
Gold.png
Blue Violet.png
Black.png
Yellow.png
*)
end tell
end tell



個別に設定する場合
tell application "System Events"
set listDesktop to every desktop
log listDesktop
repeat with objDesktop in listDesktop
set numID to (id of objDesktop) as number
if numID = 1 then
tell objDesktop
set picture to (POSIX file "/System/Library/Desktop Pictures/Solid Colors/Red Orange.png")
log name as text
log display name as text
log id as number
set change interval to 0
set picture rotation to 0
set random order to false
set translucent menu bar to false
set dynamic style to dark
end tell
else
tell objDesktop
set picture to (POSIX file "/System/Library/Desktop Pictures/Solid Colors/Gold 2.png")
log name as text
log display name as text
log id as number
set change interval to 0
set picture rotation to 0
set random order to false
set translucent menu bar to false
set dynamic style to dark
end tell
end if
end repeat
end tell

|

その他のカテゴリー

Acrobat Acrobat Annotation Acrobat Dialog Acrobat Form Acrobat JS Acrobat Open Acrobat Plugin Acrobat python Acrobat Reader Acrobat Sequ Acrobat Stamps Admin Admin Account Admin Apachectl Admin configCode Admin Device Management Admin LaunchServices Admin Locationd Admin loginitem Admin Maintenance Admin Permission Admin Pkg Admin Power Management Admin Printer Admin SetUp Admin SMB Admin System Information Admin Tools Admin Users Admin Volumes Adobe Apple AppleScript AppleScript Guide AppleScript Accessibility AppleScript AppKit AppleScript Applications AppleScript AppStore AppleScript Archive AppleScript Attributes AppleScript Automator AppleScript AVAsset AppleScript AVconvert AppleScript AVFoundation AppleScript AVURLAsset AppleScript BackUp AppleScript Barcode AppleScript Bash AppleScript Basic AppleScript Basic Path AppleScript Bluetooth AppleScript BOX AppleScript Browser AppleScript Calendar AppleScript CD/DVD AppleScript Choose AppleScript Chrome AppleScript CIImage AppleScript CloudStorage AppleScript Color AppleScript com.apple.LaunchServices.OpenWith AppleScript Console AppleScript Contacts AppleScript CotEditor AppleScript CURL AppleScript current application AppleScript Date&Time AppleScript delimiters AppleScript Desktop AppleScript Device AppleScript Disk AppleScript do shell script AppleScript Dock AppleScript DropBox AppleScript eMail AppleScript Encode Decode AppleScript Error AppleScript EXIFData AppleScript ffmpeg AppleScript File AppleScript Finder AppleScript Firefox AppleScript Folder AppleScript Fonts AppleScript GIF AppleScript HTML AppleScript Icon AppleScript Illustrator AppleScript Image Events AppleScript Image2PDF AppleScript ImageOptim Applescript iWork AppleScript Javascript AppleScript Jedit AppleScript Json AppleScript Label AppleScript List AppleScript locationd AppleScript LRC AppleScript LSSharedFileList AppleScript m3u8 AppleScript MakePDF AppleScript Map AppleScript Math AppleScript Microsoft AppleScript Microsoft Edge AppleScript Microsoft Excel AppleScript Mobileconfig AppleScript Mouse AppleScript Movie AppleScript Music AppleScript NetWork AppleScript Notes AppleScript NSArray AppleScript NSBitmapImageRep AppleScript NSBundle AppleScript NSCFBoolean AppleScript NSCharacterSet AppleScript NSColor AppleScript NSColorList AppleScript NSData AppleScript NSDictionary AppleScript NSError AppleScript NSEvent AppleScript NSFileAttributes AppleScript NSFileManager AppleScript NSFont AppleScript NSFontManager AppleScript NSImage AppleScript NSIndex AppleScript NSKeyedArchiver AppleScript NSKeyedUnarchiver AppleScript NSLocale AppleScript NSMutableArray AppleScript NSMutableDictionary AppleScript NSMutableString AppleScript NSNotFound AppleScript NSNumber AppleScript NSOpenPanel AppleScript NSPasteboard AppleScript NSPDFImageRep AppleScript NSpoint AppleScript NSPredicate AppleScript NSRange AppleScript NSRegularExpression AppleScript NSRunningApplication AppleScript NSScreen AppleScript NSSize AppleScript NSString AppleScript NSStringCompareOptions AppleScript NSTask AppleScript NSTimeZone AppleScript NSURL AppleScript NSURL File AppleScript NSURLBookmark AppleScript NSURLComponents AppleScript NSURLResourceKey AppleScript NSUserDefaults AppleScript NSUUID AppleScript NSView AppleScript NSWorkspace AppleScript Numbers AppleScript OAuth AppleScript ObjC AppleScript OneDrive AppleScript Osax AppleScript PDF AppleScript PDFAnnotationWidget AppleScript PDFContext AppleScript PDFDisplayBox AppleScript PDFDocumentPermissions AppleScript PDFKit AppleScript PDFnUP AppleScript PDFOutline AppleScript Photos AppleScript Photoshop AppleScript Plist System Events AppleScript PostScript AppleScript prefPane AppleScript Preview AppleScript Python AppleScript QR AppleScript QR Decode AppleScript QuickLook AppleScript QuickTime AppleScript record AppleScript Regular Expression AppleScript Reminders AppleScript ReName AppleScript Repeat AppleScript RTF AppleScript Safari AppleScript SaveFile AppleScript ScreenCapture AppleScript ScreenSaver AppleScript Script Editor AppleScript Script Menu AppleScript Shortcuts AppleScript Shortcuts Events AppleScript Sort AppleScript Sound AppleScript Spotlight AppleScript SRT AppleScript StandardAdditions AppleScript stringByApplyingTransform AppleScript System Events AppleScript System Settings AppleScript TemporaryItems AppleScript Terminal AppleScript Text AppleScript Text CSV AppleScript Text TSV AppleScript TextEdit AppleScript Translate AppleScript Trash AppleScript Twitter AppleScript UI AppleScript Unit Conversion AppleScript UTType AppleScript valueForKeyPath AppleScript Video AppleScript VisionKit AppleScript Visual Studio Code AppleScript webarchive AppleScript webp AppleScript Wifi AppleScript XML AppleScript XML EPUB AppleScript XML OPML AppleScript XML Plist AppleScript XML RSS AppleScript XML SVG AppleScript XML TTML AppleScript XML webloc AppleScript YouTube AppleScript Zero Suppress Applications Barcode OnLine Tools CityCode Design iPhone List Logs lsappinfo Memo Music perl PlistBuddy pluginkit postalcode ReadMe SF Symbols character id SF Symbols Entity sips Skype Slack sqlite TCC Tools Typography Video Wacom zoom