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


|

その他のカテゴリー

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