Stopping the File Open At the End of Loop

How can I make the script skip the "docRef = open(fileList[i])" at the end of the iteration once all the files are opened? Is there a way to get rid of
this by perhaps getting the total number of files on a folder and assigned it as a variable 'max", such that if the variable "i" is eventually equal to
"max," the the script will not execute the last action on the iteration?
As of now, this loop (taken from Paul Riggott's response to my question before regarding folder processing) is generating the following error:
Error 8000: Cannot open the file because the open options are incorrect
Line: 20
-> docRef=open(fileList[i]);
Here is the script I am working on:
var startDisplayDialogs = app.displayDialogs
app.displayDialogs = DialogModes.NO
// ask the user for the input and output folders
var inputFolder = Folder.selectDialog("Select a folder to process")
var outputFolder = Folder.selectDialog("Select a folder for the output files")
if (inputFolder != null && outputFolder != null) {
// get all the files found in this folder
var fileList = inputFolder.getFiles()
// open each one in turn
for (var i = 0; i < fileList.length; i++) {
// The fileList includes both folders and files so open only files
if (fileList[i] instanceof File && fileList[i].hidden == false) {
// get a reference to the new document
var docRef = open(fileList[i]);

The main problem is
var fileList = inputFolder.getFiles();
You are getting a list of all files and folders that exist in that folder, they could be text files etc.
It is better to specify the file types IE:
var fileList = inputFolder.getFiles(/\.(jpg|tif||psd|)$/i);
As this will only get a list of files that are jpg, tif or psd

Similar Messages

  • How to ocult the name of the file opened in the title

    Hi,
    when a file is opened, the totle of the file is shown in the title of the acrobat program with the "Adobe Reader" text too. I want than when I open a file its name don't be shown in the title, I need that the title only show "Adobe Reader" always.
    Someone known who do this?
    Thanks!

    Hi Joanne,
    Boxes do not actually have a 'name'. When you add a Box in a report, it will be called 'Box 1' by default. And the only place this name is visible is under the Report Explorer.
    Or do you mean to say 'Text Object'?
    -Abhilash

  • External files opening behind the projector

    I have used 'baOpenFile' function to open some external files
    (pdf, pps etc). In most computers everything works great, but in
    some computers the file opens behind the projector (which is in
    full screen mode), and user doesn't see that the file has opened.
    To solve this problem I have used
    'baWindowToBack(baWinHandle())' to send the projector window back
    before the external file opens. It works, but it's ugly solution
    (especially if there's many windows open on desktop). Does anyone
    know why external files open behind the projector, and is there a
    better way to fix the problem than the one that I've used?

    Instead of sending the Director window to the back, it may be
    better to
    bring the new window to the front. That will bypass the issue
    of other
    windows appearing over the Director window.
    I do not know why this happens, and I have seen it in action
    many times
    myself. It is annoying, but easily worked around.

  • PhotoShop Elements 11 stopped importing Adobe PDF files recently.  Everything looks the same until the file opens and is just a transparent background.

    PhotoShop Elements 11 stopped importing Adobe PDF files recently.  Everything looks the same until the file opens and is just a transparent background.  Can anyone offer advice on how to fix this?

    First, in the Editor, go to Edit>Preferences, click this button and restart the editor:

  • How to stop a file opening on two computers at the same time?

    in OS9, if a file was open, another computer on the network couldn't open it. Now in 10.4 we can have the file open on two computers and the first they know is when one goes to save it. We still want to access and edit the file across the network, just not at the same time. Is there a better way to do this?
    thanks

    Some applications take note of files being open in multiple locations. One great example is Circus Ponies Notebook, which warns a user opening a file if it is still open for another user.

  • How change the File Open With list of apps?

    In Bridge CS3, how does one edit the list of applications in the File > Open With menu (also available from the contextual menu for any image).
    The list contains a number of applications that I would never use to open an image, and I would like to add to it, a new image editor (pixelmator) that does not appear in it. I have looked in the Bridge Help and the Preferences dialog and don't see any option to do this.

    OK, I have now learned that Mac OS keeps the list of which apps to open what, in the "launch services database."
    This database can be cleaned up and reset which somewhat simplifies the list that is displayed by the Finder OR by Bridge CS3.
    Here is an article on how to reset the launchdb:
    http://www.macosxhints.com/article.php?story=20031215144430486
    Be sure to read all the way to the end as there are updated instructions down among the comments.
    Here is a thread in the Apple Support forums discussing the same issue, and it includes links to some 3rd-party programs that can reset launch services without use of a lengthy Terminal command:
    http://discussions.apple.com/thread.jspa?messageID=1289317
    Even after rebuilding the launchdb, I find that a large number of apps are "registered" to open JPG files, including Camino, Opera, TextWrangler and others with only a tenuous connection to JPG. I don't understand why this is, and I would still like to find a way to limit the JPG Open-With list to a few graphics programs. But cleaning up the launchdb as described in the linked pages, did get rid of some programs and added some missing ones.
    Hope this actually constructive info is useful to others.
    Dave Cortesi

  • Why won't files open in the space that the application is assigned to?

    I have applications assigned to specific spaces, however, if I am in space 2 and I click to open an Adobe Illustrator (assiged to space 3) file, spaces will send me to space 3 but the file window will open in space 2 (where I was). I have to use F8 to view the spaces and drag it over to the assigend sapce. If i try to work on it in spaces 2 (where it opened) my pallets are blank. Any ideas?

    Ah this is just because I haven't fully updated my bridge yet, but the solution still works fine
    Date: Mon, 10 Oct 2011 13:25:37 -0600
    From: [email protected]
    To: [email protected]
    Subject: Why won't files open in Camera Raw from Bridge?
        Re: Why won't files open in Camera Raw from Bridge?
        created by Noel Carboni in Adobe Camera Raw - View the full discussion
    The video shows replacing a current DLL file with one from last year - the key issue being that the files found in the Bridge and Photoshop folders are DIFFERENT. Why would this be?  I checked a PS CS5.1 installation myself and the files are already the same. Is there an illegitimate copy of Photoshop being used or something, causing these files to differ? -Noel
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/3963527#3963527
         To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/3963527#3963527. In the Actions box on the right, click the Stop Email Notifications link.
         Start a new discussion in Adobe Camera Raw by email or at Adobe Forums
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • Positions on stage become changed when the file opens

    I'm making a Flash animation in Flash CS4, using motion tweens to change positions and sizes of objects on stage. I frequently open the animation file and find a motion-tweened object has been moved to a new position from the one it was in when I last saved the file. All the frames in the tween seem to be affected. If I open the file again without saving, the object is still in the wrong position. I have had to redo or substantially correct a big tween several times. It's wasting time, and I can't rely on my work being in the state that I saved it last. I think the problem happens to the files when I open them after starting up Flash.
    Does anybody have any idea what could be happening, and how to stop it?

    Sorry, forgot details: I'm using Flash on Window XP Home ed. My version is Flash CS4 version 10.0.2.

  • I downloaded mountain lion and then the new office suite (word, ppt, excel) but now when I try to display one of my ppt's it says 'ppt cannot open the file...the file may be corrupt, in use, not a type recognized by ppt etc.." how can I fix it?? HELP

    I downloaded mountain lion and then the new office suite (word, ppt, excel) but now when I try to display one of my ppt's it says 'ppt cannot open the file...the file may be corrupt, in use, not a type recognized by ppt etc.." how can I fix it?? HELP

    Did you try to open teh fle by double-clicking its icon? If the file was made with an older version of Office, you may get that message. Try opeing PP and, from its "File" menu, see if you can open the ppt. I've foundthat often gets around that message and then yo ucan save the file from the newer version.
    If that doesn't work, consider asking in the Microsoft Office: Mac forums here:
    Office for Mac forums
    PowerPoint is not an Apple product and it seems a lot of people around here avoid Office.

  • Trying to create a Photomerge in Bridge, when the files open in Photoshop ( small jegs ) , I get a error message of " Unable to process latte files " / " null is not an object "

    Trying to create a Photomerge in Bridge, when the files open in Photoshop ( small jegs ) , I get a error message of " Unable to process latte files " / " null is not an object "
    Please help

    Wait a second, Photoshop can make lattes now?  Personally I prefer my coffee black, but man have I been under-utilizing this program.

  • I tried to change the file type of the movie, but now I am unable to open/edit it in iMovie, HELP !

    I tried to change the file type of the movie, but now I am unable to open/edit it in iMovie, HELP !

    Thank you very much! This is exactly what I was looking for.
    I appreciate your time and effort in solving my question : )

  • Downloaded Appleworks 6.2.9 for Mac Updater-2.sim but when i try to open the file i receive the message "legacy image should be updated".  what does this mean and/or entail?

    downloaded Appleworks 6.2.9 for Mac Updater-2.sim but when i try to open the file i receive the message "legacy image should be updated".  what does this mean and/or entail?

    Mavericks is not recognizing the .smi extension - on my Mac it thinks it's a RealPlayer document. You are not going to be able to do anything with this - it requires AppleWorks to be present to be updated, and you can't run AppleWorks on Mavericks (other than by the rather roundabout process of installing Snow Leopard Server in Parallels and installing AppleWorks on that, as described here).

  • IPhoto9: "library could not be opened because the file system of the library's volume is unsupported."

    Can please anyone help me with this issue.
    After upgrading from iPhoto8 to iPhoto9 my library won't open anymore. I have stored all my pictures on a NAS (Buffalo Link Station Duo). It all worked fine but since upgrading to iPhoto9 I do have the following problem:
    When opening iPhoto I receive a message that the library needs to be updated. I assume that iPhoto should just do this sort of automatically in order to upgrade to iPhoto9.However, next message I receive then is
    "The library could not be opened because the file system of the library's volume is unsupported."
    Apple support so far does not seem to be able to solve my issue. Anyone else having had the same issue and having a solution to this?
    Thanks a lot for your help.

    There is no solution.
    IPhoto needs to have the Library sitting on disk formatted Mac OS Extended (Journaled). Users with the Library sitting on disks otherwise formatted regularly report issues including, but not limited to, importing, saving edits and sharing the photos.While you have been lucky to date, many folks with a library on a NAS found that it worked for a while and then the problems started.
    Workaround: Put the Library on a Disk Image formatted Mac OS Extended (Journaled) and store that on the NAS. But the real solution is to use a properly formatted disk for the Library.
    Regards
    TD

  • What is the best way to copy aperture library on to external hard drive? I am getting a message that say's "There was an error opening the database. The library could not be opened because the file system of the library's volume is unsupported".

    What is the best way to copy aperture library on to external hard drive? I am getting a message that say's "There was an error opening the database. The library could not be opened because the file system of the library's volume is unsupported". What does that mean? I am trying to drag libraries (with metadata) to external HD...wondering what the best way to do that is?

    Kirby Krieger wrote:
    Hi Shane.  Not much in the way of thoughts - - but fwiw:
    How is the drive attached?
    Can you open large files on the drive with other programs?
    Are you running any drive compression or acceleration programs (some drives arrive with these installed)?
    Can you reformat the drive and try again?
    Hi Kirby,
    I attached the UltraMax Plus with a USB cable. The UltraMax powers the cable so power is not an issue. I can open other files. Also, there is 500GB of files on the drive so I cannot re-format it. Although, I noted I could import the entire Aperture Library. However, I do not want to create a duplicate on my machine because that would be defeating the purpose of the external drive.
    Thanks,
    Shane

  • I have moved old Back Up files from my external hard drive to the trash and as the Trash previews the files, i.e. counts them (over 850,000 files) it then begins to delete but then stops. Is it possible to move the files out of the Trash file and then onl

    I have moved old Back Up files from my external hard drive to the trash and as the Trash previews the files, i.e. counts them (over 850,000 files) it then begins to delete but then stops. Is it possible to move the files out of the Trash file and then only delete a small amount at one time?

    See
    Deleting backups via the Finder on Lion 10.7.x or later:
    http://pondini.org/TM/12.html
    Hold option (alt) while emptying the Trash.
    See also
    http://pondini.org/TM/E6.html
    Message was edited by: WZZZ

Maybe you are looking for

  • What are the mandatory fields needed to setup/register the SIP phone manually in CUCM

    What are the mandatory fields needed to setup/register the SIP phone manually.Also, if someone can let me know the mandatory fields for Cisco based SIP phone and also the third party SIP hard phones like Avaya or any other Third party SIP phones both

  • Huge size of application jar

    Hi experts, I have a Java project that includes a third party tool for formatting and printing a report (JasperReports and iReport). The project was originally done back in Feb.2004 and I needed to update the tools and jars. When I made my applicatio

  • Start Menu Folder Redirection In Windows Server 2008 R2 (Via GPO) For Windows 7 Professional

    Hi, I'm having the problem where a redirected start menu appears empty. Using server 2008 R2 and the clients are Windows 7 Professional; i am getting empty start menu. Note:- Same is working perfectly fine with Windows XP machines. I believe the poli

  • Rename sheet error

    I'm all fully updated, running on Yosemite and when I try to rename a sheet, I type the new name in and hit enter .... then nothing happen. It always reverts back to the default name. Any ideas - is it a bug or should I re install Numbers? I have del

  • Importing a "spanned" P2 file when it's not spanned...?

    I've got a weird-o clip, shot as a DVCPRO HD/23.98 xmf file on a P2 card. My cameraman copied the original P2 cards into his laptop during the shoot, and then onto a small drive for transport into my system. In Log and Transfer, I have one file that