/** * @@@BUILDINFO@@@ fixAICS3PDFSize.jsx !Version! Tue Aug 07 2007 17:12:19 GMT+0900 */ /********************************************************** ADOBE SYSTEMS INCORPORATED Copyright 2005-2006 Adobe Systems Incorporated All Rights Reserved NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms of the Adobe license agreement accompanying it. If you have received this file from a source other than Adobe, then your use, modification, or distribution of it requires the prior written permission of Adobe. *********************************************************/ /********************************************************** fixAICS3PDFSize.jsx DESCRIPTION This is a script for solving known issue which is, "File size is same even though Create PDF Compatible file" option is checked off when saving. #1570652 **********************************************************/ $.level = 0; var e; var errFlg = false; var osx; var folder; var xfiles; var applPathName; var release = false; // true: release mode, false: undo for Debug or back to original for updater if(release){ // ファイル名を変更するペア。["元ファイル名","変更ファイル名"]。複数可。 var renamePlgFiles = [["PDF メッセージ.ai","PDFMessage.ai"]]; // "プラグイン"フォルダーの中 var renameReqFiles = [["PDF メッセージ.ai","PDFMessage.ai"], ["PDF 形式.aip","PDFFormat.aip"],["PDF セット.aip","PDFSet.aip"]]; // "Required"フォルダーの中 } else { /* For Debug */ // ファイル名を変更するペア。["元ファイル名","変更ファイル名"]。複数可。 var renamePlgFiles = [["PDFMessage.ai","PDF メッセージ.ai"]]; // "プラグイン"フォルダーの中 var renameReqFiles = [["PDFMessage.ai","PDF メッセージ.ai"], ["PDFFormat.aip","PDF 形式.aip"],["PDFSet.aip","PDF セット.aip"]]; // "Required"フォルダーの中 } function renameFiles(aFiles){ var srcFile; var dstFile; var ret; for(var i=0; i < aFiles.length; i++){ srcFile = new File(folder + "/" + aFiles[i][0]); dstFile = new File(folder + "/" + aFiles[i][1]); if (srcFile.exists && !dstFile.exists) { // OK! do it ret = srcFile.rename(aFiles[i][1]); if(ret) continue; alert("\"" + folder.fsName + "\"にある\"" +srcFile.displayName + "\"の名前を\"" + dstFile.displayName + "\"に変更することができません。\n手作業で変更するか或いはUACを無効化してからこのスクリプトを実行してください。"); errFlg = true; } else if (!srcFile.exists && dstFile.exists) { throw("alreadyDone"); } else { throw("badFiles"); } } } try{ if( !release ) alert("Adobe Illustrator CS3 のアップデートを行えるようにするためにファイル名を元に戻します。"); // Mac or Win osx = (($.os).search("Macintosh") == 0)? true: false; folder = new Folder(); // AI Installed? folder.changePath ("/C/Program Files/Adobe/Adobe Illustrator CS3"); // Win? xfiles = folder.getFiles("プラグイン"); if (xfiles.length == 0) { folder.changePath("/Applications/Adobe Illustrator CS3"); //Mac? xfiles = folder.getFiles("Plug-ins.localized"); while (xfiles.length == 0) { // Ask user which folder AI installed if((folder = Folder.selectDialog ("Adobe Illustrator CS3 をインストールしてある フォルダーを指定してください。"))== null){ throw("cancel"); } // check folder exist or not xfiles = (osx)? folder.getFiles("Plug-ins.localized"): folder.getFiles("プラグイン"); if (xfiles.length == 0){ alert("このフォルダーではありません。別のフォルダーを指定してください。"); } } } // Now, we are at AI Application folder applPathName = folder; if (osx) { //for files in プラグイン folder folder.changePath("Plug-ins.localized"); renameFiles(renamePlgFiles); // for files in Required folder folder.changePath("../Adobe Illustrator.app/Required"); renameFiles(renameReqFiles); } else { // for files in プラグイン folder folder.changePath("プラグイン"); renameFiles(renamePlgFiles); // for files in Required folder folder.changePath("../Support Files/Required"); renameFiles(renameReqFiles); } if ( !errFlg ){ if( !release ){ alert("ファイル名を元に戻しました。\nAdobe Illustrator CS3をアップデートしてください。"); } else { alert("変更は無事に終了しました。ご迷惑をおかけしました。\nAdobe Illustrator CS3を起動している場合は一度終了してください。"); } } } catch(e){ var msg; switch(e){ case "cancel": msg = "処理を中断して実行を終了します。"; break; case "alreadyDone": msg = "変更は不要です。既に対応されているので終了します。"; break; case "badFiles": msg = "ファイルの構成に誤りがあります。再インストールをお薦めします。"; break; default: msg = "エラーが発生しました:" + e; } alert(msg); }