4 Replies Latest reply on May 2, 2018 5:51 PM by coldclimb

    Script Repair After Update

    coldclimb Level 1

      Hey guys, probably a simple question but I'm a simple man using other people's complex tools and I've run into a snag. I just updated my Photoshop to the latest version and the script I previously had been using to save a jpeg version of the file I'm working on has apparently either broken or I just forgot how it's supposed to be used. I used to have it available under the scripts menu and had a keyboard shortcut attached, but now when I go to use it with File>Scripts>Browse it throws a "Error24: saveJPEG is not a function" error and references line 7. Did something get updated and break the script, or am I doing it wrong? Here's the script, which I think I pulled off someone else's thread here in these forums years ago:

       

      //????? ???????????? ??????:

       

      var doc = app.activeDocument;

      var docName = doc.name;

      docName = docName.match(/(.*)(\.[^\.]+)/) ? docName = docName.match(/(.*)(\.[^\.]+)/):docName = [docName, docName];

      var saveName = new File(decodeURI(doc.path)+'/'+docName[1]+'.jpg');

      saveJPEG( app.activeDocument, saveName, 10 );

       

       

       

      //??????? ??????????:

      var doc = app.activeDocument;

       

      var saveOptions = new JPEGSaveOptions();

      saveOptions.embedColorProfile = true;

      saveOptions.formatOptions = FormatOptions.STANDARDBASELINE;

      saveOptions.matte = MatteType.NONE;

      saveOptions.quality = 12;

       

      var docName = doc.name.replace(/\.[^\.]+$/, '');

      var jpegName = decodeURI(doc.path) + "/" + docName + ".jpg";

      var saveName = new File(jpegName);

      doc.saveAs(saveName, saveOptions, true, Extension.LOWERCASE);

       

       

       

      //????????? ????? ????? ? ??????????? ????

      //[0] - ??? ?????? ??? ?????; [1] - ??? ??? ?????; [2] - ??? ?????????? ?????

      function GetFileName(objDoc)

      {

          var fname = objDoc.name.match(/(.*)(\.[^\.]+)/) ? docName = docName.match(/(.*)(\.[^\.]+)/):docName = [docName, docName];

          return fname;

      }

        • 1. Re: Script Repair After Update
          pixxxel schubser MVP & Adobe Community Professional

          Are you sure the script ever worked? Because the function saveJPEG is completely missing in the code (and there are other mistakes).

           

          Sorry

          • 2. Re: Script Repair After Update
            coldclimb Level 1

            You know I wish I could say I was sure, but you have me doubting slightly. I am 95% sure though. I have been using a script for years like I said, and this is the only script I have saved in my files, so I'm almost positive that it was this script I used previously. I have looked through my Appdata>Roaming>Adobe folders and been unable to find any other scripts in there at all, but I'm not certain if updating would have deleted anything I had previously or not.

            • 3. Re: Script Repair After Update
              pixxxel schubser MVP & Adobe Community Professional

              There are some code is missing:

              eg like:

              function saveJPEG( d, sFile, qty ) {
              {
                  //some stuff
                  //more stuff
                  return;
              }
              

               

              (This is only an example - not working code)

               

              -----------------

              Update ? From which version to what?

               

              -----------------

              Did you looking for your script also in the correct script folder? For example CC2017 (Windows) in C:\Program Files\Adobe\Adobe Illustrator CC 2017\Presets\de_DE\Skripten

              replace (de_DE) with your nation

              1 person found this helpful
              • 4. Re: Script Repair After Update
                coldclimb Level 1

                Ah that was it! I was looking in the AppData folder rather than the regular Program Files folder, and you were correct it was a different script that I found under the older version. Thank you for pointing me in the right direction to figure out my mistakes!