Acrobat Menu

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////////////////////////////////////////////////
021menuParent = "Help";
022////////////////////////////////////////////////
023app.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});
032app.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});
041app.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});
050app.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});
059app.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////////////////////////////////////////////////
069app.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});
076app.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});
083app.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});
090app.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});
097app.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});
104app.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});
111app.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});
118app.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});
129app.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});
136app.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////////////////////////////////////////////
144app.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});
151app.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});
158app.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});
165app.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});
172app.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});
179app.addMenuItem({
180  cName: "OpenURL13",
181  cUser: "AdminConsole",
182  cParent: "addHelpSubMenuUrl",
183  cExec: "app.launchURL(\"https://adminconsole.adobe.com/\", true);",
184  nPos: 64
185});
186app.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});
197app.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
205app.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
213app.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////////////////////////////////////////////////////////////////////////
223app.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});
234app.addMenuItem({
235  cName: "OpenURL23",
236  cUser: "JavaScripts フォルダを開きます",
237  cParent: "addHelpSubMenuOpen",
238  cExec: "appGetJavascriptPath()",
239  nPos: 23
240});
241function 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}
251app.addMenuItem({
252  cName: "OpenURL24",
253  cUser: "Stamps フォルダを開きます",
254  cParent: "addHelpSubMenuOpen",
255  cExec: "appGetStampsPath()",
256  nPos: 24
257});
258function 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
269app.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////////////////////////////////////////////////////////////////////////
281app.addMenuItem({
282  cName: "SharedURL1",
283  cUser: "Document Cloud",
284  cParent: "addHelpSubMenuSh",
285  cExec: "app.launchURL(\"https://documentcloud.adobe.com/\", true);",
286  nPos: 81
287});
288app.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});
295app.addMenuItem({
296  cName: "SharedURL3",
297  cUser: "Box",
298  cParent: "addHelpSubMenuSh",
299  cExec: "app.launchURL(\"https://app.box.com/\", true);",
300  nPos: 83
301});
302app.addMenuItem({
303  cName: "SharedURL4",
304  cUser: "DropBox",
305  cParent: "addHelpSubMenuSh",
306  cExec: "app.launchURL(\"https://www.dropbox.com/home\", true);",
307  nPos: 84
308});
309app.addMenuItem({
310  cName: "SharedURL5",
311  cUser: "GoogleDrive",
312  cParent: "addHelpSubMenuSh",
313  cExec: "app.launchURL(\"https://drive.google.com/\", true);",
314  nPos: 85
315});
316app.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//
325app.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
339app.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});
350app.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});
361app.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//
373app.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////////////////
385function 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////////////////
432function 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////////////////////////////////////////////////////////////////////////
484appTrustedMenu = app.trustedFunction(
485  function (argMenuName) {
486    app.beginPriv();
487    app.execMenuItem(argMenuName);
488    app.endPriv();
489  }
490);
491function 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/////////////////////////////////////////////////
518function appHelpOpenGeneralInfo() {
519  try {
520    app.execMenuItem('GeneralInfo');
521  } catch (error) {
522    console.println("メニュー実行エラー");
523  }
524}
525function appHelpOpenGuide() {
526  try {
527    app.execMenuItem('DocHelpUserGuide');
528  } catch (error) {
529    app.launchURL("https://helpx.adobe.com/jp/acrobat/user-guide.html");
530  }
531}
532function 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}
545function appHelpAddPrintList() {
546  appInfoMesAlert();
547  //  app.execMenuItem('GeneralPrefs');
548  app.execMenuItem('GeneralPrefs');
549}
550////////////////////////////////////////////////////////////////
551function 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/*
596console.println("");
597console.println("");
598var listMenuArray = app.listMenuItems();
599for (var numCntNo in listMenuArray) {
600console.println(listMenuArray[numCntNo] + "\n");
601}
602*/
603
604}
605
606function 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で生成しました

|

[Javascript]Acrobat ファイルメニュー拡張

20241012055514_1722x490


ダウンロード - appfileopen_js.zip

|

[JavaScripts]Acrobat ヘルプメニュー拡張(ページ回転チェックを追加)修正



[JavaScript]Acrobat Javascript基本設定 (Win)も参考にしてください
https://quicktimer.cocolog-nifty.com/icefloe/2024/09/post-e1ed9e.html

macOS

ダウンロード - addhelpmenu.mac.zip



Windows

ダウンロード - addhelpmenu.win.zip




サンプルコード

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

|

[Acrobat]ページの統合(注釈スタンプをオブジェクトにする)

202409140216261080x1080

ダウンロード - appeditflattenmenu.js.zip




サンプルコード

サンプルソース(参考)
行番号ソース
001//
002// com.cocolog-nifty.quicktimer.icefloe
003////////////////////////////////////////////////
004
005
006menuParent = "Edit";
007
008app.addSubMenu({
009  cName:"FlattenMenu",
010  cUser:"▼統合",
011  cTooltext: "▼統合",
012  cParent:menuParent,
013  cEnable: "event.rc = app.doc != null",
014  cMarked: "event.rc = false",
015  nPos:3
016  });
017app.addMenuItem({
018  cName: "doFlattenPagesAll",
019  cUser: "全ページ統合",
020  cTooltext: "全ページ統合",
021  cLabel: "全ページ統合",
022  cParent: "FlattenMenu",
023  cEnable: "event.rc = app.doc != null",
024  cMarked: "event.rc = false",
025  cExec: "doFlattenPagesAll()",
026  nPos: 1
027});
028app.addMenuItem({
029  cName: "doFlattenPagesSingle",
030  cUser: "単ページ統合",
031  cTooltext: "単ページ統合",
032  cLabel: "単ページ統合",
033  cParent: "FlattenMenu",
034  cEnable: "event.rc = app.doc != null",
035  cMarked: "event.rc = false",
036  cExec: "doFlattenPagesSingle()",
037  nPos: 2
038});
039var doFlattenPagesAll = app.trustedFunction(function () {
040  this.flattenPages(0, this.numPages - 1);
041});
042
043var doFlattenPagesSingle = app.trustedFunction(function () {
044  this.flattenPages(this.pageNum);
045});
AppleScriptで生成しました

|

[Acrobat]書き出し各種(項目増やした)



ダウンロード - appfileexport.js.zip




サンプルコード

サンプルソース(参考)
行番号ソース
001// com.cocolog-nifty.quicktimer.icefloe
002// 書き出しサブメニュー AcroMini用
003////////////////////////////////////////////////
004//メニュー実行時のファンクション
005function expptx() {
006  var strPath = this.path;
007  if (strPath.indexOf("/Acrobat.com/") !== -1) {
008    throw new Error("エラー:クラウドドキュメントは書き出しできません");
009  }
010  var strSavePath = strPath + '.pptx';
011  this.saveAs({ cPath: strSavePath, bPromptToOverwrite: true, cConvID: 'com.adobe.acrobat.pptx', bCopy: false });
012}
013function expxlsx() {
014  var strPath = this.path;
015  if (strPath.indexOf("/Acrobat.com/") !== -1) {
016    throw new Error("エラー:クラウドドキュメントは書き出しできません");
017  }
018  var strSavePath = strPath + '.xlsx';
019  this.saveAs({ cPath: strSavePath, bPromptToOverwrite: true, cConvID: 'com.adobe.acrobat.xlsx', bCopy: false });
020}
021function expdocx() {
022  var strPath = this.path;
023  if (strPath.indexOf("/Acrobat.com/") !== -1) {
024    throw new Error("エラー:クラウドドキュメントは書き出しできません");
025  }
026  var strSavePath = strPath + '.docx';
027  this.saveAs({ cPath: strSavePath, bPromptToOverwrite: true, cConvID: 'com.adobe.acrobat.docx', bCopy: false });
028}
029function expdoc() {
030  var strPath = this.path;
031  if (strPath.indexOf("/Acrobat.com/") !== -1) {
032    throw new Error("エラー:クラウドドキュメントは書き出しできません");
033  }
034  var strSavePath = strPath + '.doc';
035  this.saveAs({ cPath: strSavePath, bPromptToOverwrite: true, cConvID: 'com.adobe.acrobat.doc', bCopy: false });
036}
037function exprtf() {
038  var strPath = this.path;
039  if (strPath.indexOf("/Acrobat.com/") !== -1) {
040    throw new Error("エラー:クラウドドキュメントは書き出しできません");
041  }
042  var strSavePath = strPath + '.rtf';
043  this.saveAs({ cPath: strSavePath, bPromptToOverwrite: true, cConvID: 'com.adobe.acrobat.rtf', bCopy: false });
044}
045function exptiff() {
046  var strPath = this.path;
047  if (strPath.indexOf("/Acrobat.com/") !== -1) {
048    throw new Error("エラー:クラウドドキュメントは書き出しできません");
049  }
050  var strSavePath = strPath + '.tiff';
051  this.saveAs({ cPath: strSavePath, bPromptToOverwrite: true, cConvID: 'com.adobe.acrobat.tiff', bCopy: false });
052}
053function exppng() {
054  var strPath = this.path;
055  if (strPath.indexOf("/Acrobat.com/") !== -1) {
056    throw new Error("エラー:クラウドドキュメントは書き出しできません");
057  }
058  var strSavePath = strPath + '.png';
059  this.saveAs({ cPath: strSavePath, bPromptToOverwrite: true, cConvID: 'com.adobe.acrobat.png', bCopy: false });
060}
061function expjpeg() {
062  var strPath = this.path;
063  if (strPath.indexOf("/Acrobat.com/") !== -1) {
064    throw new Error("エラー:クラウドドキュメントは書き出しできません");
065  }
066  var strSavePath = strPath + '.jpeg';
067  this.saveAs({ cPath: strSavePath, bPromptToOverwrite: true, cConvID: 'com.adobe.acrobat.jpeg', bCopy: false });
068}
069function expplaintext() {
070  var strPath = this.path;
071  if (strPath.indexOf("/Acrobat.com/") !== -1) {
072    throw new Error("エラー:クラウドドキュメントは書き出しできません");
073  }
074  var strSavePath = strPath + '.txt';
075  this.saveAs({ cPath: strSavePath, bPromptToOverwrite: true, cConvID: 'com.adobe.acrobat.plain-text', bCopy: false });
076}
077function expaccesstext() {
078  var strPath = this.path;
079  if (strPath.indexOf("/Acrobat.com/") !== -1) {
080    throw new Error("エラー:クラウドドキュメントは書き出しできません");
081  }
082  var strSavePath = strPath + '.txt';
083  this.saveAs({ cPath: strSavePath, bPromptToOverwrite: true, cConvID: 'com.adobe.acrobat.accesstext', bCopy: false });
084}
085function expeps() {
086  var strPath = this.path;
087  if (strPath.indexOf("/Acrobat.com/") !== -1) {
088    throw new Error("エラー:クラウドドキュメントは書き出しできません");
089  }
090  var strSavePath = strPath + '.eps';
091  this.saveAs({ cPath: strSavePath, bPromptToOverwrite: true, cConvID: 'com.adobe.acrobat.eps', bCopy: false });
092}
093//PSだけReaderモードだと描き出せない?
094var expps = app.trustedFunction(function () {
095  var strPath = this.path;
096  if (strPath.indexOf("/Acrobat.com/") !== -1) {
097    throw new Error("エラー:クラウドドキュメントは書き出しできません");
098  }
099  var strSavePath = strPath + '.ps';
100  this.saveAs({ cPath: strSavePath, bPromptToOverwrite: true, cConvID: 'com.adobe.acrobat.ps', bCopy: false });
101});
102
103////////////////メニュー部
104//親メニュー
105var menuParent = "File";
106//サブメニュー宣言
107app.addSubMenu({
108  cName: "addExportSubMenu",
109  cUser: "▼書き出し",
110  cLabel: "書き出し",
111  cTooltext: "書き出し",
112  cParent: menuParent,
113  cEnable: "event.rc = false",
114  cMarked: "event.rc = false",
115  nPos: 20
116});
117//子メニュー
118app.addMenuItem({
119  cName: "expxlsx",
120  cUser: "xlsx(Excel)",
121  cTooltext: "Excelに書き出し",
122  cLabel: "Excelに書き出し",
123  cParent: "addExportSubMenu",
124  cExec: "expxlsx()",
125  cEnable: "event.rc = (event.target != null);",
126  cMarked: "event.rc = false",
127  nPos: 0
128});
129app.addMenuItem({
130  cName: "expptx",
131  cUser: "pptx(PowerPoint)",
132  cTooltext: "PowerPointに書き出し",
133  cLabel: "PowerPointに書き出し",
134  cParent: "addExportSubMenu",
135  cExec: "expptx()",
136  cEnable: "event.rc = (event.target != null);",
137  cMarked: "event.rc = false",
138  nPos: 1
139});
140app.addMenuItem({
141  cName: "expdocx",
142  cUser: "docx(Word)",
143  cTooltext: "Wordに書き出し",
144  cLabel: "Wordに書き出し",
145  cParent: "addExportSubMenu",
146  cExec: "expdocx()",
147  cEnable: "event.rc = (event.target != null);",
148  cMarked: "event.rc = false",
149  nPos: 2
150});
151app.addMenuItem({
152  cName: "exptiff",
153  cUser: "tiff(画像)",
154  cTooltext: "tiffに書き出し",
155  cLabel: "tiffに書き出し",
156  cParent: "addExportSubMenu",
157  cExec: "exptiff()",
158  cEnable: "event.rc = (event.target != null);",
159  cMarked: "event.rc = false",
160  nPos: 3
161});
162app.addMenuItem({
163  cName: "exppng",
164  cUser: "png(画像)",
165  cTooltext: "pngに書き出し",
166  cLabel: "pngに書き出し",
167  cParent: "addExportSubMenu",
168  cExec: "exppng()",
169  cEnable: "event.rc = (event.target != null);",
170  cMarked: "event.rc = false",
171  nPos: 4
172});
173app.addMenuItem({
174  cName: "expeps",
175  cUser: "eps(ファイル)",
176  cTooltext: "epsに書き出し",
177  cLabel: "epsに書き出し",
178  cParent: "addExportSubMenu",
179  cExec: "expeps()",
180  cEnable: "event.rc = (event.target != null);",
181  cMarked: "event.rc = false",
182  nPos: 5
183});
184app.addMenuItem({
185  cName: "expps",
186  cUser: "ps(ファイル)",
187  cTooltext: "psに書き出し",
188  cLabel: "psに書き出し",
189  cParent: "addExportSubMenu",
190  cExec: "expps()",
191  cEnable: "event.rc = (event.target != null);",
192  cMarked: "event.rc = false",
193  nPos: 6
194});
195app.addMenuItem({
196  cName: "expaccesstext",
197  cUser: "accesstext(テキスト)",
198  cTooltext: "accesstextに書き出し",
199  cLabel: "accesstextに書き出し",
200  cParent: "addExportSubMenu",
201  cExec: "expaccesstext()",
202  cEnable: "event.rc = (event.target != null);",
203  cMarked: "event.rc = false",
204  nPos: 7
205});
206app.addMenuItem({
207  cName: "expplaintext",
208  cUser: "plain-text(テキスト)",
209  cTooltext: "plain-textに書き出し",
210  cLabel: "plain-textに書き出し",
211  cParent: "addExportSubMenu",
212  cExec: "expplaintext()",
213  cEnable: "event.rc = (event.target != null);",
214  cMarked: "event.rc = false",
215  nPos: 8
216});
217app.addMenuItem({
218  cName: "exprtf",
219  cUser: "rtf(テキスト)",
220  cTooltext: "rtfに書き出し",
221  cLabel: "rtfに書き出し",
222  cParent: "addExportSubMenu",
223  cExec: "exprtf()",
224  cEnable: "event.rc = (event.target != null);",
225  cMarked: "event.rc = false",
226  nPos: 9
227});
AppleScriptで生成しました

|

[Acrobat JS]メニュー項目 ファイルプロパティ メタ情報削除



ダウンロード - addfiledelallinfo.mac.zip




サンプルコード

サンプルソース(参考)
行番号ソース
001//
002// アドオンツール
003// ファイルメニュー
004// プロパティ ファイル概要全削除 v2
005// UTF16LEで保存してください
006// com.cocolog-nifty.quicktimer.icefloe
007////////////////////////////////////////////////
008
009//////////ファイルメニューを宣言
010menuParent = "File";
011///DCの時はメニューを出す
012if (app.viewerType == "Exchange-Pro") {
013  app.addMenuItem({
014    cName: "appDelAllInfo",
015    cUser: "■プロパティ・メタ削除",
016    cTooltext: "■プロパティ・メタ削除",
017    cLabel: "■プロパティ・メタ削除",
018    cParent: menuParent,
019    cExec: "appDelAllInfo()",
020    cEnable: "event.rc = (event.target != null);",
021    cMarked: "event.rc = false",
022    nPos: 45
023  });
024}
025///リーダーでは利用できない
026if (app.viewerType == "Reader") {
027  app.addMenuItem({
028    cName: "appDelAllInfo",
029    cUser: "【DC機能】プロパティ・メタ削除",
030    cTooltext: "【DC機能】プロパティ・メタ削除",
031    cLabel: "【DC機能】プロパティ・メタ削除",
032    cParent: menuParent,
033    cExec: "appDelAllInfo()",
034    cEnable: "event.rc = false;",
035    cMarked: "event.rc = false",
036    nPos: 45
037  });
038}
039/////////////////////////////addToolButton
040//この項目がアドイン
041if (app.viewerType == "Exchange-Pro") {
042  app.addToolButton({
043    cName: "appDelAllInfo",
044    cUser: "■プロパティ概要削除",
045    cTooltext: "■プロパティ概要削除",
046    cLabel: "■プロパティ概要削除",
047    cParent: menuParent,
048    cExec: "appDelAllInfo()",
049    cEnable: "event.rc = (event.target != null);",
050    cMarked: "event.rc = false",
051    nPos: 0
052  });
053}
054
055//メニュー実行時のファンクション
056//残したい項目は削除すればOK
057var appDelAllInfo = app.trustedFunction(function () {
058  this.info.Author = ("");
059  this.info.Title = ("");
060  this.info.Author = ("");
061  this.info.Subject = ("");
062  this.info.Keywords = ("");
063  this.metadata = ("");
064  this.info.Creator = ("");
065  this.info.Producer = ("");
066  this.info.CreationDate = ("");
067  this.info.ModDate = ("");
068  this.info.Trapped = ("");
069});
AppleScriptで生成しました

|

[JavaScripts]Acrobat ヘルプメニュー拡張(Windows用)修正(ページ回転チェックを追加)



Mac版はこちら
https://quicktimer.cocolog-nifty.com/icefloe/2024/09/post-3c2ab3.html

[JavaScript]Acrobat Javascript基本設定 (Win)も参考にしてください
https://quicktimer.cocolog-nifty.com/icefloe/2024/09/post-e1ed9e.html

ダウンロード - addhelpmenu.win.zip




サンプルコード

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

|

[JavaScripts]Acrobat ヘルプメニュー拡張(Mac専用)修正(ページ回転チェックを追加)



ダウンロード - addhelpmenu.mac.zip




サンプルコード

サンプルソース(参考)
行番号ソース
001////////////////////////////////////////////////
002//  Acrobat Help Menu
003// Mac用 Windowsでは使えません
004// 保存する時は文字コードをUTF-16で保存してください
005// インストール先は
006//  /Users/ユーザー名/Library/Application Support/Adobe/Acrobat/DC/JavaScripts
007// 20240913v4
008//   com.cocolog-nifty.quicktimer.icefloe
009////////////////////////////////////////////////
010menuParent = "Help";
011////////////////////////////////////////////////
012app.addSubMenu({
013  cName: "addHelpSubMenuAdobe",
014  cUser: "▼Adobe関連",
015  cTooltext: "Adobe関連",
016  cParent: menuParent,
017  cEnable: "event.rc = true",
018  cMarked: "event.rc = false",
019  nPos: 5
020});
021app.addSubMenu({
022  cName: "addHelpSubMenuUrl",
023  cUser: "▼開発関連",
024  cTooltext: "ヘルプ関連",
025  cParent: menuParent,
026  cEnable: "event.rc = true",
027  cMarked: "event.rc = false",
028  nPos: 6
029});
030app.addSubMenu({
031  cName: "addHelpSubMenuCon",
032  cUser: "▼コンソール",
033  cTooltext: "コンソール関連",
034  cParent: menuParent,
035  cEnable: "event.rc = true",
036  cMarked: "event.rc = false",
037  nPos: 7
038});
039app.addSubMenu({
040  cName: "addHelpSubMenuSh",
041  cUser: "▼ファイル共有",
042  cTooltext: "ファイル共有",
043  cParent: menuParent,
044  cEnable: "event.rc = true",
045  cMarked: "event.rc = false",
046  nPos: 8
047});
048app.addSubMenu({
049  cName: "addHelpSubMenuOpen",
050  cUser: "▼設定",
051  cTooltext: "設定関連",
052  cParent: menuParent,
053  cEnable: "event.rc = true",
054  cMarked: "event.rc = false",
055  nPos: 9
056});
057////////////////////////////////////////////////
058app.addMenuItem({
059  cName: "OpenURL3",
060  cUser: "■Document Cloud",
061  cParent: "addHelpSubMenuAdobe",
062  cExec: "app.launchURL(\"https://documentcloud.adobe.com/\", true);",
063  nPos: 3
064});
065app.addMenuItem({
066  cName: "OpenURL4",
067  cUser: "■Creative Cloud Assets File",
068  cParent: "addHelpSubMenuAdobe",
069  cExec: "app.launchURL(\"https://assets.adobe.com/files\", true);",
070  nPos: 4
071});
072app.addMenuItem({
073  cName: "OpenURL5",
074  cUser: "■Creative Cloud Assets Libraries",
075  cParent: "addHelpSubMenuAdobe",
076  cExec: "app.launchURL(\"https://assets.adobe.com/libraries\", true);",
077  nPos: 5
078});
079app.addMenuItem({
080  cName: "OpenURL6",
081  cUser: "■Creative Cloud Assets XD",
082  cParent: "addHelpSubMenuAdobe",
083  cExec: "app.launchURL(\"https://assets.adobe.com/cloud-documents\", true);",
084  nPos: 6
085});
086app.addMenuItem({
087  cName: "OpenURL7",
088  cUser: "■Publish Online",
089  cParent: "addHelpSubMenuAdobe",
090  cExec: "app.launchURL(\"https://indd.adobe.com/dashboard\", true);",
091  nPos: 7
092});
093app.addMenuItem({
094  cName: "OpenURL8",
095  cUser: "■Adobe Lightroom Online",
096  cParent: "addHelpSubMenuAdobe",
097  cExec: "app.launchURL(\"https://lightroom.adobe.com/libraries/\", true);",
098  nPos: 8
099});
100app.addMenuItem({
101  cName: "OpenURL9",
102  cUser: "■Adobe Fonts",
103  cParent: "addHelpSubMenuAdobe",
104  cExec: "app.launchURL(\"https://fonts.adobe.com/?locale=ja-JP\", true);",
105  nPos: 9
106});
107app.addMenuItem({
108  cName: "appHelpOpenDocHelpUserGuide",
109  cUser: "■ユーザーガイドを開きます",
110  cLabel: "appHelpOpenGuide",
111  cTooltext: "appHelpOpenGuide",
112  cParent: "addHelpSubMenuAdobe",
113  cExec: "appHelpOpenGuide();",
114  cEnable: "event.rc = true",
115  cMarked: "event.rc = false",
116  nPos: 10,
117});
118app.addMenuItem({
119  cName: "OpenURL16",
120  cUser: "■Acrobatフォーラム",
121  cParent: "addHelpSubMenuAdobe",
122  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);",
123  nPos: 11
124});
125app.addMenuItem({
126  cName: "OpenURL17",
127  cUser: "■Acrobat Readerフォーラム",
128  cParent: "addHelpSubMenuAdobe",
129  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);",
130  nPos: 12
131});
132////////////////////////////////////////////
133app.addMenuItem({
134  cName: "OpenURL1",
135  cUser: "リリースノート",
136  cParent: "addHelpSubMenuUrl",
137  cExec: "app.launchURL(\"https://www.adobe.com/devnet-docs/acrobatetk/tools/ReleaseNotesDC/index.html\", true);",
138  nPos: 1
139});
140app.addMenuItem({
141  cName: "OpenURL2",
142  cUser: "Acrobat DC SDK Documentation",
143  cParent: "addHelpSubMenuUrl",
144  cExec: "app.launchURL(\"https://opensource.adobe.com/dc-acrobat-sdk-docs/acrobatsdk/\", true);",
145  nPos: 2
146});
147app.addMenuItem({
148  cName: "OpenURL10",
149  cUser: "JavaScript API",
150  cParent: "addHelpSubMenuUrl",
151  cExec: "app.launchURL(\"https://opensource.adobe.com/dc-acrobat-sdk-docs/library/jsapiref/JS_API_AcroJS.html\", true);",
152  nPos: 10
153});
154app.addMenuItem({
155  cName: "OpenURL11",
156  cUser: "Document Services API",
157  cParent: "addHelpSubMenuUrl",
158  cExec: "app.launchURL(\"https://documentcloud.adobe.com/dc-integration-creation-app-cdn/main.html\", true);",
159  nPos: 11
160});
161app.addMenuItem({
162  cName: "OpenURL12",
163  cUser: "PDF Embed API",
164  cParent: "addHelpSubMenuUrl",
165  cExec: "app.launchURL(\"https://developer.adobe.com/document-services/docs/overview/pdf-embed-api/\", true);",
166  nPos: 12
167});
168app.addMenuItem({
169  cName: "OpenURL13",
170  cUser: "AdminConsole",
171  cParent: "addHelpSubMenuUrl",
172  cExec: "app.launchURL(\"https://adminconsole.adobe.com/\", true);",
173  nPos: 13
174});
175app.addMenuItem({
176  cName: "appHelpOpenTrustedMenu",
177  cUser: "API ReferencePDFを開く",
178  cLabel: "appHelpOpenTrustedMenu",
179  cTooltext: "appHelpOpenTrustedMenu",
180  cParent: "addHelpSubMenuUrl",
181  cExec: "appHelpOpenTrustedMenu();",
182  cEnable: "event.rc = true",
183  cMarked: "event.rc = false",
184  nPos: 14
185});
186app.addMenuItem({
187  cName: "OpenURL15",
188  cUser: "Adobe Dev SDK",
189  cParent: "addHelpSubMenuUrl",
190  cExec: "app.launchURL(\"https://developer.adobe.com/console/servicesandapis\", true);",
191  nPos: 15
192});
193
194app.addMenuItem({
195  cName: "OpenURL18",
196  cUser: "PrefRef Mac",
197  cParent: "addHelpSubMenuUrl",
198  cExec: "app.launchURL(\"https://www.adobe.com/devnet-docs/acrobatetk/tools/PrefRef/Macintosh/index.html\", true);",
199  nPos: 18
200});
201
202app.addMenuItem({
203  cName: "OpenURL19",
204  cUser: "PrefRef Win",
205  cParent: "addHelpSubMenuUrl",
206  cExec: "app.launchURL(\"https://www.adobe.com/devnet-docs/acrobatetk/tools/PrefRef/Windows/index.html\", true);",
207  nPos: 19
208});
209
210
211////////////////////////////////////////////////////////////////////////
212app.addMenuItem({
213  cName: "appHelpSubPrefOpen",
214  cUser: "環境設定パネルを開きます",
215  cLabel: "環境設定パネルを開きます",
216  cTooltext: "環境設定パネルを開きます",
217  cParent: "addHelpSubMenuOpen",
218  cExec: "appHelpAddPrintList();",
219  cEnable: "event.rc = true",
220  cMarked: "event.rc = false",
221  nPos: 22,
222});
223app.addMenuItem({
224  cName: "OpenURL23",
225  cUser: "JavaScripts フォルダを開きます",
226  cParent: "addHelpSubMenuOpen",
227  cExec: "appGetJavascriptPath()",
228  nPos: 23
229});
230function appGetJavascriptPath() {
231  try {
232    var strUserJavascriptDir = app.getPath("user", "javascript");
233    var strFilePath = strUserJavascriptDir.replace(/^.*Users/, '/Users');
234    app.launchURL("file://"