Save all open jpg files

I have the script partially working. It saves all the open psd as jpg into into a separate directory and it close some of the open files not all. The directory has five files. The script saves only three files, What am I doing wrong?
#target photoshop
if (app.documents.length > 0) {
//flatten the active document
app.activeDocument.flatten();
//jpeg options
var myJPEGOptions = new JPEGSaveOptions();
myJPEGOptions.embedColorProfile = true;
myJPEGOptions.formatOptions = FormatOptions.STANDARDBASELINE;
myJPEGOptions.matte = MatteType.WHITE;
myJPEGOptions.quality = 12;
myJPEGOptions.scans = 3;
// get documents;
var docs = app.documents;
for (var m = 0; m < app.documents.length; m++) {
app.activeDocument = docs[m];
try {
//save file to folder
var myFile = new File(("~/Desktop/forum-test") + "/" + activeDocument.name);
app.activeDocument.saveAs(myFile, myJPEGOptions, true);
//close the document
activeDocument.close(SaveOptions.DONOTSAVECHANGES);
catch (e) {
alert ("Error the script did not execute");

This forum is about scripts in Acrobat. You need the Illustrator Scripting forum, I'm guessing.

Similar Messages

  • Save all Open Files in CS4?

    Hi all,
    Looking for a script that will save all open files as a a JPG to a specific directory.  I tried using this in CS4 but it doesnt work.  It just opens the save dialog and thats it.  Want something a bit more automated:
    var tempFolder = new Folder ("C:/Your_Temporary_Folder")
    tempFolder.create();
    var DL = documents.length;
    for(a=1;a<=DL;a++){
       activeDocument = documents[a-1];
       var AD=activeDocument;
       var imgName= AD.name;
       imgName = imgName.substr(0, imgName.length -4);
       AD.flatten();
       saveFile = new File("C:/Your_Temporary_Folder/"+imgName+".jpg");
       saveOptions = new JPEGSaveOptions();
       saveOptions.embedColorProfile = true;
       saveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
       saveOptions.matte = MatteType.NONE;
       saveOptions.quality = 12;
       AD.saveAs(saveFile, saveOptions, true,Extension.LOWERCASE);
    Thanks.

    Hi guys,
    That fixed it.  The other problem was that the name length was too short:
       imgName = imgName.substr(0, imgName.length -0);
    So I corrected that as well.  Thanks for your help.
    Is it possible to add a "close without prompting to save" in the script?  So it basically saves the file then closes the window in PS without prompting me to save it again?

  • My Preview will not open JPG files, only PDF.  I have downloaded nothing or installed nothing as I am a Luddite.  Any idea why all of a sudden, Preview would just stop opening JPG files?

    My Preview, suddenly, will not open JPG files.  It will open a file if it is saved as a PDF, but not JPG.  I have downloaded nothing nor installed apps as I am a Luddite.  Does anyone know the deal?  Thank you.

    So ummm.....which app is opening up your PDF files?
    If you want Preview to open your PDF files, do the following:  Highlight your file>File>Get Info> 
    In the Get Info window, scroll down to "Open with:"
    Select the Preview app to open the file.
    Click the "Change All..." button if you want to "Use this application to open all documents like this.”

  • Save all open files?

    Is there a way or a script to save all open files in Adobe Illustrator?
    Thanks

    Thanks. How would one edit this, especially so that it doesn't close the files?
    Do I just delete the 4th line from the bottom?
    var WR="WR-SaveAndCloseAll v0.2\n\n";
    if (language == "de") {
      var MSG_nodocs = WR+"Kein Dokument ge\xF6ffnet.";
      var MSG_ask = WR+"Sollen alle Dokumente gespeichert und geschlossen werden?";
    } else {
      var MSG_nodocs = WR+"You have no open document."
      var MSG_ask = WR+"Are you sure to save and close all open documents?";
    var itemstoprocess=0;
    var error=0;
    var Docs=documents.length;
    if (Docs<1) {
      error++;
      alert(MSG_nodocs);
    } else {
      if(confirm(MSG_ask)) {
        for(var i=0;i<Docs;i++) {
          activeDocument.close(SaveOptions.SAVECHANGES);

  • Error message: "Dreamweaver can't open .jpg files"

    I'm using DW 8, and I have installed the 8.0.2 update. I'm
    having trouble inserting certain JPG images into a site. I get an
    error message pop-up that states "Dreamweaver can't open .jpg
    files". It will allow me to insert some jpg files, but not all of
    them. I've tried drag & drop and going through the Insert menu.
    The files are not large at all. Doesn't appear to be any problem
    with png's or gif's. It's incredibly frustrating. Anyone have any
    suggestions? TIA.

    > why was i taught that all my web images need
    > to be in 72dpi if it doesn't really matter?
    most people suggest 72 because it was an old standard with
    the early
    macintosh DTP programs. For web use it's easier to
    standardize on it because
    when you make an image, you have to put ~some~ number in the
    resolution box
    and it might as well be 72 as any other number. It simplifies
    moving image
    files around in different applications if they are all the
    same resolution.
    For display in a browser, these will all have the same file
    size and display
    size in a web page:
    600x600 pixels at 1dpi
    600x600 pixels at 72dpi
    600x600 pixels at 6000dpi
    It's when they are used in other applications or when a
    direct url like
    /photos/1.jpg is printed out that they may display in the
    resolution, not
    the pixel dimension.
    I came across a page once where the designer always saved his
    images with a
    resolution of 6000 dpi or some other odd number because he
    thought that if
    people dragged the image off the page to save it- most of
    them wouldn't be
    able to resize it. or some other idiot reason maybe.
    Alan
    Adobe Community Expert, dreamweaver
    http://www.adobe.com/communities/experts/

  • [SOLVED] GIMP doesn't open .jpg files

    Hello, I installed GIMP with pacman on my arch x64 and noticed it can neither open .jpg files nor save images as .jpg. First thing that came to my mind is that some codec or plugin is missing but I can't find anything. And as my image viewer is able to open .jpg files I think, it's a gimp specific problem. Hope you can help me.
    Last edited by Psylver (2011-08-05 03:06:21)

    karol wrote:
    They were not talking about the package manager cache, but about gimp-related settings:
    I finally fixed the problem by uninstalling everything that referenced GIMP, deleting all of the settings folders
    2nd poster said:
    [...] But the install now gave a little more clear error message about corrupted install file (in the apt cache).
    Cleaned the cache completely and did the install (including gimp-ufraw) and now it works again [...]
    ..which I tried and which didn't work.
    I now also tried deleting the folder in my /home directory and reinstalling it. Still no chance to open .jpg files.
    Last edited by Psylver (2011-08-01 17:30:12)

  • Cannot save or open .ai files that's on a server.

    Hello everyone,
    My office upgraded to CS4 few month ago, and I am having problem saving and opening AI files. It seems like a server problem but I'm not sure because my co-workers can save and open file without problem. We are using exact same computers with exact same settings.
    I can save and open AI files no problem when they are saved on the computer that I used to create the file. However, when I try to save the file to the server, which is a computer on the same network, Illustrator gives me an error massage saying "This file may be read-only, or another user may have it open. Please save the document with different name or in a different folder." No one else has the file open (because I just made this file) and it is not read only. When I click on "OK" Illustrator creates a AI file that is 0 KB in the folder where I was trying to save. If I try to open this file, another error massage "The file 'test.ai' is in an unknown format and cannot be opened"
    I can save files as EPS from Illustrator no problem (even on the server) and I can open them normally. All other formats such as, indd, psd, tiff etc. saves fine and I can open them too. Once in a while, Illustrator will not give ma any error code but they still save as 0KB. When I move the file from my computer to the server, the file is not 0KB but I can no longer open the file. It is really strange.
    Does anyone have any idea what's going on? Please help. Thank you in advance.

    If you do a search on Google i believe you will find links to pages that describe the problem and ffer a solution.
    If on windows perhaps this is the problem
    http://www.techsupportforum.com/design-forum/graphic-design-digital-imaging-multimedia/409 713-adobe-illustrator-cant-save-file.html
    of I do believe there is another issue as well.
    I could not find it myself though I am certain there is a fix.
    it might be a permissions problem.

  • Mail doesn't open jpg files

    When the file is download, a question marks appear. Please help. I restored. I delete my me account and create again. Nothing, nothing...

    karol wrote:
    They were not talking about the package manager cache, but about gimp-related settings:
    I finally fixed the problem by uninstalling everything that referenced GIMP, deleting all of the settings folders
    2nd poster said:
    [...] But the install now gave a little more clear error message about corrupted install file (in the apt cache).
    Cleaned the cache completely and did the install (including gimp-ufraw) and now it works again [...]
    ..which I tried and which didn't work.
    I now also tried deleting the folder in my /home directory and reinstalling it. Still no chance to open .jpg files.
    Last edited by Psylver (2011-08-01 17:30:12)

  • How do I open jpg files in camera raw?

    I have read in numerous articles that I can open jpg files in ACR from within Elements 11. They all state to go File>Open, then browse to the jpg you wish to open, select Camera Raw from the file type and select the jpg. When I select the Camera Raw file type then all the jpg images disappear in the selection area or if I click the jpg first and then select Camera Raw and open then it says file not found. Am I doing this wrong or are the articles I am reading incorrect?

    Hi Majortipper,
    In Elements 11 go to File menu >> open as .
    It will open a file open dialog where you have a "format" drop-down instead of format menu.
    In Elemens 12 this "open as" is replaced with "Open in camera raw"
    thanks,

  • Opening jpg files

    My Photoshow Elements 9 program selectively opens jpg files obtained by a digital microscope camera (it consistently opens only those pictures taken at 4X power and not those taken at 10X and 40X power). The camera providers were able to open all files with their Photshop CS 5.5 program, so they argue the problem comes from my photoshop. I already tried deleting the settings file but it did not solve it. How can I solve this?

    Thanks for your prompt answer. I am opening the images through the Editor, using the tab File-Open. I then get a message window saying (translated from Spanish) "Cannot be fulfilled because there has been an error in the program".
    I DO know the power of the microphotograph (4X, 10X, 40X) because I have them individually labeled and scaled. I just noticed that this varies with the day. Of photos made a few days back, the Editor only lets me open those of 40X power. ¡Weird!
    I have been solving the problem by opening the photos from Powerpoint and saving them again as jpg. Then, Elements lets me open them OK and I process them fine! But it is an additional, time-consuming step and I want to avoid it.
    The camera is an Amscope MU500, and uses a software called ToupView.
    Sven

  • Opening .jpg files give an error

    Hi there,
    some of our mac clients are having trouble opening JPG files in Photoshop. the problem occurs when they try to import them from bridge or open them directly from photoshop.
    the error states: "Can not execute request because of a program error".
    all of the users have fully updated Macs and fully updated Creative cloud.
    the files are currently located on a DFS Share in a windows domain but copying the files locally doesnt seem to fix the issue.
    any help would be appreciated.
    Gr. Michiel Holtz

    bump, is there someone who can point me in the direction of solving these issues ?
    thanks in advance

  • Save all open images

    I didn't find this when I did a forum search, but I find it hard to believe that there isn't a feature request for this already. Photoshop needs a "Save All" feature. I've seen suggestion to just make this an action, but the problem with that is that you must continually hit the action in order to perform it. Maybe I'm just missing something but I find it odd that a photo editing program, in which it is quite possible that you could have dozens of images open at the same time has no "Save All" or "Autosave" features...still.

    If you want to give it a try paste the following text into a new file in ExtendScript Toolkit (part of Photoshop’s installation, Applications/Utilities/Adobe Utilities - CS5/ExtendScript Toolkit CS5) and save it as a jsx-file into Photoshop’s Presets/Scripts-folder.
    After restarting Photoshop the Script should be available under File > Scripts and can be assigned a Keyboard Shortcut directly, recorded into an Action, (in CS4 and CS5) be used in a Configurator-Panel or started from ExtendScript Toolkit directly.
    // save all open documents;
    // 2011, use it at your own risk;
    #target photoshop;
    if (app.documents.length > 0) {
    var theFirst = app.activeDocument;
    var theDocs = app.documents;
    // psd options for unsaved files;
    psdOpts = new PhotoshopSaveOptions();
    psdOpts.embedColorProfile = true;
    psdOpts.alphaChannels = false;
    psdOpts.layers = true;
    psdOpts.spotColors = true;
    // go through all files;
    for (var m = 0; m < theDocs.length; m++) {
         var theDoc = theDocs[m];
         app.activeDocument = theDoc;
    // getting the name and location;
         var docName = theDoc.name;
    // thanks to xbytor for the regexp;
         if (docName.indexOf(".") != -1) {var basename = docName.match(/(.*)\.[^\.]+$/)[1]}
         else {var basename = docName};
    // getting the location, if unsaved save to desktop;
         try {
              var docPath = theDoc.path;
    // save the file if unsaved;
              if (theDoc.saved == false) {theDoc.save()}
    // if file has not been saved yet save to desktop;
         catch (e) {
              var docPath = "~/Desktop";
              theDoc.saveAs((new File(docPath+'/'+basename+".psd")), psdOpts, false, Extension.LOWERCASE);
    app.activeDocument = theFirst;

  • I seem to be having trouble "save" or "save as" with jpg files. Any Suggestions?

    I seem to be having trouble "save" or "save as" with jpg files. Any Suggestions?

    By the way, a full uninstallation and reinstallation is a bit heavy-handed and is not always necessary.
    Keep in mind that with Photoshop CS6 the Plug-ins subfolder is now normally completely empty.  So to undo an inappropriate copy of plug-ins generally you can just delete all the copied plug-ins and that will restore proper Photoshop CS6 operation.
    Then you can reinstall your needed 3rd party plug-ins one by one.
    -Noel

  • Cannot open .jpg files; says read-only and no access

    I cannot open .jpg files I've been working on, even though I saved them as .jpg.  The prompt kept asking me to save the files over & over.  I did for a while then said NO to close the files.  Now it says access is denied.  Went to properties and tried to uncheck box for read-only, but it says I don't have access to do that.  How can I get my files back...these were very special photos.  Please help!

    No...just PSE7.  Unfortunately, when I tried to cut & paste the photos from
    my camera disk to my hard drive, the problem photo completely disappeared.
    When I go into recent history, the shortcuts are there, but none of them
    work.  They say the file has been moved or changed so...I don't even know
    where they are for now.  Do I need to call a repairman?

  • Applescript to save all open documents?

    Hello,
    When I close Numbers, I usually have about 15 documents with changes and I have to go through "Do you want to save changes" for all of them.
    I've googled and tried, without success, to get a script that saves all open documents, except for untitled ones.
    Is there anyone who know such a script?
    Fred

    Here is a revised version.
    The problem was due to the fact that the script save and close the documents.
    When I tested it, it was only saving them.
    --[SCRIPT save&backup4iWork]
    Enregistrer le script en tant que Script : save&zip4iWork.scpt
    déplacer le fichier ainsi créé dans le dossier
    <VolumeDeDémarrage>:Users:<votreCompte>:Library:Scripts:
    Aller au menu Scripts puis choisir “save&zip4iWork”
    Tous les documents iWork ouverts, ayant déjà été enregistrés puis modifiés seront enregistrés et fermés.
    Si la propriété avecSauvegarde a la valeur true, une copie horodatée de chaque fichier est créée.
    Si le document principal est de type paquet, la copie est compressée (zip).
    --=====
    L’aide du Finder explique:
    L’Utilitaire AppleScript permet d’activer le Menu des scripts :
    Ouvrez l’Utilitaire AppleScript situé dans le dossier Applications/AppleScript.
    Cochez la case “Afficher le menu des scripts dans la barre de menus”.
    Sous 10.6.x,
    aller dans le panneau “Général” du dialogue Préférences de l’Éditeur Applescript
    puis cocher la case “Afficher le menu des scripts dans la barre des menus”.
    --=====
    Save the script as a Script: save&zip4iWork.scpt
    Move the newly created file into the folder:
    <startup Volume>:Users:<yourAccount>:Library:Scripts:Applications:Numbers:
    Maybe you would have to create the folder Numbers and even the folder Applications by yourself.
    Go to the Scripts Menu then choose “save&zip4iWork”
    Every open iWork document already saved then edited will be saved and closed.
    --=====
    The Finder’s Help explains:
    To make the Script menu appear:
    Open the AppleScript utility located in Applications/AppleScript.
    Select the “Show Script Menu in menu bar” checkbox.
    Under 10.6.x,
    go to the General panel of AppleScript Editor’s Preferences dialog box
    and check the “Show Script menu in menu bar” option.
    if the property avecSauvegarde is set to true, a dateTime stamped copy of each document is also created.
    It's zipped if the main document is a package.
    Yvan KOENIG
    based on my AutoSave script.
    2011/06/09
    --=====
    property avecSauvegarde : false
    true = keep a dateTime stamped copy
    false = don't keep a dateTime stamped copy
    property saveKeynote : false
    property saveNumbers : true
    property savePages : false
    --=====
    on run
              if savePages then my auto4PKN("Pages")
              if saveKeynote then my auto4PKN("Keynote")
              if saveNumbers then my auto4PKN("Numbers")
    end run
    --=====
    on auto4PKN(theApp)
              local titres, theDocs, aDoc, aPath
              tell application "System Events" to set titres to title of processes
              if theApp is in titres then
                        tell application theApp
    As we close the documents, we must store the list of docs in a variable
    or scan the list from the end which would require an index !
                                  set theDocs to every document
                                  repeat with aDoc in theDocs
                                            if modified of aDoc then
                                                      set aPath to path of aDoc
                                                      try
                                                                set aPath to aPath as text
                                                      on error
    Here if the document was never saved before
                                                                set aPath to ""
                                                      end try
                                                      if aPath is not "" then
    Save and close documents which were already saved once
                                                                close aDoc with saving
                                                                if avecSauvegarde then my zipIt(aPath)
                                                      end if -- aPath
                                            end if -- modified
                                  end repeat
                        end tell -- theApp
              end if -- theApp is…
    end auto4PKN
    --=====
    on zipIt(fichier) (* fichier is an HFS path*)
              local Nom, ext, dossier, isPackage, nomAvecDateHeure, source, dest
              set fichier to "" & fichier
              tell application "System Events" to tell disk item fichier
                        set Nom to name
                        set ext to name extension
                        set dossier to path of container
                        set isPackage to package folder
              end tell
              set source to quoted form of POSIX path of fichier
              set nomAvecDateHeure to (text 1 thru -(2 + (count of ext)) of Nom) & (do shell script "date +_%Y%m%d-%H%M%S.") & ext
              if isPackage then
                        set dest to quoted form of POSIX path of (dossier & nomAvecDateHeure & ".zip")
                        do shell script "ditto -ck " & source & " " & dest
              else
                        set dest to quoted form of POSIX path of (dossier & nomAvecDateHeure)
                        do shell script "cp " & source & " " & dest
              end if
    end zipIt
    --=====
    --[SCRIPT]
    --{code}
    I included your specific requirements.
    Yvan KOENIG (VALLAURIS, France) jeudi 9 juin 2011 18:03:20
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.7
    Please : Search for questions similar to your own before submitting them to the community
    To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer !

Maybe you are looking for

  • Exporting from Premiere Pro in .mov format

    How can I export a video from Premiere Pro CC in .mov format suitable for posting on the Amazon bookselling site?

  • 16:9 widescreen movie menus are too wide for the TV screen

    I shot a movie in 16:9 on my Canon Optura 600 camcorder and edited it in iMovieHD6. Imported it into iDVD6 and all was looking good. Burned it on the SuperDrive and when played back on my Sony XBR flat screen TV (Not widescreen), the 16:9 movie overs

  • Having trouble re-installing premiere 6.0

    I've had it installed on one computer for 5 years or so, and I tried to burn the program onto a cd to install on my other computer, since I've misplaced the original disc. The cd works and the program shows up but I am unable to install it. I dragged

  • Create printing adobe forms

    Hi experts I Want to create function that print adobe form directly not by the button (print) in the pdf i want send command to print the pdf thanks Yossii

  • Parse error: syntax error, unexpected T_STRING in /virtuals3/home/virtuals/

    I just finished publishing my website through my FTP and when i view my website i get this error: Parse error: syntax error, unexpected T_STRING in /virtuals3/home/virtuals/revaddweb/public_html/Revadd/index.html on line 1 does anyone know how to fix