« [OS12]PrivacyTCCServices | トップページ | [TCC.db]zoomインストールとTCC.db操作のサンプル »

[TCC.db]TCC.dbを操作してプライバシー設定を変更する(カメラ・マイク・音声認識)

一部修正
SPEECH_RECOGNITION→SpeechRecognition
OS11 OS12専用 OS10.15以下とTTC.DBは互換がありません

選択したアプリケーションを
システム環境設定>>セキュリティとプライバシー>>プライバシー

カメラ・マイク・音声認識を有効にする

ダウンロード - tcc.db.user.scpt.zip


Screencapture_1302x1158_202111010057322

(************************************************************************
この上の▶︎をぽっちっとしてください

TCC.dbに選択したアプリを登録します
登録するのは
カメラ マイク 音声認識です。
20211101 初回作成

************************************************************************)






set theComandText to ("id -un") as text
set theUserName to (do shell script theComandText) as text


tell application "Finder"
set aliasChooseApp to (choose file "test" with prompt "" of type {"APPL"} default location "/Applications" with multiple selections allowed without showing package contents) as list
end tell

set numCntAppList to (count of aliasChooseApp) as number
set numCntApp to 1 as number

repeat numCntAppList times
set theLineAPP to (item numCntApp of aliasChooseApp) as alias
set theFileInfo to info for theLineAPP as list

tell theFileInfo
set theBundleIdentifier to (bundle identifier as list) as text
end tell
try
set theCmdText to ("/usr/bin/tccutil reset Camera " & theBundleIdentifier & "") as text
do shell script theCmdText
delay 0.5
end try
try
set theCmdText to ("/usr/bin/tccutil reset Microphone " & theBundleIdentifier & "") as text
do shell script theCmdText
delay 0.5
end try
try
set theCmdText to ("/usr/bin/tccutil reset SpeechRecognition " & theBundleIdentifier & "") as text
do shell script theCmdText
delay 0.5
end try


try
set theCmdText to ("/usr/bin/sqlite3 /Users/" & theUserName & "/Library/Application\\ Support/com.apple.TCC/TCC.db \"INSERT INTO access VALUES('kTCCServiceCamera','" & theBundleIdentifier & "',0,2,2,1, NULL,NULL,NULL,'UNUSED',NULL,0,1606059851);\"") as text
do shell script theCmdText
delay 0.5
end try
try
set theCmdText to ("/usr/bin/sqlite3 /Users/" & theUserName & "/Library/Application\\ Support/com.apple.TCC/TCC.db \"INSERT INTO access VALUES('kTCCServiceMicrophone','" & theBundleIdentifier & "',0,2,2,1, NULL,NULL,NULL,'UNUSED',NULL,0,1606059851);\"") as text
do shell script theCmdText
delay 0.5
end try
try
set theCmdText to ("/usr/bin/sqlite3 /Users/" & theUserName & "/Library/Application\\ Support/com.apple.TCC/TCC.db \"INSERT INTO access VALUES('kTCCServiceSpeechRecognition','" & theBundleIdentifier & "',0,2,2,1, NULL,NULL,NULL,'UNUSED',NULL,0,1606059851);\"") as text
do shell script theCmdText
delay 0.5
end try

set numCntApp to numCntApp + 1 as number
end repeat

set theCmdText to ("open \"x-apple.systempreferences:com.apple.preference.security?Privacy_SpeechRecognition\"") as text
do shell script theCmdText

|

« [OS12]PrivacyTCCServices | トップページ | [TCC.db]zoomインストールとTCC.db操作のサンプル »

TCC.db」カテゴリの記事