Acrobat Help追加メニュー更新(エラー制御を少し加えた)
サンプルコード
行番号 | ソース |
---|---|
001 | //////////////////////////////////////////////// |
002 | // Acrobat Help Menu |
003 | // |
004 | // 保存する時は文字コードをUTF-16で保存してください |
005 | // macOSの場合は改行はLF UNIX |
006 | // Windowsの場合は改行はCRLF win を指定してください |
007 | // インストール先は |
008 | // macOSの場合は |
009 | // /Users/ユーザー名/Library/Application Support/Adobe/Acrobat/DC/JavaScripts |
010 | // Windowsの場合は |
011 | // 改行をCRLFにした上で |
012 | // 32bit Windowsの場合 |
013 | // C:\Program Files (x86)\Adobe\Acrobat DC\Acrobat\Javascripts |
014 | // 64bit Windowsの場合 |
015 | // C:\Program Files\Adobe\Acrobat DC\Acrobat\Javascripts |
016 | // 20240913v4 回転チェックとバージョンチェックを追加 |
017 | // 20240915v4.1 Readerでエラーにならないように修正 |
018 | // 20241117 ビューステートにエラー制御を入れた |
019 | // com.cocolog-nifty.quicktimer.icefloe |
020 | //////////////////////////////////////////////// |
021 | menuParent = "Help"; |
022 | //////////////////////////////////////////////// |
023 | app.addSubMenu({ |
024 | cName: "addHelpSubMenuAdobe", |
025 | cUser: "▼Adobe関連", |
026 | cTooltext: "Adobe関連", |
027 | cParent: menuParent, |
028 | cEnable: "event.rc = true", |
029 | cMarked: "event.rc = false", |
030 | nPos: 5 |
031 | }); |
032 | app.addSubMenu({ |
033 | cName: "addHelpSubMenuUrl", |
034 | cUser: "▼開発関連", |
035 | cTooltext: "ヘルプ関連", |
036 | cParent: menuParent, |
037 | cEnable: "event.rc = true", |
038 | cMarked: "event.rc = false", |
039 | nPos: 6 |
040 | }); |
041 | app.addSubMenu({ |
042 | cName: "addHelpSubMenuCon", |
043 | cUser: "▼コンソール", |
044 | cTooltext: "コンソール関連", |
045 | cParent: menuParent, |
046 | cEnable: "event.rc = true", |
047 | cMarked: "event.rc = false", |
048 | nPos: 7 |
049 | }); |
050 | app.addSubMenu({ |
051 | cName: "addHelpSubMenuSh", |
052 | cUser: "▼ファイル共有", |
053 | cTooltext: "ファイル共有", |
054 | cParent: menuParent, |
055 | cEnable: "event.rc = true", |
056 | cMarked: "event.rc = false", |
057 | nPos: 8 |
058 | }); |
059 | app.addSubMenu({ |
060 | cName: "addHelpSubMenuOpen", |
061 | cUser: "▼設定", |
062 | cTooltext: "設定関連", |
063 | cParent: menuParent, |
064 | cEnable: "event.rc = true", |
065 | cMarked: "event.rc = false", |
066 | nPos: 9 |
067 | }); |
068 | //////////////////////////////////////////////// |
069 | app.addMenuItem({ |
070 | cName: "OpenURL3", |
071 | cUser: "■Document Cloud", |
072 | cParent: "addHelpSubMenuAdobe", |
073 | cExec: "app.launchURL(\"https://acrobat.adobe.com/link/documents/files/\", true);", |
074 | nPos: 53 |
075 | }); |
076 | app.addMenuItem({ |
077 | cName: "OpenURL4", |
078 | cUser: "■Creative Cloud Assets File", |
079 | cParent: "addHelpSubMenuAdobe", |
080 | cExec: "app.launchURL(\"https://assets.adobe.com/files\", true);", |
081 | nPos: 54 |
082 | }); |
083 | app.addMenuItem({ |
084 | cName: "OpenURL5", |
085 | cUser: "■Creative Cloud Assets Libraries", |
086 | cParent: "addHelpSubMenuAdobe", |
087 | cExec: "app.launchURL(\"https://assets.adobe.com/libraries\", true);", |
088 | nPos: 55 |
089 | }); |
090 | app.addMenuItem({ |
091 | cName: "OpenURL6", |
092 | cUser: "■Creative Cloud Assets XD", |
093 | cParent: "addHelpSubMenuAdobe", |
094 | cExec: "app.launchURL(\"https://assets.adobe.com/cloud-documents\", true);", |
095 | nPos: 56 |
096 | }); |
097 | app.addMenuItem({ |
098 | cName: "OpenURL7", |
099 | cUser: "■Publish Online", |
100 | cParent: "addHelpSubMenuAdobe", |
101 | cExec: "app.launchURL(\"https://indd.adobe.com/dashboard\", true);", |
102 | nPos: 57 |
103 | }); |
104 | app.addMenuItem({ |
105 | cName: "OpenURL8", |
106 | cUser: "■Adobe Lightroom Online", |
107 | cParent: "addHelpSubMenuAdobe", |
108 | cExec: "app.launchURL(\"https://lightroom.adobe.com/libraries/\", true);", |
109 | nPos: 58 |
110 | }); |
111 | app.addMenuItem({ |
112 | cName: "OpenURL9", |
113 | cUser: "■Adobe Fonts", |
114 | cParent: "addHelpSubMenuAdobe", |
115 | cExec: "app.launchURL(\"https://fonts.adobe.com/?locale=ja-JP\", true);", |
116 | nPos: 59 |
117 | }); |
118 | app.addMenuItem({ |
119 | cName: "appHelpOpenDocHelpUserGuide", |
120 | cUser: "■ユーザーガイドを開きます", |
121 | cLabel: "appHelpOpenGuide", |
122 | cTooltext: "appHelpOpenGuide", |
123 | cParent: "addHelpSubMenuAdobe", |
124 | cExec: "appHelpOpenGuide();", |
125 | cEnable: "event.rc = true", |
126 | cMarked: "event.rc = false", |
127 | nPos: 52, |
128 | }); |
129 | app.addMenuItem({ |
130 | cName: "OpenURL16", |
131 | cUser: "■Acrobatフォーラム", |
132 | cParent: "addHelpSubMenuAdobe", |
133 | cExec: "app.launchURL(\"https://community.adobe.com/t5/acrobat%E3%83%95%E3%82%A9%E3%83%BC%E3%83%A9%E3%83%A0/ct-p/ct-acrobat-jp\", true);", |
134 | nPos: 51 |
135 | }); |
136 | app.addMenuItem({ |
137 | cName: "OpenURL17", |
138 | cUser: "■Acrobat Readerフォーラム", |
139 | cParent: "addHelpSubMenuAdobe", |
140 | cExec: "app.launchURL(\"https://community.adobe.com/t5/acrobat-reader-acrobat-dc-for-mobile%E3%83%95%E3%82%A9%E3%83%BC%E3%83%A9%E3%83%A0/ct-p/ct-acrobat-reader-and-reader-mobile-jp?page=1&sort=latest_replies&lang=all&tabid=all&profile.language=ja#:~:text=Acrobat%20Reader%20/%20Acrobat%20DC%20for%20Mobile%E3%83%95%E3%82%A9%E3%83%BC%E3%83%A9%E3%83%A0\", true);", |
141 | nPos: 50 |
142 | }); |
143 | //////////////////////////////////////////// |
144 | app.addMenuItem({ |
145 | cName: "OpenURL1", |
146 | cUser: "リリースノート", |
147 | cParent: "addHelpSubMenuUrl", |
148 | cExec: "app.launchURL(\"https://www.adobe.com/devnet-docs/acrobatetk/tools/ReleaseNotesDC/index.html\", true);", |
149 | nPos: 69 |
150 | }); |
151 | app.addMenuItem({ |
152 | cName: "OpenURL2", |
153 | cUser: "Acrobat DC SDK Documentation", |
154 | cParent: "addHelpSubMenuUrl", |
155 | cExec: "app.launchURL(\"https://opensource.adobe.com/dc-acrobat-sdk-docs/acrobatsdk/\", true);", |
156 | nPos: 68 |
157 | }); |
158 | app.addMenuItem({ |
159 | cName: "OpenURL10", |
160 | cUser: "JavaScript API", |
161 | cParent: "addHelpSubMenuUrl", |
162 | cExec: "app.launchURL(\"https://opensource.adobe.com/dc-acrobat-sdk-docs/library/jsapiref/JS_API_AcroJS.html\", true);", |
163 | nPos: 67 |
164 | }); |
165 | app.addMenuItem({ |
166 | cName: "OpenURL11", |
167 | cUser: "Document Services API", |
168 | cParent: "addHelpSubMenuUrl", |
169 | cExec: "app.launchURL(\"https://documentcloud.adobe.com/dc-integration-creation-app-cdn/main.html\", true);", |
170 | nPos: 66 |
171 | }); |
172 | app.addMenuItem({ |
173 | cName: "OpenURL12", |
174 | cUser: "PDF Embed API", |
175 | cParent: "addHelpSubMenuUrl", |
176 | cExec: "app.launchURL(\"https://developer.adobe.com/document-services/docs/overview/pdf-embed-api/\", true);", |
177 | nPos: 65 |
178 | }); |
179 | app.addMenuItem({ |
180 | cName: "OpenURL13", |
181 | cUser: "AdminConsole", |
182 | cParent: "addHelpSubMenuUrl", |
183 | cExec: "app.launchURL(\"https://adminconsole.adobe.com/\", true);", |
184 | nPos: 64 |
185 | }); |
186 | app.addMenuItem({ |
187 | cName: "appHelpOpenTrustedMenu", |
188 | cUser: "API ReferencePDFを開く", |
189 | cLabel: "appHelpOpenTrustedMenu", |
190 | cTooltext: "appHelpOpenTrustedMenu", |
191 | cParent: "addHelpSubMenuUrl", |
192 | cExec: "appHelpOpenTrustedMenu();", |
193 | cEnable: "event.rc = true", |
194 | cMarked: "event.rc = false", |
195 | nPos: 63 |
196 | }); |
197 | app.addMenuItem({ |
198 | cName: "OpenURL15", |
199 | cUser: "Adobe Dev SDK", |
200 | cParent: "addHelpSubMenuUrl", |
201 | cExec: "app.launchURL(\"https://developer.adobe.com/console/servicesandapis\", true);", |
202 | nPos: 62 |
203 | }); |
204 | |
205 | app.addMenuItem({ |
206 | cName: "OpenURL18", |
207 | cUser: "PrefRef Mac", |
208 | cParent: "addHelpSubMenuUrl", |
209 | cExec: "app.launchURL(\"https://www.adobe.com/devnet-docs/acrobatetk/tools/PrefRef/Macintosh/index.html\", true);", |
210 | nPos: 61 |
211 | }); |
212 | |
213 | app.addMenuItem({ |
214 | cName: "OpenURL19", |
215 | cUser: "PrefRef Win", |
216 | cParent: "addHelpSubMenuUrl", |
217 | cExec: "app.launchURL(\"https://www.adobe.com/devnet-docs/acrobatetk/tools/PrefRef/Windows/index.html\", true);", |
218 | nPos: 60 |
219 | }); |
220 | |
221 | |
222 | //////////////////////////////////////////////////////////////////////// |
223 | app.addMenuItem({ |
224 | cName: "appHelpSubPrefOpen", |
225 | cUser: "環境設定パネルを開きます", |
226 | cLabel: "環境設定パネルを開きます", |
227 | cTooltext: "環境設定パネルを開きます", |
228 | cParent: "addHelpSubMenuOpen", |
229 | cExec: "appHelpAddPrintList();", |
230 | cEnable: "event.rc = true", |
231 | cMarked: "event.rc = false", |
232 | nPos: 22, |
233 | }); |
234 | app.addMenuItem({ |
235 | cName: "OpenURL23", |
236 | cUser: "JavaScripts フォルダを開きます", |
237 | cParent: "addHelpSubMenuOpen", |
238 | cExec: "appGetJavascriptPath()", |
239 | nPos: 23 |
240 | }); |
241 | function appGetJavascriptPath() { |
242 | try { |
243 | var strUserJavascriptDir = app.getPath("user", "javascript"); |
244 | var strFilePath = strUserJavascriptDir.replace(/^.*Users/, '/Users'); |
245 | app.launchURL("file://" + strFilePath + "", true); |
246 | } catch (error) { |
247 | console.println("メニュー実行エラー(undefined)") |
248 | return; |
249 | } |
250 | } |
251 | app.addMenuItem({ |
252 | cName: "OpenURL24", |
253 | cUser: "Stamps フォルダを開きます", |
254 | cParent: "addHelpSubMenuOpen", |
255 | cExec: "appGetStampsPath()", |
256 | nPos: 24 |
257 | }); |
258 | function appGetStampsPath() { |
259 | try { |
260 | var strUserStampstDir = app.getPath("user", "stamps"); |
261 | var strFilePath = strUserStampstDir.replace(/^.*Users/, '/Users'); |
262 | app.launchURL("file://" + strFilePath + "", true); |
263 | } catch (error) { |
264 | console.println("メニュー実行エラー(undefined)") |
265 | return; |
266 | } |
267 | } |
268 | |
269 | app.addMenuItem({ |
270 | cName: "appHelpOpenGeneralInfo", |
271 | cUser: "文書のプロパティを開きます", |
272 | cLabel: "appHelpOpenGeneralInfo", |
273 | cTooltext: "appHelpOpenGeneralInfo", |
274 | cParent: "addHelpSubMenuOpen", |
275 | cExec: "appHelpOpenGeneralInfo();", |
276 | cEnable: "event.rc = (event.target != null);", |
277 | cMarked: "event.rc = false", |
278 | nPos: 25, |
279 | }); |
280 | //////////////////////////////////////////////////////////////////////// |
281 | app.addMenuItem({ |
282 | cName: "SharedURL1", |
283 | cUser: "Document Cloud", |
284 | cParent: "addHelpSubMenuSh", |
285 | cExec: "app.launchURL(\"https://documentcloud.adobe.com/\", true);", |
286 | nPos: 81 |
287 | }); |
288 | app.addMenuItem({ |
289 | cName: "SharedURL2", |
290 | cUser: "Creative Cloud Assets File", |
291 | cParent: "addHelpSubMenuSh", |
292 | cExec: "app.launchURL(\"https://assets.adobe.com/files\", true);", |
293 | nPos: 82 |
294 | }); |
295 | app.addMenuItem({ |
296 | cName: "SharedURL3", |
297 | cUser: "Box", |
298 | cParent: "addHelpSubMenuSh", |
299 | cExec: "app.launchURL(\"https://app.box.com/\", true);", |
300 | nPos: 83 |
301 | }); |
302 | app.addMenuItem({ |
303 | cName: "SharedURL4", |
304 | cUser: "DropBox", |
305 | cParent: "addHelpSubMenuSh", |
306 | cExec: "app.launchURL(\"https://www.dropbox.com/home\", true);", |
307 | nPos: 84 |
308 | }); |
309 | app.addMenuItem({ |
310 | cName: "SharedURL5", |
311 | cUser: "GoogleDrive", |
312 | cParent: "addHelpSubMenuSh", |
313 | cExec: "app.launchURL(\"https://drive.google.com/\", true);", |
314 | nPos: 85 |
315 | }); |
316 | app.addMenuItem({ |
317 | cName: "SharedURL6", |
318 | cUser: "OneDrive", |
319 | cParent: "addHelpSubMenuSh", |
320 | cExec: "app.launchURL(\"https://onedrive.live.com/\", true);", |
321 | nPos: 86 |
322 | }); |
323 | //////////////////////////////////////////////////////////////////////// |
324 | // |
325 | app.addMenuItem({ |
326 | cName: "appviewState", |
327 | cUser: "viewState", |
328 | cLabel: "viewState", |
329 | cTooltext: "viewState", |
330 | cParent: "addHelpSubMenuCon", |
331 | cExec: "doViewStatePrint()", |
332 | cEnable: "event.rc = true", |
333 | cMarked: "event.rc = false", |
334 | nPos: 75 |
335 | }); |
336 | |
337 | |
338 | |
339 | app.addMenuItem({ |
340 | cName: "appRotationCheckMenu", |
341 | cUser: "PDFページの回転チェック", |
342 | cLabel: "PDFページの回転チェック", |
343 | cTooltext: "PDFページの回転チェック", |
344 | cParent: "addHelpSubMenuCon", |
345 | cExec: "doRotationChk();", |
346 | cEnable: "event.rc = true", |
347 | cMarked: "event.rc = false", |
348 | nPos: 74 |
349 | }); |
350 | app.addMenuItem({ |
351 | cName: "appVersionCheckMenu", |
352 | cUser: "バージョンチェック", |
353 | cLabel: "バージョンチェック", |
354 | cTooltext: "バージョンチェック", |
355 | cParent: "addHelpSubMenuCon", |
356 | cExec: "doChkVersionChk();", |
357 | cEnable: "event.rc = true", |
358 | cMarked: "event.rc = false", |
359 | nPos: 73 |
360 | }); |
361 | app.addMenuItem({ |
362 | cName: "appHelpSubPrintMenuList", |
363 | cUser: "メニューリスト出力", |
364 | cTooltext: "メニューリスト出力", |
365 | cLabel: "メニューリスト出力", |
366 | cParent: "addHelpSubMenuCon", |
367 | cExec: "appHelpMenuList();", |
368 | cEnable: "event.rc = true", |
369 | cMarked: "event.rc = false", |
370 | nPos: 72 |
371 | }); |
372 | // |
373 | app.addMenuItem({ |
374 | cName: "AppOpenConsole", |
375 | cUser: "デバッガーを開く", |
376 | cLabel: "デバッガーを開く", |
377 | cTooltext: "デバッガーを開く", |
378 | cParent: "addHelpSubMenuCon", |
379 | cExec: "console.show();", |
380 | cEnable: "event.rc = true", |
381 | cMarked: "event.rc = false", |
382 | nPos: 71 |
383 | }); |
384 | //////////////// |
385 | function doRotationChk() { |
386 | console.show(); |
387 | console.println("\n"); |
388 | var numAllPage = this.numPages; |
389 | var strOutPut = ""; |
390 | for (var nPage = 0; nPage < numAllPage; nPage++) { |
391 | var numPageRotation = this.getPageRotation(nPage); |
392 | var numPrintPageNo = (nPage + 1); |
393 | var strPrintPageNo = numPrintPageNo.toString(); |
394 | var strLeadingZero = "000" + strPrintPageNo; |
395 | var strSetPage = strLeadingZero.slice(-4); |
396 | if (numPageRotation == 0) { |
397 | var strOutPut = strOutPut + ("ページ番号: " + strSetPage + "\t回転: " + numPageRotation + "\t天地/上下\n"); |
398 | } |
399 | else if (numPageRotation == 90) { |
400 | var strOutPut = strOutPut + ("ページ番号: " + strSetPage + "\t回転: " + numPageRotation + "\t天地/右左\n"); |
401 | } |
402 | else if (numPageRotation == 180) { |
403 | var strOutPut = strOutPut + ("ページ番号: " + strSetPage + "\t回転: " + numPageRotation + "\t天地/下上\n"); |
404 | } |
405 | else if (numPageRotation == 270) { |
406 | var strOutPut = strOutPut + ("ページ番号: " + strSetPage + "\t回転: " + numPageRotation + "\t天地/左右\n"); |
407 | } |
408 | else { |
409 | var strOutPut = strOutPut + ("エラーPDFのページ回転構造に問題があります\n"); |
410 | var strOutPut = strOutPut + ("ページ番号: " + strSetPage + "\t回転: " + numPageRotation + "\n"); |
411 | } |
412 | } |
413 | var rectCropBox = this.getPageBox("Crop", 0); |
414 | var CropBoxSizeHeight = rectCropBox[1] - rectCropBox[0] - 36; |
415 | var CropBoxSizeWidth = rectCropBox[2] - rectCropBox[3] - 36; |
416 | console.println(strOutPut); |
417 | this.addAnnot({ page: 0, type: "Text", print: false, point: [CropBoxSizeWidth, CropBoxSizeHeight], name: "PDFページの回転チェック", author: "PDFページの回転チェック", subject: "PDFページの回転チェック", contents: strOutPut, noteIcon: "Help" }); |
418 | if (app.viewerType == "Exchange-Pro") { |
419 | var strFilePath = this.path; |
420 | var docReport = new Report(); |
421 | var strVerString = "Adobe\xAE Acrobat\xAE PDFページの回転チェック\n"; |
422 | docReport.writeText(strVerString); |
423 | docReport.writeText(strFilePath); |
424 | docReport.divide(); |
425 | docReport.writeText(strOutPut); |
426 | docReport.divide(); |
427 | docReport.open("PDFページの回転チェック"); |
428 | } |
429 | } |
430 | |
431 | //////////////// |
432 | function doChkVersionChk() { |
433 | console.show(); |
434 | console.clear(); |
435 | console.println(""); |
436 | |
437 | var strVersionText = "Adobe\xAE Acrobat\xAE " + app.viewerVersion + " " + app.viewerType + "\n"; |
438 | strVersionText += "Variation: " + app.viewerVariation + "\n"; |
439 | strVersionText += "Type: " + app.viewerType + "\n"; |
440 | strVersionText += "Platform: " + app.platform + "\n"; |
441 | strVersionText += "Language: " + app.language + "\n"; |
442 | strVersionText += "PlugIns: " + app.numPlugIns + "\n"; |
443 | var numCntPr = app.printerNames.length; |
444 | for (var i = 0; i < numCntPr; i++) { |
445 | strVersionText += "Printer: " + app.printerNames[i] + "\n"; |
446 | } |
447 | console.println(strVersionText); |
448 | if (app.viewerType == "Exchange-Pro") { |
449 | var docReport = new Report(); |
450 | var strVerString = "Adobe\xAE Acrobat\xAE " + app.viewerVersion + " " + app.viewerType + "\n"; |
451 | docReport.writeText(strVerString); |
452 | docReport.writeText("Variation: " + app.viewerVariation); |
453 | docReport.divide(); |
454 | docReport.writeText(strVersionText); |
455 | docReport.divide(); |
456 | try { |
457 | var strSetValue = identity.name; |
458 | } catch (e) { |
459 | var strSetValue = "Not configured"; |
460 | } |
461 | docReport.writeText("Name: " + strSetValue); |
462 | try { |
463 | var strSetValue = identity.loginName; |
464 | } catch (e) { |
465 | var strSetValue = "Not configured"; |
466 | } |
467 | docReport.writeText("LoginName: " + strSetValue); |
468 | try { |
469 | var strSetValue = identity.email; |
470 | } catch (e) { |
471 | var strSetValue = "Not configured"; |
472 | } |
473 | docReport.writeText("eMail: " + strSetValue); |
474 | try { |
475 | var strSetValue = identity.corporation; |
476 | } catch (e) { |
477 | var strSetValue = "Not configured"; |
478 | } |
479 | docReport.writeText("Corporation: " + strSetValue); |
480 | docReport.open("バージョンレポート"); |
481 | } |
482 | }; |
483 | //////////////////////////////////////////////////////////////////////// |
484 | appTrustedMenu = app.trustedFunction( |
485 | function (argMenuName) { |
486 | app.beginPriv(); |
487 | app.execMenuItem(argMenuName); |
488 | app.endPriv(); |
489 | } |
490 | ); |
491 | function appHelpOpenTrustedMenu() { |
492 | try { |
493 | var cResponse = app.response({ |
494 | cQuestion: "開きたいPDFのURLを入力", |
495 | cTitle: "よろしければOKしてください", |
496 | cDefault: "https://quicktimer.cocolog-nifty.com/icefloe/files/acrobatsdk_jsdevguide.pdf", |
497 | bPassword: false, |
498 | cLabel: "Response:" |
499 | }); |
500 | if (cResponse == null) { |
501 | console.println("メニュー実行エラー(null)"); |
502 | return; |
503 | } else if (cResponse == "undefined") { |
504 | console.println("メニュー実行エラー(undefined)") |
505 | return; |
506 | } else if (cResponse == "null") { |
507 | console.println("メニュー実行エラー(null text)") |
508 | return; |
509 | } |
510 | else |
511 | var myURL = encodeURI(cResponse); |
512 | app.openDoc({ cPath: myURL, cFS: "CHTTP" }); |
513 | } catch (error) { |
514 | console.println("メニュー実行エラー"); |
515 | } |
516 | } |
517 | ///////////////////////////////////////////////// |
518 | function appHelpOpenGeneralInfo() { |
519 | try { |
520 | app.execMenuItem('GeneralInfo'); |
521 | } catch (error) { |
522 | console.println("メニュー実行エラー"); |
523 | } |
524 | } |
525 | function appHelpOpenGuide() { |
526 | try { |
527 | app.execMenuItem('DocHelpUserGuide'); |
528 | } catch (error) { |
529 | app.launchURL("https://helpx.adobe.com/jp/acrobat/user-guide.html"); |
530 | } |
531 | } |
532 | function appInfoMesAlert() { |
533 | app.alert({ |
534 | //メッセージ本文 |
535 | //cMsg: "ユーザー情報を設定してください", |
536 | cMsg: "ユーザー情報を\n\n設定してください", |
537 | //ダイアログのタイトル |
538 | cTitle: "ユーザー情報の入力", |
539 | //アイコンの種類 0〜3 |
540 | nIcon: 3, |
541 | //ボタングループの種類 0〜3 |
542 | nType: 0 |
543 | }); |
544 | } |
545 | function appHelpAddPrintList() { |
546 | appInfoMesAlert(); |
547 | // app.execMenuItem('GeneralPrefs'); |
548 | app.execMenuItem('GeneralPrefs'); |
549 | } |
550 | //////////////////////////////////////////////////////////////// |
551 | function appHelpMenuList() { |
552 | console.show(); |
553 | if (app.viewerType == "Exchange-Pro") { |
554 | var docReport = new Report(); |
555 | } |
556 | ////app.execMenuItem("CommentApp"); |
557 | function FancyMenuList(m, nLevel) { |
558 | var s = ""; |
559 | for (var i = 0; i < nLevel; i++) s += " "; |
560 | console.println(s + "+-" + m.cName); |
561 | if (app.viewerType == "Exchange-Pro") { |
562 | docReport.writeText(s + "+-" + m.cName); |
563 | } |
564 | if (m.oChildren != null) |
565 | for (var i = 0; i < m.oChildren.length; i++) |
566 | FancyMenuList(m.oChildren[i], nLevel + 1); |
567 | } |
568 | var m = app.listMenuItems(); |
569 | for (var i = 0; i < m.length; i++) FancyMenuList(m[i], 0); |
570 | console.println("##############\n"); |
571 | if (app.viewerType == "Exchange-Pro") { |
572 | docReport.divide(); |
573 | } |
574 | var menuItems = app.listMenuItems(); |
575 | for (var i in menuItems) |
576 | console.println(menuItems[i] + "\n"); |
577 | if (app.viewerType == "Exchange-Pro") { |
578 | docReport.writeText(menuItems[i] + "\n"); |
579 | } |
580 | console.println("##############\n") |
581 | if (app.viewerType == "Exchange-Pro") { |
582 | docReport.divide(); |
583 | } |
584 | var botItem = app.listToolbarButtons(); |
585 | for (var i in botItem) |
586 | console.println(botItem[i] + "\n"); |
587 | if (app.viewerType == "Exchange-Pro") { |
588 | docReport.writeText(botItem[i] + "\n"); |
589 | } |
590 | console.println("\n##############\n" + botItem); |
591 | if (app.viewerType == "Exchange-Pro") { |
592 | docReport.divide(); |
593 | docReport.open("メニュー項目一覧"); |
594 | } |
595 | /* |
596 | console.println(""); |
597 | console.println(""); |
598 | var listMenuArray = app.listMenuItems(); |
599 | for (var numCntNo in listMenuArray) { |
600 | console.println(listMenuArray[numCntNo] + "\n"); |
601 | } |
602 | */ |
603 | |
604 | } |
605 | |
606 | function doViewStatePrint() { |
607 | var objActiveDocs = app.activeDocs; |
608 | var numCntDoc = objActiveDocs.length; |
609 | if (numCntDoc === 0) { |
610 | console.clear(); |
611 | console.show(); |
612 | console.println("ドキュメントを開いてから実行してください"); |
613 | return; |
614 | } |
615 | var objActiveDoc = objActiveDocs[0]; |
616 | console.clear(); |
617 | console.show(); |
618 | var viewStateDictStr = objActiveDoc.viewState.toSource(); |
619 | var viewStateDict = eval(viewStateDictStr); |
620 | for (var itemkey in viewStateDict) { |
621 | if (viewStateDict.hasOwnProperty(itemkey)) { |
622 | console.println(itemkey + ": " + viewStateDict[itemkey]); |
623 | } |
624 | } |
625 | } |
AppleScriptで生成しました |
| 固定リンク