Advertisement
Everath

photoshop openNext

Jan 22nd, 2017
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. currentNameWithExtension = activeDocument.name.toString();
  2. var fileNameNoExtension = currentNameWithExtension;
  3. fileNameNoExtension = fileNameNoExtension.split( "." );
  4. if ( fileNameNoExtension.length > 1 ) {
  5.     fileNameNoExtension.length--;
  6. }
  7. var currentName = fileNameNoExtension;
  8. var cutNumbers = fileNameNoExtension.toString();
  9. cutNumbers = cutNumbers.split( "_" );
  10.  
  11. //alert("Filename is: " + currentName);
  12. //alert("String split is: " + cutNumbers[0] + ", " + cutNumbers[1] + ", " + cutNumbers[2] + ", " + cutNumbers[3] + ", " + cutNumbers[4]);
  13.  
  14. var preNum = cutNumbers[0] + "_" + cutNumbers[1] + "_" + cutNumbers[2] + "_" + cutNumbers[3] + "_";
  15. var postNum = cutNumbers[4];
  16.  
  17. //alert("preNum is: " + preNum + ". postNum is: " + postNum);
  18.  
  19. var FileNum = Number(postNum);
  20. var fileNumStr = FileNum;
  21. if ( FileNum < 100 && FileNum > 9 ) {
  22.     fileNumStr = "0" + FileNum;
  23. }
  24. else if ( FileNum < 10 ) {
  25.     fileNumStr = "00" + FileNum;
  26. }
  27. else {
  28.     fileNumStr = FileNum;
  29. }
  30. //alert(FileNum + " " + fileNumStr);
  31.  
  32. var thisDocument = activeDocument;
  33. var filePath = thisDocument.path;
  34. //alert(filePath);
  35.  
  36. var openFileAt = filePath + "/";
  37. var nextFileNum = FileNum += 1;
  38. var nextFileNumStr = nextFileNum;
  39. if ( nextFileNum < 100 && nextFileNum > 9 ) {
  40.     nextFileNumStr = "0" + nextFileNum;
  41. }
  42. else if ( nextFileNum < 10 ) {
  43.     nextFileNumStr = "00" + nextFileNum;
  44. }
  45. else {
  46.     nextFileNumStr = nextFileNum;
  47. }
  48.  
  49. var nextFileFull = openFileAt + preNum + nextFileNumStr + ".png";
  50. //alert("Next file is: " + nextFileFull);
  51.  
  52. activeDocument.close(SaveOptions.DONOTSAVECHANGES);
  53. app.open( new File ( nextFileFull ) );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement