|
1 | 1 |
|
2 | | -// v.1.7. |
| 2 | +// v.1.8. |
3 | 3 | // Batch Mockup Smart Object Replacement.jsx |
4 | 4 |
|
5 | 5 | // You'll need to incplude this file to another script file: |
@@ -36,6 +36,13 @@ mockups([ |
36 | 36 |
|
37 | 37 | // CHANGELOG |
38 | 38 |
|
| 39 | +// v.1.8. |
| 40 | +// - Added 2 new options that allow you to edit input files on the fly, which could potentially eliminate the need to batch process input files before running this mockup script. |
| 41 | +// - These options are specific to each smart object in the mockup. |
| 42 | +// - Usage example: |
| 43 | +// inputPlaced_runScript: '$/Input placed script.jsx', |
| 44 | +// inputPlaced_runAction: ['Default Actions', 'Gradient Map'], // ['folder name', 'action name'] |
| 45 | + |
39 | 46 | // v.1.7. |
40 | 47 | // - Added folder structure capabilities to output.filename, which allows you to create a folder |
41 | 48 | // structure dynamically using the filename. For example filename: '@input/@mockup - @input'. |
@@ -387,6 +394,8 @@ function replaceLoopOptionsFiller( rawData ) { |
387 | 394 | itemObj.input = rawItem.input || '$/input'; |
388 | 395 | itemObj.inputFormats = rawItem.inputFormats; |
389 | 396 | itemObj.resize = (rawItem.resize || rawItem.resize === false) ? rawItem.resize : 'fill'; |
| 397 | + if ( rawItem.inputPlaced_runAction ) itemObj.inputPlaced_runAction = rawItem.inputPlaced_runAction; |
| 398 | + if ( rawItem.inputPlaced_runScript ) itemObj.inputPlaced_runScript = rawItem.inputPlaced_runScript; |
390 | 399 | items.push( itemObj ); |
391 | 400 | } |
392 | 401 |
|
@@ -603,9 +612,6 @@ function replaceSoContents( item, sourcepath ) { |
603 | 612 |
|
604 | 613 | } |
605 | 614 |
|
606 | | - soDoc.close( SaveOptions.DONOTSAVECHANGES ); |
607 | | - if ( item.align ) returnLayer.remove(); |
608 | | - |
609 | 615 | } |
610 | 616 |
|
611 | 617 | if ( item.resize ) { |
@@ -654,6 +660,20 @@ function replaceSoContents( item, sourcepath ) { |
654 | 660 | // HIDE BACKGROUND |
655 | 661 | if ( doc.layers.length > 1 ) doc.backgroundLayer.visible = false; |
656 | 662 |
|
| 663 | + try { |
| 664 | + if ( item.inputPlaced_runAction ) { |
| 665 | + app.doAction(item.inputPlaced_runAction[1], item.inputPlaced_runAction[0]); |
| 666 | + } |
| 667 | + |
| 668 | + if ( item.inputPlaced_runScript ) { |
| 669 | + const scriptPath = absolutelyRelativePath( item.inputPlaced_runScript ).decoded; |
| 670 | + $.evalFile( File(scriptPath) ); |
| 671 | + } |
| 672 | + } catch(e) { alert(e) } |
| 673 | + |
| 674 | + soDoc.close( SaveOptions.DONOTSAVECHANGES ); |
| 675 | + if ( item.align ) returnLayer.remove(); |
| 676 | + |
657 | 677 | } catch (e) {} |
658 | 678 | } |
659 | 679 |
|
|
0 commit comments