AppleScript ScreenCapture

Screencapture まとめ

カテゴリ
AppleScript ScreenCapture



事前設定(絶対条件)
許可しないとスクリーンキャプチャーは取れない
(デスクトップ画像のみアクセスできる=ログイン画面のキャプチャ取れるのと同じ理由)
Screen2_20240204133301


A:画面のみ(画像)
B:画面のみ(動画)
C:画面と音声(動画)


1:手動で取得する(キーボードショートカット利用)
2:スクリーンショット.app(com.apple.screenshot.launcher)を利用する
3:サードバーティから出ているアプリケーションを利用する
4:ショートカット(Shortcuts.app)を利用する
5:オートメーター(Automator.app)を利用する
6:screencaptureコマンドを利用する
7:ScreenCaptureKitを利用する
8:アプリケーション専用の機能拡張等を利用する

1:手動で取得する(キーボードショートカット利用)
https://quicktimer.cocolog-nifty.com/icefloe/2023/12/post-09e818.html
2:スクリーンショット.app(com.apple.screenshot.launcher)を利用する
https://quicktimer.cocolog-nifty.com/icefloe/2023/12/post-e84f24.html
3:サードバーティから出ているアプリケーションを利用する
https://quicktimer.cocolog-nifty.com/icefloe/2023/12/post-16b2cd.html
4:ショートカット(Shortcuts.app)を利用する
https://quicktimer.cocolog-nifty.com/icefloe/2023/12/post-cb272a.html
5:オートメーター(Automator.app)を利用する
https://quicktimer.cocolog-nifty.com/icefloe/2023/12/post-972c8a.html
6:screencaptureコマンドを利用する
https://quicktimer.cocolog-nifty.com/icefloe/2023/12/post-1857ff.html
7:ScreenCaptureKitを利用する
Capturing screen content in macOS
8:アプリケーション専用の機能拡張等を利用する
Google Chrome & Microsoft Edge
https://chromewebstore.google.com/search/キャプチャ?hl=ja
Safari
https://apps.apple.com/ja/story/id1377753262
FireFox
https://quicktimer.cocolog-nifty.com/icefloe/2023/12/post-2e80ba.html



設定
1:スクリーンショット.app(com.apple.screenshot.launcher)を利用する
2:com.apple.screencapture.plistの設定を変更する
2−1:defaults,PlistBuddyを利用する
2−2:Applescript等を利用して設定する
3:Mobileconfigを使用する

1:スクリーンショット.app(com.apple.screenshot.launcher)を利用する
スクリーンショット.app(com.apple.screenshot.launcher)を利用する
https://quicktimer.cocolog-nifty.com/icefloe/2023/12/post-e84f24.html
2:com.apple.screencapture.plistの設定を変更する
2−1:defaults,PlistBuddyを利用する

[bash]スクリーンキャプチャの設定例(defaults)
https://quicktimer.cocolog-nifty.com/icefloe/2023/12/post-7db2ba.html
[bash]スクリーンキャプチャの設定例(PlistBuddy)
https://quicktimer.cocolog-nifty.com/icefloe/2023/12/post-0a3844.html
2−2:Applescript等を利用して設定する
[com.apple.screencapture]スクリーンキャプチャの設定例(defaults)
https://quicktimer.cocolog-nifty.com/icefloe/2023/02/post-414c9a.html
[plist]スクリーンキャプチャの設定例(com.apple.screencapture)
https://quicktimer.cocolog-nifty.com/icefloe/2023/02/post-d3ea34.html
3:Mobileconfigを使用する
[mobileconfig]スクリーンキャプチャの設定例(com.apple.screencapture)
https://quicktimer.cocolog-nifty.com/icefloe/2023/02/post-0e372a.html



自動化
1:AppleScript>SystemEventでキーボードショートカットを実行させる
2:AppleScript>do shell scriptからscreencaptureコマンドを実行させる
3:Shortcuts Eventsでショートカット(shortcut)を実行させる
4:Automator.appで処理する
5:bashやzsh,Pythonからscreencaptureコマンドを利用する
5:
1:AppleScript>SystemEventでキーボードショートカットを実行させる
SystemEventでキーボードショートカットを実行させる
https://quicktimer.cocolog-nifty.com/icefloe/2023/12/post-d69bd2.html
2:AppleScript>do shell scriptからscreencaptureコマンドを実行させる
https://quicktimer.cocolog-nifty.com/icefloe/2023/11/post-f35432.html
3:Shortcuts Eventsでショートカット(shortcut)を実行させる
https://quicktimer.cocolog-nifty.com/icefloe/2023/12/post-7e6f96.html
4:Automator.appで処理する
5:bashやzsh,Pythonからscreencaptureコマンドを利用する



留意点
[screencapture]error "could not create image from window"が出る場合


便利ツール
Backdrop デスクトップにあるファイルやフォルダを全部一時的に非表示にする
https://apps.apple.com/jp/app/backdrop/id411461952?mt=12
ScreenBrush デスクトップに色々書き込める 有料700円でフル機能使える
https://apps.apple.com/jp/app/screenbrush/id1233965871
カーソルツールがあると便利

|

[screencapture]全てのWIndowIDをスクリーンキャプチャーする


【スクリプトエディタで開く】|

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#
#com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
use AppleScript version "2.8"
use framework "Foundation"
use framework "UniformTypeIdentifiers"
use framework "AppKit"
use framework "Cocoa"
use scripting additions


property refMe : a reference to current application
set appFileManager to refMe's NSFileManager's defaultManager()
set appSharedWorkspace to refMe's NSWorkspace's sharedWorkspace()
set appSharedApp to refMe's NSApplication's sharedApplication()


set strBinPath to "/usr/sbin/screencapture"


####################
###保存先
set strSaveDirPath to ("~/Pictures/ScreenCapture/ScreenCapture") as string
set ocidSaveDirPathStr to refMe's NSString's stringWithString:(strSaveDirPath)
set ocidSaveDirPath to ocidSaveDirPathStr's stringByStandardizingPath()
set ocidSaveDirPathURL to refMe's NSURL's alloc()'s initFileURLWithPath:(ocidSaveDirPath) isDirectory:(true)
##フォルダを作る
set ocidAttrDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
ocidAttrDict's setValue:(448) forKey:(refMe's NSFilePosixPermissions)
set listBoolMakeDir to appFileManager's createDirectoryAtURL:(ocidSaveDirPathURL) withIntermediateDirectories:true attributes:(ocidAttrDict) |error|:(reference)

####################
###ウィンドウIDを取得
set ocidAllWindowArray to refMe's NSWindowNumberListAllApplications
set ocidWindowNoArray to refMe's NSWindow's windowNumbersWithOptions:(ocidAllWindowArray)

####ウィンドウIDの数だけ繰り返し
repeat with itemWindowID in ocidWindowNoArray
  set strWindowID to itemWindowID as text
  ####
  set strDateNO to doGetDateNo("yyyyMMdd_HHmmss")
  set strFileName to ("" & strWindowID & "-" & strDateNO & ".png") as text
  set ocidSaveFilePathURL to (ocidSaveDirPathURL's URLByAppendingPathComponent:(strFileName))
  set strSaveFilePath to ocidSaveFilePathURL's |path| as text
  
  set strCommandText to ("\"" & strBinPath & "\" -o -l " & strWindowID & " -rxt png \"" & strSaveFilePath & "\"") as string
do shell script strCommandText
  
  
end repeat




set appSharedWorkspace to refMe's NSWorkspace's sharedWorkspace()
set ocidDirPath to ocidSaveDirPathURL's |path|
set boolDone to appSharedWorkspace's selectFile:(ocidDirPath) inFileViewerRootedAtPath:(ocidDirPath)

return
##############################
### 今の日付日間 テキスト
##############################
to doGetDateNo(argDateFormat)
  ####日付情報の取得
  set ocidDate to current application's NSDate's |date|()
  ###日付のフォーマットを定義
  set ocidNSDateFormatter to current application's NSDateFormatter's alloc()'s init()
ocidNSDateFormatter's setLocale:(current application's NSLocale's localeWithLocaleIdentifier:"ja_JP_POSIX")
  set ocidTimeZone to refMe's NSTimeZone's alloc()'s initWithName:"Asia/Tokyo"
ocidNSDateFormatter's setTimeZone:(ocidTimeZone)
ocidNSDateFormatter's setDateFormat:(argDateFormat)
  set ocidDateAndTime to ocidNSDateFormatter's stringFromDate:ocidDate
  set strDateAndTime to ocidDateAndTime as text
return strDateAndTime
end doGetDateNo

|

SystemEventでキーボードショートカットを実行させる


【スクリプトエディタで開く】|

tell application "Finder"
  tell application "System Events"
    tell application process "Finder"
keystroke "#" using {shift down, command down}
    end tell
  end tell
end tell


|

[/usr/sbin/screencapture]ウィンド指定(全ウィンドウ)


【スクリプトエディタで開く】|

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#
#com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
use AppleScript version "2.8"
use framework "Foundation"
use framework "ScreenCaptureKit"
use framework "AppKit"
use scripting additions
property refMe : a reference to current application
set appFileManager to refMe's NSFileManager's defaultManager()

set strBinPath to "/usr/sbin/screencapture"


####################
###保存先
set strSaveDirPath to ("~/Pictures/ScreenCapture/ScreenCapture") as string
set ocidSaveDirPathStr to refMe's NSString's stringWithString:(strSaveDirPath)
set ocidSaveDirPath to ocidSaveDirPathStr's stringByStandardizingPath()
set ocidSaveDirPathURL to refMe's NSURL's alloc()'s initFileURLWithPath:(ocidSaveDirPath) isDirectory:(true)
##フォルダを作る
set ocidAttrDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
ocidAttrDict's setValue:(448) forKey:(refMe's NSFilePosixPermissions)
set listBoolMakeDir to appFileManager's createDirectoryAtURL:(ocidSaveDirPathURL) withIntermediateDirectories:true attributes:(ocidAttrDict) |error|:(reference)

####################
###
set listWindowApp to {} as list
tell application "System Events"
  set listApplication to every application process as list
end tell
repeat with itemApplication in listApplication
  tell application "System Events"
    tell itemApplication
      ## set strAppID to (id) as text
      ## set objApp to (name)as text
      set strBundleID to (bundle identifier) as text
      set boolBackGround to (background only) as boolean
    end tell
  end tell
  if strBundleID is (missing value) then
log "バンドルIDなし"
  else
    if boolBackGround is true then
log "バックグラウンドプロセス"
    else
      tell application id strBundleID
        try
          ###Windowの数を数えて
          set numCntWindow to (count of every window) as integer
          if numCntWindow ≥ 1 then
##WindowがあるバンドルIDをリストにしていく
copy strBundleID to end of listWindowApp
          end if
        end try
      end tell
    end if
  end if
end repeat

###################################
log listWindowApp
###ダイアログ
set strName to (name of current application) as text
if strName is "osascript" then
  tell application "Finder" to activate
else
  tell current application to activate
end if
try
  set listResponse to (choose from list listWindowApp with title "選んでください" with prompt "キャプチャーを取るアプリを選んでください\r前面のウィンドウをキャプチャーします" default items (item 1 of listWindowApp) OK button name "OK" cancel button name "キャンセル" without multiple selections allowed and empty selection allowed) as list
on error
log "エラーしました"
return "エラーしました"
end try
if (item 1 of listResponse) is false then
return "キャンセルしました"
end if
###選んだバンドルID
set strBundleID to (item 1 of listResponse) as text
####ウィンドウIDを取得
tell application id strBundleID
  set listWindowID to (id of every window) as list
end tell

####Windowの数だけ繰り返し
repeat with itemWindowID in listWindowID
  ####
  set strDateNO to doGetDateNo("yyyyMMdd_HHmmss")
  set strFileName to ("" & strBundleID & "." & itemWindowID & "-" & strDateNO & ".png") as text
  set ocidSaveFilePathURL to (ocidSaveDirPathURL's URLByAppendingPathComponent:(strFileName))
  set strSaveFilePath to ocidSaveFilePathURL's |path| as text
  ####Chromeアプリだとエラーになる
  try
    set strCommandText to ("\"" & strBinPath & "\" -o -l " & itemWindowID & " -rxt png \"" & strSaveFilePath & "\"") as string
do shell script strCommandText
  end try
end repeat




set appSharedWorkspace to refMe's NSWorkspace's sharedWorkspace()
set ocidDirPath to ocidSaveDirPathURL's |path|
set boolDone to appSharedWorkspace's selectFile:(ocidDirPath) inFileViewerRootedAtPath:(ocidDirPath)

return
##############################
### 今の日付日間 テキスト
##############################
to doGetDateNo(argDateFormat)
  ####日付情報の取得
  set ocidDate to current application's NSDate's |date|()
  ###日付のフォーマットを定義
  set ocidNSDateFormatter to current application's NSDateFormatter's alloc()'s init()
ocidNSDateFormatter's setLocale:(current application's NSLocale's localeWithLocaleIdentifier:"ja_JP_POSIX")
  set ocidTimeZone to refMe's NSTimeZone's alloc()'s initWithName:"Asia/Tokyo"
ocidNSDateFormatter's setTimeZone:(ocidTimeZone)
ocidNSDateFormatter's setDateFormat:(argDateFormat)
  set ocidDateAndTime to ocidNSDateFormatter's stringFromDate:ocidDate
  set strDateAndTime to ocidDateAndTime as text
return strDateAndTime
end doGetDateNo

|

[/usr/sbin/screencapture]ウィンド指定(前面ウィンドウ)


【スクリプトエディタで開く】|

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#
#com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
use AppleScript version "2.8"
use framework "Foundation"
use framework "ScreenCaptureKit"
use framework "AppKit"
use scripting additions
property refMe : a reference to current application
set appFileManager to refMe's NSFileManager's defaultManager()

set strBinPath to "/usr/sbin/screencapture"


####################
###保存先
set strSaveDirPath to ("~/Pictures/ScreenCapture/ScreenCapture") as string
set ocidSaveDirPathStr to refMe's NSString's stringWithString:(strSaveDirPath)
set ocidSaveDirPath to ocidSaveDirPathStr's stringByStandardizingPath()
set ocidSaveDirPathURL to refMe's NSURL's alloc()'s initFileURLWithPath:(ocidSaveDirPath) isDirectory:(true)
##フォルダを作る
set ocidAttrDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
ocidAttrDict's setValue:(448) forKey:(refMe's NSFilePosixPermissions)
set listBoolMakeDir to appFileManager's createDirectoryAtURL:(ocidSaveDirPathURL) withIntermediateDirectories:true attributes:(ocidAttrDict) |error|:(reference)

####################
###
set listWindowApp to {} as list
tell application "System Events"
  set listApplication to every application process as list
end tell
repeat with itemApplication in listApplication
  tell application "System Events"
    tell itemApplication
      set strAppID to (id) as text
      set objApp to (name)
      set strBundleID to (bundle identifier)
      set boolBackGround to background only
    end tell
  end tell
  if strBundleID is (missing value) then
log "バンドルIDなし"
  else
    if boolBackGround is false then
      tell application id strBundleID
        try
          set numCntWindow to (count of every window) as integer
          if numCntWindow ≥ 1 then
copy strBundleID to end of listWindowApp
          end if
        end try
      end tell
    end if
  end if
end repeat

###################################
log listWindowApp
###ダイアログ
set strName to (name of current application) as text
if strName is "osascript" then
  tell application "Finder" to activate
else
  tell current application to activate
end if
try
  set listResponse to (choose from list listWindowApp with title "選んでください" with prompt "キャプチャーを取るアプリを選んでください\r前面のウィンドウをキャプチャーします" default items (item 1 of listWindowApp) OK button name "OK" cancel button name "キャンセル" without multiple selections allowed and empty selection allowed) as list
on error
log "エラーしました"
return "エラーしました"
end try
if (item 1 of listResponse) is false then
return "キャンセルしました"
end if
set strBundleID to (item 1 of listResponse) as text
####
tell application id strBundleID
  set strWindowID to id of front window
end tell
####
set strDateNO to doGetDateNo("yyyyMMdd_HHmmss")
set strFileName to ("" & strBundleID & "-" & strDateNO & ".png") as text
set ocidSaveFilePathURL to (ocidSaveDirPathURL's URLByAppendingPathComponent:(strFileName))
set strSaveFilePath to ocidSaveFilePathURL's |path| as text
####
set strCommandText to ("\"" & strBinPath & "\" -o -l " & strWindowID & " -rxt png \"" & strSaveFilePath & "\"") as string
do shell script strCommandText


return



##############################
### 今の日付日間 テキスト
##############################
to doGetDateNo(argDateFormat)
  ####日付情報の取得
  set ocidDate to current application's NSDate's |date|()
  ###日付のフォーマットを定義
  set ocidNSDateFormatter to current application's NSDateFormatter's alloc()'s init()
ocidNSDateFormatter's setLocale:(current application's NSLocale's localeWithLocaleIdentifier:"ja_JP_POSIX")
  set ocidTimeZone to refMe's NSTimeZone's alloc()'s initWithName:"Asia/Tokyo"
ocidNSDateFormatter's setTimeZone:(ocidTimeZone)
ocidNSDateFormatter's setDateFormat:(argDateFormat)
  set ocidDateAndTime to ocidNSDateFormatter's stringFromDate:ocidDate
  set strDateAndTime to ocidDateAndTime as text
return strDateAndTime
end doGetDateNo

|

[/usr/sbin/screencapture]モニタ指定(複数モニターある場合)


【スクリプトエディタで開く】|

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#
#com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
use AppleScript version "2.8"
use framework "Foundation"
use framework "ScreenCaptureKit"
use framework "AppKit"
use scripting additions
property refMe : a reference to current application
set appFileManager to refMe's NSFileManager's defaultManager()

set strBinPath to "/usr/sbin/screencapture"

####################
###保存先
set strSaveDirPath to ("~/Pictures/ScreenCapture/ScreenCapture") as string
set ocidSaveDirPathStr to refMe's NSString's stringWithString:(strSaveDirPath)
set ocidSaveDirPath to ocidSaveDirPathStr's stringByStandardizingPath()
set ocidSaveDirPathURL to refMe's NSURL's alloc()'s initFileURLWithPath:(ocidSaveDirPath) isDirectory:(true)
##フォルダを作る
set ocidAttrDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
ocidAttrDict's setValue:(448) forKey:(refMe's NSFilePosixPermissions)
set listBoolMakeDir to appFileManager's createDirectoryAtURL:(ocidSaveDirPathURL) withIntermediateDirectories:true attributes:(ocidAttrDict) |error|:(reference)

####################
###モニター数による分岐
set ocidScreenArray to refMe's NSScreen's screens()
set numCntMoniter to ocidScreenArray's |count|()
set strDateNO to doGetDateNo("yyyyMMdd_HHmmss")
if numCntMoniter > 1 then
log "複数モニターがあります"
  repeat with itemIntNo from 1 to numCntMoniter by 1
    set strFileName to ("screen_" & itemIntNo & "-" & strDateNO & ".png") as text
    set ocidSaveFilePathURL to (ocidSaveDirPathURL's URLByAppendingPathComponent:(strFileName))
    set strSaveFilePath to ocidSaveFilePathURL's |path| as text
    ### -D モニタ番号 でサブモニタ指定
    set strCommandText to ("\"" & strBinPath & "\" -D " & itemIntNo & " -xt png \"" & strSaveFilePath & "\"") as string
do shell script strCommandText
  end repeat
  
else if numCntMoniter = 1 then
log "モニターがあります"
  set strFileName to ("screen-" & strDateNO & ".png") as text
  set ocidSaveFilePathURL to ocidSaveDirPathURL's URLByAppendingPathComponent:(strFileName)
  set strSaveFilePath to ocidSaveFilePathURL's |path| as text
  ### -m でメインモニタ指定
  set strCommandText to ("\"" & strBinPath & "\" -m -xt png \"" & strSaveFilePath & "\"") as string
do shell script strCommandText
else
log "モニターが見つかりません"
return "モニターが見つかりません"
end if


##############################
### 今の日付日間 テキスト
##############################
to doGetDateNo(argDateFormat)
  ####日付情報の取得
  set ocidDate to current application's NSDate's |date|()
  ###日付のフォーマットを定義
  set ocidNSDateFormatter to current application's NSDateFormatter's alloc()'s init()
ocidNSDateFormatter's setLocale:(current application's NSLocale's localeWithLocaleIdentifier:"ja_JP_POSIX")
  set ocidTimeZone to refMe's NSTimeZone's alloc()'s initWithName:"Asia/Tokyo"
ocidNSDateFormatter's setTimeZone:(ocidTimeZone)
ocidNSDateFormatter's setDateFormat:(argDateFormat)
  set ocidDateAndTime to ocidNSDateFormatter's stringFromDate:ocidDate
  set strDateAndTime to ocidDateAndTime as text
return strDateAndTime
end doGetDateNo

|

手動で取得する(キーボードショートカット利用)

String_screen

|

サードバーティから出ているキャプチャーアプリケーションを利用する

Snagit
有料版だが
結局これ以上のものは見当たらない
https://www.techsmith.co.jp/screen-capture.html

Free Basic Screen Capture(開発停止) 
Snagitになったが便利なので今でも使っている
https://www.techsmith.com/jing-tool.html

Skitch (開発停止) 更新されなくなって久しいが便利ではある
https://evernote.com/products/skitch

|

スクリーンショット.app(com.apple.screenshot.launcher)を利用する

スクリーンショット.appの『オプション』である程度は手動で設定可能 String-screen String-screen-6

|

[com.apple.screencapture]スクリーンキャプチャの設定例(PlistBuddy)


#!/bin/bash -p
#com.cocolog-nifty.quicktimer.icefloe
#
#################################################
###管理者インストールしているか?チェック
USER_WHOAMI=$(/usr/bin/whoami)
/bin/echo "実行ユーザー(whoami): $USER_WHOAMI"
###実行しているユーザー名
CONSOLE_USER=$(/bin/echo "show State:/Users/ConsoleUser" | /usr/sbin/scutil | /usr/bin/awk '/Name :/ { print $3 }')
/bin/echo "コンソールユーザー(scutil): $CONSOLE_USER"
###実行しているユーザー名
HOME_USER=$(/bin/echo "$HOME" | /usr/bin/awk -F'/' '{print $NF}')
/bin/echo "実行ユーザー(HOME): $HOME_USER"
###logname
LOGIN_NAME=$(/usr/bin/logname)
/bin/echo "ログイン名(logname): $LOGIN_NAME"
###UID
USER_NAME=$(/usr/bin/id -un)
/bin/echo "ユーザー名(id): $USER_NAME"
###STAT
STAT_USR=$(/usr/bin/stat -f%Su /dev/console)
/bin/echo "STAT_USR(console): $STAT_USR"
#################################################
###保存先
STR_SAVE_DIR="/Users/""$STAT_USR""/Pictures/ScreenCapture"
/bin/mkdir -p "$STR_SAVE_DIR"
/bin/chmod 750 "$STR_SAVE_DIR"
#################################################
###PLISTパス
STR_PLIST_PATH="/Users/""$STAT_USR""/Library/Preferences/com.apple.screencapture.plist"
#################################################
###
/usr/libexec/PlistBuddy -c "Set:video bool false" "$STR_PLIST_PATH"
/usr/libexec/PlistBuddy -c "Set:show-thumbnail bool false" "$STR_PLIST_PATH"

/usr/libexec/PlistBuddy -c "Set:showsClicks bool true" "$STR_PLIST_PATH"
/usr/libexec/PlistBuddy -c "Set:showsCursor bool true" "$STR_PLIST_PATH"
/usr/libexec/PlistBuddy -c "Set:disable-shadow bool true" "$STR_PLIST_PATH"

/usr/libexec/PlistBuddy -c "Set:target string 'file'" "$STR_PLIST_PATH"
/usr/libexec/PlistBuddy -c "Set:style string 'selection'" "$STR_PLIST_PATH"
/usr/libexec/PlistBuddy -c "Set:name string 'screen'" "$STR_PLIST_PATH"
/usr/libexec/PlistBuddy -c "Set:location string '$STR_SAVE_DIR'" "$STR_PLIST_PATH"
/usr/libexec/PlistBuddy -c "Set:location-last string '$STR_SAVE_DIR'" "$STR_PLIST_PATH"

/usr/libexec/PlistBuddy -c "Set:last-selection-display 0" "$STR_PLIST_PATH"

##Set時はKeyのclassは指定されているので指定するとUnrecognized Integer Formatが出る
/usr/libexec/PlistBuddy -c "Set:last-selection:X 0" "$STR_PLIST_PATH"
/usr/libexec/PlistBuddy -c "Set:last-selection:Y 0" "$STR_PLIST_PATH"
/usr/libexec/PlistBuddy -c "Set:last-selection:Height 720" "$STR_PLIST_PATH"
/usr/libexec/PlistBuddy -c "Set:last-selection:Width 1280" "$STR_PLIST_PATH"

/usr/libexec/PlistBuddy -c "Save" "$STR_PLIST_PATH"
exit 0


|

その他のカテゴリー

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