Guest User

Untitled

a guest
Mar 16th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. @@@BUILDINFO@@@ Resize.jsx 1.0.0.1
  3. */
  4.  
  5. var begDesc = "$$$/JavaScripts/ResizeOnOpen/Description=Pop the image size dialog. Pre populate the menu with 100 x 100 pixels." // endDesc
  6. var begName = "$$$/JavaScripts/ResizeOnOpen/MenuName=Resize" // endName
  7.  
  8. // on localized builds we pull the $$$/Strings from a .dat file, see documentation for more details
  9. $.localize = true;
  10.  
  11. var startRulerUnits;
  12. var startTypeUnits;
  13. var startDisplayDialogs;
  14.  
  15.  
  16. try {
  17.     startDisplayDialogs = displayDialogs;
  18.     startRulerUnits = preferences.rulerUnits;
  19.     startTypeUnits = preferences.typeUnits;
  20.    
  21.     displayDialogs = DialogModes.NO;
  22.     preferences.rulerUnits = Units.PIXELS;
  23.     preferences.typeUnits = TypeUnits.PIXELS;
  24.  
  25.     if ( activeDocument.width != 100 || activeDocument.height != 100 ) {
  26.         displayDialogs = DialogModes.ALL;
  27.         activeDocument.resizeImage( 100, 100, 72, ResampleMethod.BICUBIC );
  28.         displayDialogs = DialogModes.NO;
  29.     }
  30.  
  31.     displayDialogs = startDisplayDialogs;
  32.     preferences.rulerUnits = startRulerUnits;
  33.     preferences.typeUnits = startTypeUnits;
  34.  
  35. }
  36.  
  37. catch(e) {
  38.     // always wrap your script with try/catch blocks so you don't stop production
  39.     // remove comments below to see error for debugging
  40.     // alert( e );
  41.  
  42.     if ( undefined != startDisplayDialogs ) {
  43.         displayDialogs = startDisplayDialogs;
  44.     }
  45.  
  46.     if ( undefined != startRulerUnits ) {
  47.         preferences.rulerUnits = startRulerUnits;
  48.     }
  49.  
  50.     if ( undefined != startTypeUnits ) {
  51.         preferences.typeUnits = startTypeUnits;
  52.     }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment