├── README.md └── Launch Pad.jsx /README.md: -------------------------------------------------------------------------------- 1 | > The unofficial script launcher for Adobe(R) After Effects(R) 2 | CS4 or later. Use at your own risk. Brought to you by Jeff (@redefinery) 3 | of the After Effects crew 4 | 5 | ![image](http://tva2.sinaimg.cn/large/66e22e28gy1fpi9aqvkp9j20aw0793ym.jpg) 6 | 7 | 2018-03-19: 8 | fixing a mess order problem on macOS 9 | 10 | `Copyright (c) 2007-2014 Adobe Systems, Incorporated. All rights reserved.` 11 | -------------------------------------------------------------------------------- /Launch Pad.jsx: -------------------------------------------------------------------------------- 1 | { 2 | // Launch Pad.jsx 3 | // Copyright (c) 2007-2014 Adobe Systems, Incorporated. All rights reserved. 4 | // 5 | // The unofficial script launcher for Adobe(R) After Effects(R) 6 | // CS4 or later. Use at your own risk. Brought to you by Jeff 7 | // of the After Effects crew. 8 | // 9 | // Notes: 10 | // This launcher creates buttons for all .jsx and .jsxbin script 11 | // files located in the selected scripts folder, which you can 12 | // change by clicking the '...' button; subfolders are not 13 | // scanned. If you place a 30x30 or smaller PNG file in the 14 | // same folder and with the same base name as the script 15 | // (just with a .png extension, e.g., KeyEd Up.png for the 16 | // KeyEd Up.jsx script), the PNG file will be used as an icon 17 | // button instead. Good stuff. 18 | // 19 | // You can use this script launcher as a dockable panel by 20 | // placing it in a ScriptUI Panels subfolder of the Scripts 21 | // folder, and then choosing the Launch Pad.jsx script from 22 | // the Window menu. Even more good stuff. 23 | //** add sort() after getFiles(launchPad_filterJSXFiles) to fix mess order on macOS 24 | //** by songz 25 | //** 2018/03/19. 26 | 27 | 28 | function LaunchPad(thisObj) 29 | { 30 | var launchPadData = new Object(); 31 | launchPadData.scriptName = "Launch Pad"; 32 | launchPadData.version = "1.2.1"; 33 | 34 | launchPadData.strSettings = "..."; 35 | launchPadData.strSettingsTip = "Settings"; 36 | launchPadData.strHelp = "?"; 37 | launchPadData.strHelpTip = "Help"; 38 | launchPadData.settingsTitle = launchPadData.scriptName + " Settings"; 39 | launchPadData.settingsScripts = "Scripts (listed in order of appearance):" 40 | launchPadData.strSelScriptsFolder = "Select the scripts folder to use"; 41 | launchPadData.strAboutTitle = "About " + launchPadData.scriptName; 42 | launchPadData.strAbout = launchPadData.scriptName + " " + launchPadData.version + "\n" + 43 | "Copyright (c) 2007-2014 Adobe Systems, Incorporated. All rights reserved.\n" + 44 | "\n" + 45 | "The unofficial script launcher for Adobe(R) After Effects(R) CS4 or later. Use at your own risk. Brought to you by Jeff of the After Effects crew.\n" + 46 | "\n" + 47 | "Notes:\n" + 48 | "This launcher creates buttons for all .jsx and .jsxbin script files located in the selected scripts folder, which you can change by clicking the '...' button; subfolders are not scanned. If you place a 30x30 or smaller PNG file in the same folder and with the same base name as the script (just with a .png extension, e.g., KeyEd Up.png for the KeyEd Up.jsx script), the PNG file will be used as an icon button instead. Good stuff.\n" + 49 | "\n" + 50 | "You can use this script launcher as a dockable panel by placing it in a ScriptUI Panels subfolder of the Scripts folder, and then choosing the Launch Pad.jsx script from the Window menu. Even more good stuff."; 51 | launchPadData.strRefreshPanel = "Please close and then reopen Launch Pad to refresh the panel's script buttons."; 52 | launchPadData.strErrCantLaunchScript = "Could not launch script '%s' because it no longer exists on disk." 53 | launchPadData.strErrMinAE90 = "This script requires Adobe After Effects CS4 or later."; 54 | 55 | launchPadData.btnSize = 36; 56 | 57 | 58 | // launchPad_buildUI() 59 | // Function for creating the user interface 60 | function launchPad_buildUI(thisObj) 61 | { 62 | var pal = (thisObj instanceof Panel) ? thisObj : new Window("palette", launchPadData.scriptName, [200, 200, 600, 500], {resizeable: true}); 63 | 64 | if (pal != null) 65 | { 66 | pal.bounds.width = (launchPadData.btnSize+5)*10 + 5; 67 | pal.bounds.height = (launchPadData.btnSize+5)*1 + 5; 68 | 69 | pal.scriptBtns = null; 70 | launchPad_rebuildButtons(pal); 71 | 72 | pal.onResize = launchPad_doResizePanel; 73 | pal.onResizing = launchPad_doResizePanel; 74 | } 75 | 76 | return pal; 77 | } 78 | 79 | 80 | // launchPad_filterJSXFiles() 81 | // Function for filtering .jsx files that are not the current file. Used with the Folder.getFiles() function. 82 | function launchPad_filterJSXFiles(file) 83 | { 84 | return ((file.name.match(/.jsx(bin)?$/) != null) && (file.name != (new File($.fileName)).name)); 85 | } 86 | 87 | 88 | // launchPad_rebuildButtons() 89 | // Function for creating/recreating the button layout 90 | function launchPad_rebuildButtons(palObj) 91 | { 92 | var topEdge = 4; 93 | var leftEdge = 4; 94 | var btnSize = launchPadData.btnSize; 95 | var btnIconFile, defBtnIconFile; 96 | 97 | // Remove the existing buttons (all of them) 98 | if (palObj.btnGroup != undefined) 99 | { 100 | while (palObj.btnGroup.children.length > 0) 101 | palObj.btnGroup.remove(0); 102 | palObj.remove(0); 103 | } 104 | 105 | // Add buttons for scripts 106 | //alert("Folder.current = "+launchPadData.thisScriptsFolder.toString()); 107 | defBtnIconFile = new File(launchPadData.thisScriptsFolder.fsName + "/Launch Pad_jsx-icon.png"); 108 | if (!defBtnIconFile.exists) 109 | defBtnIconFile = null; 110 | 111 | palObj.scriptBtns = undefined; 112 | palObj.scriptBtns = new Array(); 113 | 114 | // Place controls in a group container to get the panel background love 115 | palObj.btnGroup = palObj.add("group", [0, 0, palObj.bounds.width, palObj.bounds.height]); 116 | 117 | for (var i=0; i maxRightEdge) 216 | { 217 | leftEdge = 5; 218 | topEdge += btnOffset; 219 | } 220 | } 221 | 222 | // The settings and help buttons go into the next "slot" 223 | launchPadPal.settingsBtn.bounds = [leftEdge, topEdge, leftEdge+btnSize, topEdge+btnSize/2]; 224 | launchPadPal.helpBtn.bounds = [leftEdge, topEdge+btnSize/2, leftEdge+btnSize, topEdge+btnSize]; 225 | } 226 | 227 | 228 | // main: 229 | // 230 | 231 | if (parseFloat(app.version) < 9) 232 | { 233 | alert(launchPadData.strErrMinAE90, launchPadData.scriptName); 234 | return; 235 | } 236 | else 237 | { 238 | // Keep track of this script's folder so we know where to find the icons used by the script 239 | launchPadData.thisScriptsFolder = new Folder((new File($.fileName)).path); 240 | 241 | // Use the last defined script folder, or ask the user for one (if not previously defined) 242 | launchPadData.scripts = new Array(); 243 | if (app.settings.haveSetting("Adobe", "launchPad_scriptsFolder")) 244 | { 245 | launchPadData.scriptsFolder = new Folder(app.settings.getSetting("Adobe", "launchPad_scriptsFolder").toString()); 246 | if ((launchPadData.scriptsFolder != null) && launchPadData.scriptsFolder.exists) 247 | launchPadData.scripts = launchPadData.scriptsFolder.getFiles(launchPad_filterJSXFiles).sort(); 248 | } 249 | else 250 | { 251 | launchPadData.scriptsFolder = Folder.selectDialog(launchPadData.strSelScriptsFolder, new Folder(Folder.startup.fsName + "/Scripts/")); 252 | if ((launchPadData.scriptsFolder != null) && launchPadData.scriptsFolder.exists) 253 | { 254 | launchPadData.scripts = launchPadData.scriptsFolder.getFiles(launchPad_filterJSXFiles).sort(); 255 | 256 | // Remember the scripts folder for the next session 257 | app.settings.saveSetting("Adobe", "launchPad_scriptsFolder", launchPadData.scriptsFolder.fsName); 258 | } 259 | } 260 | 261 | // Build and show the UI 262 | var launchPadPal = launchPad_buildUI(thisObj); 263 | if (launchPadPal != null) 264 | { 265 | if (launchPadPal instanceof Window) 266 | { 267 | // Center the palette 268 | launchPadPal.center(); 269 | 270 | // Show the UI 271 | launchPadPal.show(); 272 | } 273 | else 274 | launchPad_doResizePanel(); 275 | } 276 | } 277 | } 278 | 279 | 280 | LaunchPad(this); 281 | } --------------------------------------------------------------------------------