[Acrobat]Av2新UIの設定をFALSEにするPlistBuddy版(修正)
AppleScript サンプルコード
行番号 | ソース |
---|---|
001 | #!/usr/bin/env osascript |
002 | ----+----1----+----2----+-----3----+----4----+----5----+----6----+----7 |
003 | # |
004 | (* |
005 | 前提 |
006 | Adobe Acrobat Acrobat Reader |
007 | アプリケーションを終了させてから |
008 | 10秒程度経過してから |
009 | 実行してください |
010 | EnableAV2の設定は仕様でロックできないので |
011 | ユーザーが切り替える事は可能 |
012 | |
013 | 修正版 20241003 |
014 | *) |
015 | #com.cocolog-nifty.quicktimer.icefloe |
016 | ----+----1----+----2----+-----3----+----4----+----5----+----6----+----7 |
017 | use AppleScript version "2.8" |
018 | use framework "Foundation" |
019 | use framework "AppKit" |
020 | use scripting additions |
021 | property refMe : a reference to current application |
022 | |
023 | |
024 | ##パス製品版 |
025 | set appFileManager to refMe's NSFileManager's defaultManager() |
026 | set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSLibraryDirectory) inDomains:(refMe's NSUserDomainMask)) |
027 | set ocidLibraryDirPathURL to ocidURLsArray's firstObject() |
028 | ##PLISTへのパス まずは 製品版 |
029 | set ocidPlistFilePathURL to ocidLibraryDirPathURL's URLByAppendingPathComponent:("Preferences/com.adobe.Acrobat.Pro.plist") |
030 | set strPlistFilePath to (ocidPlistFilePathURL's |path|()) as text |
031 | ######################################################## |
032 | #######AVGeneral:IPMEnableAV2AcrobatNewUser |
033 | try |
034 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Print:DC:AVGeneral:IPMEnableAV2AcrobatNewUser:0\" \"" & strPlistFilePath & "\"") as text |
035 | set strResponse to (do shell script strCommandText) as text |
036 | on error |
037 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Add:DC:AVGeneral:IPMEnableAV2AcrobatNewUser array\" \"" & strPlistFilePath & "\"") as text |
038 | do shell script strCommandText |
039 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Add:DC:AVGeneral:IPMEnableAV2AcrobatNewUser:0 integer 0\" \"" & strPlistFilePath & "\"") as text |
040 | do shell script strCommandText |
041 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Add:DC:AVGeneral:IPMEnableAV2AcrobatNewUser:1 bool false\" \"" & strPlistFilePath & "\"") as text |
042 | do shell script strCommandText |
043 | end try |
044 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Set:DC:AVGeneral:IPMEnableAV2AcrobatNewUser:0 integer 0\" \"" & strPlistFilePath & "\"") as text |
045 | do shell script strCommandText |
046 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Set:DC:AVGeneral:IPMEnableAV2AcrobatNewUser:1 bool false\" \"" & strPlistFilePath & "\"") as text |
047 | do shell script strCommandText |
048 | |
049 | |
050 | #######AVGeneral:NumSwitcherContextualToolTipAV2Shown |
051 | try |
052 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Print:DC:AVGeneral:NumSwitcherContextualToolTipAV2Shown:0\" \"" & strPlistFilePath & "\"") as text |
053 | set strResponse to (do shell script strCommandText) as text |
054 | on error |
055 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Add:DC:AVGeneral:NumSwitcherContextualToolTipAV2Shown array\" \"" & strPlistFilePath & "\"") as text |
056 | do shell script strCommandText |
057 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Add:DC:AVGeneral:NumSwitcherContextualToolTipAV2Shown:0 integer 0\" \"" & strPlistFilePath & "\"") as text |
058 | do shell script strCommandText |
059 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Add:DC:AVGeneral:NumSwitcherContextualToolTipAV2Shown:1 bool false\" \"" & strPlistFilePath & "\"") as text |
060 | do shell script strCommandText |
061 | end try |
062 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Set:DC:AVGeneral:NumSwitcherContextualToolTipAV2Shown:0 integer 0\" \"" & strPlistFilePath & "\"") as text |
063 | do shell script strCommandText |
064 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Set:DC:AVGeneral:NumSwitcherContextualToolTipAV2Shown:1 bool false\" \"" & strPlistFilePath & "\"") as text |
065 | do shell script strCommandText |
066 | #######AVGeneral:EnableAV2 |
067 | try |
068 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Print:DC:AVGeneral:EnableAV2:0\" \"" & strPlistFilePath & "\"") as text |
069 | set strResponse to (do shell script strCommandText) as text |
070 | on error |
071 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Add:DC:AVGeneral:EnableAV2 array\" \"" & strPlistFilePath & "\"") as text |
072 | do shell script strCommandText |
073 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Add:DC:AVGeneral:EnableAV2:0 integer 0\" \"" & strPlistFilePath & "\"") as text |
074 | do shell script strCommandText |
075 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Add:DC:AVGeneral:EnableAV2:1 bool false\" \"" & strPlistFilePath & "\"") as text |
076 | do shell script strCommandText |
077 | end try |
078 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Set:DC:AVGeneral:EnableAV2:0 integer 0\" \"" & strPlistFilePath & "\"") as text |
079 | do shell script strCommandText |
080 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Set:DC:AVGeneral:EnableAV2:1 bool false\" \"" & strPlistFilePath & "\"") as text |
081 | do shell script strCommandText |
082 | #######FeatureLockDown:EnableAV2Enterprise FeatureLockdown |
083 | try |
084 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Print:DC:FeatureLockDown:bEnableAV2Enterprise:0\" \"" & strPlistFilePath & "\"") as text |
085 | set strResponse to (do shell script strCommandText) as text |
086 | on error |
087 | try |
088 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Print:DC:FeatureLockDown:\" \"" & strPlistFilePath & "\"") as text |
089 | set strResponse to (do shell script strCommandText) as text |
090 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Add:DC:FeatureLockDown:bEnableAV2Enterprise array\" \"" & strPlistFilePath & "\"") as text |
091 | do shell script strCommandText |
092 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Add:DC:FeatureLockDown:bEnableAV2Enterprise:0 integer 0\" \"" & strPlistFilePath & "\"") as text |
093 | do shell script strCommandText |
094 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Add:DC:FeatureLockDown:bEnableAV2Enterprise:1 bool false\" \"" & strPlistFilePath & "\"") as text |
095 | do shell script strCommandText |
096 | on error |
097 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Add:DC:FeatureLockDown dict\" \"" & strPlistFilePath & "\"") as text |
098 | do shell script strCommandText |
099 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Add:DC:FeatureLockDown:bEnableAV2Enterprise array\" \"" & strPlistFilePath & "\"") as text |
100 | do shell script strCommandText |
101 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Add:DC:FeatureLockDown:bEnableAV2Enterprise:0 integer 0\" \"" & strPlistFilePath & "\"") as text |
102 | do shell script strCommandText |
103 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Add:DC:FeatureLockDown:bEnableAV2Enterprise:1 bool false\" \"" & strPlistFilePath & "\"") as text |
104 | do shell script strCommandText |
105 | end try |
106 | end try |
107 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Set:DC:FeatureLockDown:bEnableAV2Enterprise:0 integer 0\" \"" & strPlistFilePath & "\"") as text |
108 | do shell script strCommandText |
109 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Set:DC:FeatureLockDown:bEnableAV2Enterprise:1 bool false\" \"" & strPlistFilePath & "\"") as text |
110 | do shell script strCommandText |
111 | |
112 | return |
113 | |
114 | |
115 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Save\" \"" & strPlistFilePath & "\"") as text |
116 | set strResponse to (do shell script strCommandText) as text |
117 | |
118 | |
119 | |
120 | ######################################################## |
121 | ##パス無償版 |
122 | set ocidPlistFilePathURL to ocidLibraryDirPathURL's URLByAppendingPathComponent:("Preferences/com.adobe.Reader.plist") |
123 | set strPlistFilePathURL to (ocidPlistFilePathURL's |path|()) as text |
124 | |
125 | #########内容の確認 |
126 | #IPMEnableAV2ReaderNewUser |
127 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Print:DC:AVGeneral:IPMEnableAV2ReaderNewUser:0\" \"" & strPlistFilePathURL & "\"") as text |
128 | set strResponse to (do shell script strCommandText) as text |
129 | log strResponse |
130 | ##########IPMEnableAV2ReaderNewUser |
131 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Print:DC:AVGeneral:IPMEnableAV2ReaderNewUser:1\" \"" & strPlistFilePathURL & "\"") as text |
132 | set strResponse to (do shell script strCommandText) as text |
133 | if strResponse is "true" then |
134 | log "IPMEnableAV2ReaderNewUser:現在の設定はYES TRUEです FALSEに変更します" |
135 | ###値変更 |
136 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Set:DC:AVGeneral:IPMEnableAV2ReaderNewUser:1 bool false\" \"" & strPlistFilePathURL & "\"") as text |
137 | set strResponse to (do shell script strCommandText) as text |
138 | else if strResponse is "false" then |
139 | log "IPMEnableAV2ReaderNewUser:現在の設定はNO FALSEです" |
140 | end if |
141 | |
142 | |
143 | #######EnableAV2 FeatureLockDown |
144 | try |
145 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Print:DC:FeatureLockDown:bEnableAV2:1\" \"" & strPlistFilePathURL & "\"") as text |
146 | set strResponse to (do shell script strCommandText) as text |
147 | if strResponse is "true" then |
148 | log "EnableAV2Enterprise:現在の設定はYES TRUEです FALSEに変更します" |
149 | ###値変更 |
150 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Set:DC:FeatureLockDown:bEnableAV2:1 bool false\" \"" & strPlistFilePathURL & "\"") as text |
151 | set strResponse to (do shell script strCommandText) as text |
152 | else if strResponse is "false" then |
153 | log "EnableAV2Enterprise:現在の設定はNO FALSEです" |
154 | end if |
155 | on error |
156 | ###値変更 |
157 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Add:DC:FeatureLockDown:bEnableAV2:0 integer 0\" \"" & strPlistFilePathURL & "\"") as text |
158 | set strResponse to (do shell script strCommandText) as text |
159 | ###値変更 |
160 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Add:DC:FeatureLockDown:bEnableAV2:1 bool false\" \"" & strPlistFilePathURL & "\"") as text |
161 | set strResponse to (do shell script strCommandText) as text |
162 | end try |
163 | #######EnableAV2 AVGeneral |
164 | try |
165 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Print:DC:AVGeneral:EnableAV2:1\" \"" & strPlistFilePathURL & "\"") as text |
166 | set strResponse to (do shell script strCommandText) as text |
167 | if strResponse is "true" then |
168 | log "EnableAV2Enterprise:現在の設定はYES TRUEです FALSEに変更します" |
169 | ###値変更 |
170 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Set:DC:AVGeneral:EnableAV2:1 bool false\" \"" & strPlistFilePathURL & "\"") as text |
171 | set strResponse to (do shell script strCommandText) as text |
172 | else if strResponse is "false" then |
173 | log "EnableAV2Enterprise:現在の設定はNO FALSEです" |
174 | end if |
175 | on error |
176 | ###値変更 |
177 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Set:DC:AVGeneral:EnableAV2:0 integer 0\" \"" & strPlistFilePathURL & "\"") as text |
178 | set strResponse to (do shell script strCommandText) as text |
179 | ###値変更 |
180 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Set:DC:AVGeneral:EnableAV2:1 bool false\" \"" & strPlistFilePathURL & "\"") as text |
181 | set strResponse to (do shell script strCommandText) as text |
182 | end try |
183 | |
184 | |
185 | #######EnableAV2Enterprise FeatureLockDown |
186 | try |
187 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Print:DC:FeatureLockDown:bEnableAV2Enterprise:1\" \"" & strPlistFilePathURL & "\"") as text |
188 | set strResponse to (do shell script strCommandText) as text |
189 | if strResponse is "true" then |
190 | log "EnableAV2Enterprise:現在の設定はYES TRUEです FALSEに変更します" |
191 | ###値変更 |
192 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Set:DC:FeatureLockDown:bEnableAV2Enterprise:1 bool false\" \"" & strPlistFilePathURL & "\"") as text |
193 | set strResponse to (do shell script strCommandText) as text |
194 | else if strResponse is "false" then |
195 | log "EnableAV2Enterprise:現在の設定はNO FALSEです" |
196 | end if |
197 | on error |
198 | ###値変更 |
199 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Add:DC:FeatureLockDown:bEnableAV2Enterprise:0 integer 0\" \"" & strPlistFilePathURL & "\"") as text |
200 | set strResponse to (do shell script strCommandText) as text |
201 | ###値変更 |
202 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Add:DC:FeatureLockDown:bEnableAV2Enterprise:1 bool false\" \"" & strPlistFilePathURL & "\"") as text |
203 | set strResponse to (do shell script strCommandText) as text |
204 | end try |
205 | #######EnableAV2Enterprise AVGeneral |
206 | try |
207 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Print:DC:AVGeneral:EnableAV2Enterprise:1\" \"" & strPlistFilePathURL & "\"") as text |
208 | set strResponse to (do shell script strCommandText) as text |
209 | if strResponse is "true" then |
210 | log "EnableAV2Enterprise:現在の設定はYES TRUEです FALSEに変更します" |
211 | ###値変更 |
212 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Set:DC:AVGeneral:EnableAV2Enterprise:1 bool false\" \"" & strPlistFilePathURL & "\"") as text |
213 | set strResponse to (do shell script strCommandText) as text |
214 | else if strResponse is "false" then |
215 | log "EnableAV2Enterprise:現在の設定はNO FALSEです" |
216 | end if |
217 | on error |
218 | ###値変更 |
219 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Add:DC:AVGeneral:EnableAV2Enterprise:0 integer 0\" \"" & strPlistFilePathURL & "\"") as text |
220 | set strResponse to (do shell script strCommandText) as text |
221 | ###値変更 |
222 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Add:DC:AVGeneral:EnableAV2Enterprise:1 bool false\" \"" & strPlistFilePathURL & "\"") as text |
223 | set strResponse to (do shell script strCommandText) as text |
224 | end try |
225 | |
226 | set strCommandText to ("/usr/libexec/PlistBuddy -c \"Save\" \"" & strPlistFilePathURL & "\"") as text |
227 | set strResponse to (do shell script strCommandText) as text |
228 | |
229 | |
230 | return |
231 | |
232 | |
AppleScriptで生成しました |
| 固定リンク