├── CEP_7_Extensions_Cookbook_Bridge.pdf ├── JSX Utility Scripts ├── ActionFileToJavascript.jsx ├── ActionFileToXML.jsx ├── ActionToJavascript.jsx ├── SLCFix.jsx ├── jamEngine Action to JSX │ ├── Convert Actions File.js │ ├── jamActions-min.jsxinc │ ├── jamEngine-min.jsxinc │ ├── jamJSON-min.jsxinc │ └── jamUtils-min.jsxinc └── jsh.jsx ├── README.md ├── ScriptingListener ├── Scripting_Plug_In_Release.dmg └── Win_Scripting_Plug-In.zip ├── Spectrum UI Library ├── CSS │ ├── styles-dark.css │ ├── styles-darker.css │ ├── styles-light.css │ └── styles-lighter.css └── JS │ └── themecolors.js └── Topcoat UI Library ├── CSS ├── topcoat-desktop-dark.css ├── topcoat-desktop-dark.min.css ├── topcoat-desktop-light.css └── topcoat-desktop-light.min.css └── JS └── themeManager.js /CEP_7_Extensions_Cookbook_Bridge.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hennamann/CEP-Toolkit/003ff3e562db1e8693461cac93f94c119ddad0b3/CEP_7_Extensions_Cookbook_Bridge.pdf -------------------------------------------------------------------------------- /JSX Utility Scripts/jamEngine Action to JSX/Convert Actions File.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | 4 | Convert Actions File... 5 | "Convert Actions File" v2.1 6 | 7 | Convert an actions file (.atn) into a folder of directly executable scripts (.js) which can be further edited. 8 | 9 | Utility script using the "JSON Action Manager" scripting library. 10 | © 2011-2015 Michel MARIANI. 11 | 12 | automate 13 | JSON Action Manager Actions Files Utility 14 | 15 | 16 | */ 17 | 18 | //------------------------------------------------------------------------------ 19 | // File: Convert Actions File.js 20 | // Version: 2.1 21 | // Release Date: 2015-11-22 22 | // Copyright: © 2011-2015 Michel MARIANI 23 | // Licence: GPL 24 | //------------------------------------------------------------------------------ 25 | // This program is free software: you can redistribute it and/or modify 26 | // it under the terms of the GNU General Public License as published by 27 | // the Free Software Foundation, either version 3 of the License, or 28 | // (at your option) any later version. 29 | // 30 | // This program is distributed in the hope that it will be useful, 31 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 32 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 33 | // GNU General Public License for more details. 34 | // 35 | // You should have received a copy of the GNU General Public License 36 | // along with this program. If not, see . 37 | //------------------------------------------------------------------------------ 38 | // Version History: 39 | // 2.1: 40 | // - Used new version 4.4.4 of jamEngine scripting library module. 41 | // 2.0: 42 | // - Used new version 4.4.1 of scripting library modules. 43 | // 1.9: 44 | // - Used new version 4.4 of scripting library modules. 45 | // 1.8: 46 | // - Replaced decodeURI () with File.decode () for the sake of consistency. 47 | // - Used new version 4.1 of jamActions scripting library module. 48 | // - Added test for successful opening of output files. 49 | // 1.7: 50 | // - Used new version 4.0 of scripting library modules. 51 | // 1.6: 52 | // - Used new version of jamEngine module. 53 | // 1.5: 54 | // - Replaced \r with \n in dialog text area. 55 | // 1.4: 56 | // - Used new version of scripting library modules. 57 | // 1.3: 58 | // - Used new version of scripting library modules. 59 | // 1.2: 60 | // - Removed the choice of not using a UTF-8 BOM. 61 | // 1.1: 62 | // - Added 'TEXT' Mac OS type to newly created JavaScript code files. 63 | // 1.0: 64 | // - Initial release. 65 | //------------------------------------------------------------------------------ 66 | 67 | //@include "./jamActions-min.jsxinc" 68 | //@include "./jamEngine-min.jsxinc" 69 | //@include "./jamJSON-min.jsxinc" 70 | //@include "./jamUtils-min.jsxinc" 71 | 72 | //------------------------------------------------------------------------------ 73 | 74 | var signature = "json-action-manager-convert-actions-file-options"; 75 | 76 | var defaultFolderName = "~/Desktop/"; 77 | 78 | var defaultOptions = 79 | { 80 | actionsFileName: null, 81 | allCommands: false, 82 | meaningfulIds: false, 83 | parseFriendly: false, 84 | expandTabs: false, 85 | destinationName: defaultFolderName, 86 | openFolder: false 87 | }; 88 | 89 | var actionsFile = null; 90 | var actionSet = null; 91 | var destination = null; 92 | 93 | //------------------------------------------------------------------------------ 94 | 95 | var playFunctionCall = 'jamEngine.jsonPlay'; 96 | var meaningfulIdsOption = 'jamEngine.meaningfulIds'; 97 | var parseFriendlyOption = 'jamEngine.parseFriendly'; 98 | 99 | //------------------------------------------------------------------------------ 100 | 101 | function ISODateString (d, fsSafe) 102 | { 103 | const dateSeparator = '-'; 104 | const timeDesignator = (fsSafe) ? '-' : 'T'; 105 | const timeSeparator = (fsSafe) ? '' : ':'; 106 | function pad (n) { return (n < 10) ? '0' + n : n; } 107 | var minutesOff = -d.getTimezoneOffset (); 108 | var isMinus = (minutesOff < 0); 109 | if (isMinus) 110 | { 111 | minutesOff = -minutesOff; 112 | } 113 | var dateString = 114 | d.getFullYear () + dateSeparator + pad (d.getMonth () + 1) + dateSeparator + pad (d.getDate ()) + 115 | timeDesignator + 116 | pad (d.getHours ()) + timeSeparator + pad (d.getMinutes ()) + timeSeparator + pad (d.getSeconds ()) + 117 | ((fsSafe) ? '' : ((isMinus) ? '-' : '+') + pad (minutesOff / 60) + timeSeparator + pad (minutesOff % 60)); 118 | return dateString; 119 | } 120 | 121 | //------------------------------------------------------------------------------ 122 | 123 | function embedIncludeFile (f, fileName) 124 | { 125 | var saveCurrent = Folder.current; 126 | Folder.current = (new File ($.fileName)).parent; 127 | var includeFile = new File (fileName); 128 | if (includeFile.open ("r")) 129 | { 130 | f.write (includeFile.read ()); 131 | includeFile.close (); 132 | } 133 | Folder.current = saveCurrent; 134 | } 135 | 136 | //------------------------------------------------------------------------------ 137 | 138 | function displayDialog () 139 | { 140 | function updateDialog () 141 | { 142 | if (actionSet === null) 143 | { 144 | dialog.fileName.text = ""; 145 | dialog.fileName.helpTip = "Click the Choose... button"; 146 | dialog.fileName.enabled = false; 147 | dialog.actionSetName.text = ""; 148 | dialog.actionNames.text = ""; 149 | okButton.enabled = false; 150 | } 151 | else 152 | { 153 | dialog.fileName.enabled = true; 154 | dialog.fileName.text = File.decode (actionsFile.name); 155 | dialog.fileName.helpTip = actionsFile.fsName; 156 | dialog.actionSetName.text = actionSet.name; 157 | var actions = actionSet.actions; 158 | dialog.actionNames.text = ""; 159 | for (var actionIndex = 0; actionIndex < actions.length; actionIndex++) 160 | { 161 | dialog.actionNames.text += (actionIndex > 0 ? "\n" : "") + actions[actionIndex].name; 162 | } 163 | okButton.enabled = true; 164 | } 165 | } 166 | var dialog = new Window ('dialog', "Convert Actions File"); 167 | dialog.orientation = "column"; 168 | var fileGroup = dialog.add ('group'); 169 | fileGroup.alignment = "left"; 170 | fileGroup.orientation = "row"; 171 | fileGroup.alignChildren = [ "fill", "center" ]; 172 | fileGroup.add ('statictext', undefined, "Actions File:"); 173 | dialog.fileName = fileGroup.add ('edittext', undefined, "", { readonly: true }); 174 | dialog.fileName.characters = 32; 175 | var chooseFileButton = fileGroup.add ('button', undefined, "Choose..."); 176 | chooseFileButton.helpTip = "Choose an actions file"; 177 | chooseFileButton.onClick = function () 178 | { 179 | function actionsFileFilter (f) 180 | { 181 | return (f instanceof Folder) || jamActions.isActionsFile (f); 182 | } 183 | var select = (File.fs === "Macintosh") ? actionsFileFilter : "Actions Files:*.atn,All Files:*"; 184 | var presetFile = (actionsFile !== null) ? actionsFile : new Folder (defaultFolderName); 185 | var inFile = presetFile.openDlg ("Choose an actions file:", select); 186 | if (inFile !== null) 187 | { 188 | var inFileData = jamActions.dataFromActionsFile (inFile); 189 | if (typeof inFileData === 'string') 190 | { 191 | alert (inFileData + "\n" + "Actions file: “" + File.decode (inFile.name) + "”"); 192 | } 193 | else 194 | { 195 | actionsFile = inFile; 196 | actionSet = inFileData.actionSet; 197 | updateDialog (); 198 | } 199 | } 200 | }; 201 | var actionSetGroup = dialog.add ('group'); 202 | actionSetGroup.alignment = "fill"; 203 | actionSetGroup.orientation = "row"; 204 | actionSetGroup.add ('statictext', undefined, "Action Set:"); 205 | dialog.actionSetName = actionSetGroup.add ('edittext', undefined, "", { readonly: true }); 206 | dialog.actionSetName.alignment = [ "fill", "center" ]; 207 | var actionGroup = dialog.add ('group'); 208 | actionGroup.alignment = "fill"; 209 | actionGroup.orientation = "row"; 210 | actionGroup.alignChildren = [ "left", "center" ]; 211 | actionGroup.add ('statictext', undefined, "Actions:"); 212 | dialog.actionNames = actionGroup.add ('edittext', undefined, "", { readonly: true, multiline: true }); 213 | dialog.actionNames.alignment = [ "fill", "center" ]; 214 | dialog.actionNames.text = "\n\n\n\n\n\n\n\n"; // Placeholder (8 lines) 215 | var optionsGroup = dialog.add ('group'); 216 | optionsGroup.orientation = "row"; 217 | optionsGroup.alignment = [ "left", "center" ]; 218 | dialog.allCommandsCheck = optionsGroup.add ('checkbox', undefined, 'All Commands'); 219 | dialog.allCommandsCheck.helpTip = "Generate all commands, even when disabled (using a boolean test)"; 220 | dialog.meaningfulIdsCheck = optionsGroup.add ('checkbox', undefined, 'Meaningful IDs'); 221 | dialog.meaningfulIdsCheck.helpTip = "Generate as meaningful as possible IDs (instead of canonic IDs)"; 222 | dialog.parseFriendlyCheck = optionsGroup.add ('checkbox', undefined, 'Parse-Friendly'); 223 | dialog.parseFriendlyCheck.helpTip = "Generate parse-friendly JSON compact format (using ordered pairs made of arrays instead of objects)"; 224 | dialog.expandTabsCheck = optionsGroup.add ('checkbox', undefined, 'Expand Tabs'); 225 | dialog.expandTabsCheck.helpTip = "Use tab expansion (convert tabs to 4 spaces)"; 226 | var destinationGroup = dialog.add ('group'); 227 | destinationGroup.alignment = "left"; 228 | destinationGroup.orientation = "row"; 229 | destinationGroup.alignChildren = [ "fill", "center" ]; 230 | destinationGroup.add ('statictext', undefined, "Destination:"); 231 | dialog.destination = destinationGroup.add ('edittext', undefined, "", { readonly: true }); 232 | dialog.destination.characters = 32; 233 | var chooseDestinationButton = destinationGroup.add ('button', undefined, "Choose..."); 234 | chooseDestinationButton.helpTip = "Choose a destination folder"; 235 | chooseDestinationButton.onClick = function () 236 | { 237 | var presetFolder = destination.exists ? destination : ( destination.parent.exists ? destination.parent : new Folder (defaultFolderName)); 238 | var inFolder = presetFolder.selectDlg ("Choose a destination folder:"); 239 | if (inFolder !== null) 240 | { 241 | destination = inFolder; 242 | dialog.destination.text = File.decode (destination.name); 243 | dialog.destination.helpTip = destination.fsName; 244 | } 245 | }; 246 | dialog.openFolderCheck = dialog.add ('checkbox', undefined, 'Open containing folder'); 247 | dialog.openFolderCheck.helpTip = "Automatically open the resulting action set folder containing the converted actions"; 248 | dialog.openFolderCheck.alignment = "right"; 249 | var buttonsGroup = dialog.add ('group'); 250 | buttonsGroup.alignment = [ "right", "bottom" ]; 251 | buttonsGroup.orientation = "row"; 252 | buttonsGroup.alignChildren = "fill"; 253 | var cancelButton = buttonsGroup.add ('button', undefined, 'Cancel', { name: "cancel" }); 254 | cancelButton.onClick = function () 255 | { 256 | dialog.close (false); 257 | }; 258 | var okButton = buttonsGroup.add ('button', undefined, 'Convert', { name: "ok" }); 259 | okButton.onClick = function () 260 | { 261 | if (!destination.exists) 262 | { 263 | alert ("Please choose a valid destination folder."); 264 | } 265 | else 266 | { 267 | customOptions.actionsFileName = (actionsFile !== null) ? actionsFile.fsName : null; 268 | customOptions.allCommands = dialog.allCommandsCheck.value; 269 | customOptions.meaningfulIds = dialog.meaningfulIdsCheck.value; 270 | customOptions.parseFriendly = dialog.parseFriendlyCheck.value; 271 | customOptions.expandTabs = dialog.expandTabsCheck.value; 272 | customOptions.destinationName = destination.fsName; 273 | customOptions.openFolder = dialog.openFolderCheck.value; 274 | dialog.close (true); 275 | } 276 | }; 277 | dialog.onShow = function () 278 | { 279 | if (customOptions.actionsFileName) 280 | { 281 | var inFile = new File (customOptions.actionsFileName); 282 | if (inFile.exists && jamActions.isActionsFile (inFile)) 283 | { 284 | var inFileData = jamActions.dataFromActionsFile (inFile); 285 | if (typeof inFileData === 'string') 286 | { 287 | alert (inFileData + "\n" + "Actions file: “" + File.decode (inFile.name) + "”"); 288 | } 289 | else 290 | { 291 | actionsFile = inFile; 292 | actionSet = inFileData.actionSet; 293 | } 294 | } 295 | } 296 | updateDialog (); 297 | dialog.allCommandsCheck.value = customOptions.allCommands; 298 | dialog.meaningfulIdsCheck.value = customOptions.meaningfulIds; 299 | dialog.parseFriendlyCheck.value = customOptions.parseFriendly; 300 | dialog.expandTabsCheck.value = customOptions.expandTabs; 301 | destination = Folder (customOptions.destinationName); // *Not* new Folder, to check if it is an existing File 302 | if (destination.exists && (destination instanceof File)) 303 | { 304 | alert ("Invalid destination!\nReverting to default folder..."); 305 | destination = new Folder (defaultFolderName); 306 | } 307 | dialog.destination.text = File.decode (destination.name); 308 | dialog.destination.helpTip = destination.fsName; 309 | dialog.openFolderCheck.value = customOptions.openFolder; 310 | }; 311 | return dialog.show (); 312 | } 313 | 314 | //------------------------------------------------------------------------------ 315 | 316 | // Assume Folder.current is already set to a proper location 317 | function getUniqueNameFile (name, versionSeparator, extensionSuffix) 318 | { 319 | var fileName = name.replace (/^[\.\s]+|[\s]+$/g, ''); // Strip leading dot(s), and leading and trailing space(s) 320 | fileName = fileName.replace (/["\*\/:<>\?\\\|¨]/g, '-'); // Replace file-system-unsafe characters with a hyphen-minus 321 | var versionIndex = 0; 322 | do 323 | { 324 | if (extensionSuffix) 325 | { 326 | var file = new File (fileName + ((versionIndex > 0) ? versionSeparator + versionIndex : "") + extensionSuffix); 327 | } 328 | else 329 | { 330 | var file = new Folder (fileName + ((versionIndex > 0) ? versionSeparator + versionIndex : "")); 331 | } 332 | versionIndex++; 333 | } 334 | while (file.exists); 335 | return file; 336 | } 337 | 338 | //------------------------------------------------------------------------------ 339 | 340 | var appVersion = parseInt (app.version); 341 | if (appVersion >= 10) // CS3 342 | { 343 | var customOptions = jamUtils.getCustomOptions (signature, defaultOptions); 344 | if (displayDialog ()) 345 | { 346 | jamUtils.putCustomOptions (signature, customOptions, true); 347 | var tab = (customOptions.expandTabs) ? ' ' : '\t'; 348 | var indentLevel = 0; 349 | function tabs () 350 | { 351 | var tabsString = ""; 352 | for (var index = 0; index < indentLevel; index++) 353 | { 354 | tabsString += tab; 355 | } 356 | return tabsString; 357 | } 358 | Folder.current = destination; 359 | var actionSetFolder = getUniqueNameFile (actionSet.name, ' '); 360 | if (actionSetFolder.create ()) 361 | { 362 | Folder.current = actionSetFolder; 363 | for (var actionIndex = 0; actionIndex < actionSet.actions.length; actionIndex++) 364 | { 365 | var action = actionSet.actions[actionIndex]; 366 | var f = getUniqueNameFile (action.name, '-', '.js'); 367 | if (f.open ('w', 'TEXT')) 368 | { 369 | f.encoding = 'UTF-8'; 370 | f.lineFeed = 'unix'; 371 | f.write ('\uFEFF'); // Byte Order Mark 372 | var appName = app.path.fsName; 373 | f.writeln ('// Application: ' + appName.substring (appName.lastIndexOf ('/') + 1) + ' (' + app.version + ')'); 374 | f.writeln ('// Date: ' + ISODateString (new Date ())); 375 | f.writeln ('// Actions file: ' + actionsFile.fsName); 376 | f.writeln ('// Action set: ' + actionSet.name); 377 | f.writeln (); 378 | embedIncludeFile (f, "jamEngine-min.jsxinc"); 379 | f.writeln (); 380 | jamEngine.meaningfulIds = customOptions.meaningfulIds; 381 | jamEngine.parseFriendly = customOptions.parseFriendly; 382 | f.writeln (meaningfulIdsOption + ' = ' + (jamEngine.meaningfulIds ? 'true' : 'false') + ';'); 383 | f.writeln (parseFriendlyOption + ' = ' + (jamEngine.parseFriendly ? 'true' : 'false') + ';'); 384 | f.writeln (); 385 | f.writeln ('// Action “' + action.name + '”'); 386 | f.writeln ('try'); 387 | f.writeln ('{'); 388 | indentLevel++; 389 | function logCommand (command) 390 | { 391 | if (customOptions.allCommands || command.enabled) 392 | { 393 | var localPlayCommand = jamActions.isLocalPlayCommand (command, actionSet.name); 394 | if (localPlayCommand !== null) 395 | { 396 | if (customOptions.allCommands) 397 | { 398 | f.write (tabs () + '// '); 399 | if (typeof localPlayCommand[1] !== 'undefined') 400 | { 401 | f.write ('Command ' + localPlayCommand[1] + ' of '); 402 | } 403 | f.write ('Action “' + localPlayCommand[0] + '”'); 404 | if (typeof localPlayCommand[2] !== 'undefined') 405 | { 406 | f.write ((localPlayCommand[2] ? ' with ' : ' without ') + 'Continue'); 407 | } 408 | f.writeln (); 409 | f.writeln (tabs () + 'if (' + (command.enabled ? 'true' : 'false') + ')'); 410 | f.writeln (tabs () + '{'); 411 | indentLevel++; 412 | } 413 | jamActions.traverseAction (actionSet, localPlayCommand[0], localPlayCommand[1], localPlayCommand[2]); 414 | if (customOptions.allCommands) 415 | { 416 | indentLevel--; 417 | f.writeln (tabs () + '}'); 418 | } 419 | } 420 | else 421 | { 422 | f.writeln (tabs () + ('// ' + command.dictionaryName)); 423 | if (customOptions.allCommands) 424 | { 425 | f.writeln (tabs () + 'if (' + (command.enabled ? 'true' : 'false') + ')'); 426 | f.writeln (tabs () + '{'); 427 | indentLevel++; 428 | } 429 | var playObj = jamEngine.eventIdAndActionDescriptorToJson (command.eventId, command.actionDescriptor); 430 | f.writeln (tabs () + playFunctionCall); 431 | f.writeln (tabs () + '('); 432 | indentLevel++; 433 | f.writeln (jamJSON.stringify (playObj[""], tab, tabs ()) + ','); 434 | f.writeln (jamJSON.stringify (playObj[""], tab, tabs ()) + ','); 435 | f.writeln (tabs () + jamActions.determineDialogMode (command)); 436 | indentLevel--; 437 | f.writeln (tabs () + ');'); 438 | if (customOptions.allCommands) 439 | { 440 | indentLevel--; 441 | f.writeln (tabs () + '}'); 442 | } 443 | } 444 | } 445 | } 446 | jamActions.setCommandHandler (logCommand); 447 | jamActions.traverseAction (actionSet, actionIndex); 448 | indentLevel--; 449 | f.writeln ('}'); 450 | f.writeln ('catch (e)'); 451 | f.writeln ('{'); 452 | indentLevel++; 453 | f.writeln (tabs () + 'if (e.number !== 8007) // Not a user cancel error'); 454 | f.writeln (tabs () + '{'); 455 | indentLevel++; 456 | f.writeln (tabs () + 'try'); 457 | f.writeln (tabs () + '{'); 458 | indentLevel++; 459 | var desc = new ActionDescriptor (); 460 | desc.putString (app.stringIDToTypeID ("message"), "<<< PLACEHOLDER >>>"); 461 | var playObj = jamEngine.eventIdAndActionDescriptorToJson (app.stringIDToTypeID ("stop"), desc); 462 | f.writeln (tabs () + playFunctionCall) 463 | f.writeln (tabs () + '('); 464 | indentLevel++; 465 | f.writeln (jamJSON.stringify (playObj[""], tab, tabs ()) + ','); 466 | var jsonDesc = jamJSON.stringify (playObj[""], tab, tabs ()); 467 | f.writeln (jsonDesc.replace (/"<<< PLACEHOLDER >>>"/, 'e.message.replace (/^.*\\n- /, "")') + ','); 468 | f.writeln (tabs () + 'DialogModes.ALL'); 469 | indentLevel--; 470 | f.writeln (tabs () + ');'); 471 | indentLevel--; 472 | f.writeln (tabs () + '}'); 473 | f.writeln (tabs () + 'catch (e)'); 474 | f.writeln (tabs () + '{'); 475 | f.writeln (tabs () + '}'); 476 | indentLevel--; 477 | f.writeln (tabs () + '}'); 478 | indentLevel--; 479 | f.writeln ('}'); 480 | f.close (); 481 | } 482 | } 483 | if (customOptions.openFolder) 484 | { 485 | actionSetFolder.execute (); 486 | } 487 | } 488 | else 489 | { 490 | alert ("Cannot create action set folder in destination:\n" + destination.fsName); 491 | } 492 | } 493 | } 494 | else 495 | { 496 | alert ("Sorry, this script requires Photoshop CS3 or later."); 497 | } 498 | 499 | //------------------------------------------------------------------------------ 500 | 501 | -------------------------------------------------------------------------------- /JSX Utility Scripts/jamEngine Action to JSX/jamActions-min.jsxinc: -------------------------------------------------------------------------------- 1 | // jamActions.jsxinc v4.4 (minified) 2 | if(typeof jamActions!=='object') {var jamActions={};(function() {jamActions.isActionsFile=function(file) {return(file.type==='8BAC')||file.name.match(/\.atn$/i);};jamActions.isActionsPalette=function(file) {return((file.type==='8BPF')&&file.name.match(/^Actions Palette$/i))||file.name.match(/^Actions Palette.psp$/i);};function readBEInt(file,byteCount) {var bytes=file.read(byteCount);var intValue=0;for(var index=0;index=0)&&(actionIndex","fontList"]],["application",["",["ordinal","targetEnum"]]]]);var fontPostScriptNameArr=resultDescriptorObj["fontList"][1][1]["fontPostScriptName"][1];for(var i=0;i",action]],["actionSet",["",actionSet]]]);var found=true;} catch(e) {var found=false;} if(!found) {jamEngine.jsonPlay("open",{"target":["",actionsFilePath]});}};jamUtils.loadActionSet=function(actionSet,actionsFilePath) {try {jamEngine.jsonGet([["actionSet",["",actionSet]]]);var found=true;} catch(e) {var found=false;} if(!found) {jamEngine.jsonPlay("open",{"target":["",actionsFilePath]});}};jamUtils.loadPreset=function(presetProperty,presetName,presetFilePath) {var useDOM=false;var useOpen=true;var classes={"brush":"brush","colors":"color","gradientClassEvent":"gradientClassEvent","style":"styleClass","pattern":"'PttR'","shapingCurve":"shapingCurve","customShape":"customShape","toolPreset":"toolPreset"};var presetClass=classes[presetProperty];var saveMeaningfulIds=jamEngine.meaningfulIds;var saveParseFriendly=jamEngine.parseFriendly;jamEngine.meaningfulIds=true;jamEngine.parseFriendly=true;var found=false;var resultDescriptorObj=jamEngine.jsonGet ([["property",["","presetManager"]],["application",["",["ordinal","targetEnum"]]]]);var presetManagerArr=resultDescriptorObj["presetManager"][1];for(var i=0;i",presetFilePath]});} else {jamEngine.jsonPlay ("set",{"target":["",[["property",["",presetProperty]],["application",["",["ordinal","targetEnum"]]]]],"to":["",presetFilePath],"append":["",true]});}} jamEngine.meaningfulIds=saveMeaningfulIds;jamEngine.parseFriendly=saveParseFriendly;};function getFileObject(file) {var fileObject;if(file instanceof File) {fileObject=file;} else if(typeof file==='string') {fileObject=new File(file);} else {throw new Error('[jamUtils getFileObject] Invalid argument');} return fileObject;} jamUtils.readTextFile=function(textFile) {var text=null;var file=getFileObject(textFile);if(file.open("r")) {text=file.read();file.close();} return text;};jamUtils.readJsonFile=function(jsonFile) {return jamJSON.parse(this.readTextFile(jsonFile),true);};jamUtils.writeTextFile=function(textFile,text) {var file=getFileObject(textFile);if(file.open('w','TEXT')) {file.encoding='UTF-8';file.lineFeed='unix';file.write('\uFEFF');file.write(text);file.close();}};jamUtils.writeJsonFile=function(jsonFile,data,space) {this.writeTextFile(jsonFile,jamJSON.stringify(data,space));};jamUtils.cloneData=function(data) {var clone;if(data===null) {clone=data;} else if(data.constructor===Object) {clone={};for(var k in data) {if(data.hasOwnProperty(k)) {clone[k]=this.cloneData(data[k]);}}} else if(data.constructor===Array) {clone=[];for(var i=0;i"][jsonCustomOptionsStringKey][""],true)} catch(e) {var customOptions={};} jamEngine.meaningfulIds=saveMeaningfulIds;jamEngine.parseFriendly=saveParseFriendly;return this.mergeData(customOptions,defaultOptions);};jamUtils.putCustomOptions=function(signature,customOptions,persistent) {var descriptorObj={};descriptorObj[jsonCustomOptionsStringKey]=["",jamJSON.stringify(customOptions)];app.putCustomOptions(signature,jamEngine.jsonToActionDescriptor(descriptorObj),persistent);};jamUtils.eraseCustomOptions=function(signature) {app.eraseCustomOptions(signature);};jamUtils.dataToHexaString=function(dataString,lowercase) {var hexaDigits=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"];var hexaString="";var length=dataString.length;for(var index=0;index=0x00)&&(dataByte<=0xFF)) {hexaString+=hexaDigits[(dataByte&0xF0)>>4]+hexaDigits[dataByte&0x0F];} else {throw new Error("[jamUtils.dataToHexaString] Invalid data string");}} if(lowercase) {hexaString=hexaString.toLowerCase();} return hexaString;};jamUtils.hexaToDataString=function(hexaString) {var dataString="";var length=hexaString.length;if(((length%2)===0)&&(/^[0-9A-Fa-f]*$/.test(hexaString))) {for(var index=0;index