Trouble cycling through a directory of InDesign Files

Hello,
I am writing a script that is meant to cycle through (open, process, close) a bunch of InDesign files in a specified directory.  I have this working except for the fact that the script is only opening one file and then after it closes that file, the script completes.  It will not cycle through all of the InDesign files in the folder.  Here is my code:
var myFileLocation = Folder.selectDialog("Please select a folder containing the InDesign files.");
    myFolder = new Folder([myFileLocation]);
    myFolderContents = myFolder.getFiles("*.indd");
    myFileAmount = (myFolderContents.length - 1);
    // Open, Export, & Close
    for (i = myFileAmount; i >= 0; i--) {
        app.open(File(myFolderContents[i]));
        createHyperlinks();
        app.activeDocument.exportFile(
        ExportFormat.pdfType, File(myFolder.fsName + "/" + app.activeDocument.name.split(".indd")[0] + ".pdf"), false, myPreset);
        app.activeDocument.close(SaveOptions.no);
I have confirmed that myFileAmount contains the correct amount of files in the specified directory (35 files).  Also, I have confirmed that each one of those files is indeed the correct file type. Can anyone see anything wrong with my logic?
Thanks!

Also, you can pull your function into the loop like this maybe:
var createHyperlinks = function(){/*function*/};
createHyperlinks();
And as Jongware said, check your function for 'i' variable, because if you are using this script as it is, variable 'i' can be reset from function because it's a global variable. To make variable local, put your load/loop/close script in function.
Hope that helps.
tomaxxi
http://indisnip.wordpress.com/

Similar Messages

  • InDesign files associated with Pagemaker

    Running Windows XP, InDesign CS3 - I work with two graphics people who both have this same problem. WHen looking at a directory, an InDesign file shows up with a PageMaker icon. If you check the file associations, it shows associated with PageMaker. If you hit "Change", InDesign in not an option. We also did "browse", found the InDesign executable to associate it with, and that did not work either.
    Any suggestions appreciated.

    I hate to say this, but short of hacking the registry, the best I can suggest is re-install.
    ID uses a .dll file to display the correct icon for the version that was used to create the file. Even if you can change the file association, you'll lose the ability to see the different icons.
    Peter

  • Photoshop unexpectedly cycling through newly-opened files

    This is a weird one, and I can't get a foothold on what's causing it. I routinely have to open a batch of five graphics (it's not the same five graphics each time, but each project starts from the same five templates). Lately, when I open them all at the same time, a few seconds after I open them, Photoshop suddenly cycles through them in what seems to be a random order (though it never ends on the file I was looking at when it starts cycling). This is playing havoc with my workflow, as I have actions that rely on the files being opened in a particular order. Not to mention the fact that it often happens just as I'm starting to edit the files. All of a sudden, I'm looking at a different image in the set.
    It doesn't seem to be making any changes when it cycles, as there aren't any files that need saving after it's done. I just can't figure out what it's doing, or why.
    I'm using Photoshop CC 2014.2.1, on a Macbook Pro, running OS X Yosemite (10.10.1). Happy to provide any additional details!

    Have you tried a Preference reset? It has been known to clear up a lot of things in Photoshop when they go haywire. Press Cmd+Opt+Shift immediately after initiating Photoshop startup. Select "yes" when prompted.

  • I have trouble exporting indesign file as pdf.

    I have trouble exporting indesign file as pdf. I need help please.

    Hi,
    Please start by telling us what happens when you try, and also how you are exporting the file.
    Regards,
    Malcolm

  • Trouble packing InDesign files (CS6)

    Recently I've been having trouble packing my InDesign files, getting this message (translated from Swedish): "Failed to copy the necessary linked files" and the document is then not packed at all. Any suggestions what I can do about that? All links seem to be ok and the documents seem to be ok otherwise.

    Check for illegal characters in file names. “/“ seems to be the biggest culprit. Very long file paths can also cause it.

  • Cant open Indesign files unless opening through Bridge

    We have just upgraded our PCs to CS5 & cannot open InDesign files unless we open them through Bridge, we have tried open with but this doesnt seem to work. Any suggestions? Illustrator & Photoshop are fine.

    Sounds like an issue where either the folder you opened the last file from conventionally is no longer available or you do not have sufficient permissions to access it. The info on the last used folders/ files is retained by the programs and if something goes astray, that can cause this behavior. In any case, trashing the prefs to get rid of the wrongly stored paths might be enough, so try that. Simply move the files in C:\Users\[Your Name]\AppData\Roaming\Adobe\InDesign\Version 7.0\en_US out of the way and let the program create new factory defaults.
    Mylenium

  • Searching through multiple InDesign files

    I use InDesign via Windows.  In Windows I can search for key words through documents and folders via My Documents/Explorer.  Is there a way to search through multiple InDesign files the same way? 

    I don't think there is.
    If you use this indesign batch convert
    And convert your InDesign files to RTF - they should be searchable when using the search function in windows.
    Does that help?

  • I can open my new InDesign files by going up through the menu and opening that way, but when I try to just double click on an InDesign file I get error messages telling me that certain plugins aren't available.

    I upgraded my Mac a few weeks ago to 10.10.2 Yosemite, and I joined the Adobe cloud so I could get access to all the new apps. I read a blurb somewhere about converting older InDesign files to the new CC version I'd have to open the old files in my old InDesign CS3, export to an ins file, then open that file in the new InDesign CC, then export it again to an idml file, then open that file and you shouldn't have any of the usual conversion problems. For the first few files I had to convert, it worked just fine. Now for some reason, whenever I try to open one of these converted files just by double-clicking on the file itself, I get an error message that says, "The document ____ uses one or more plug-ins which are currently not available on your system. Do you want to open anyway?" When I click OK, then I get another error message that says, "Cannot open ____. Please upgrade your plug-ins to their latest versions, or upgrade to the latest version of Adobe InDesign." I thought this CC version of InDesign was the newest. Can somebody please tell me what gives with this? Any help will be very much appreciated.

    Did you reinstall CS3 after CC?
    For that matter, doing an in-place upgrade on the OS is always a gamble with Adobe programs. Reinstalling all the versions you need, in order, would probably solve your problem.
    And you shouldn't need to save as IDML after opening the .inx in CC.

  • TROUBLE WHIT INDESIGN FILES don't delete the temporal idlk

    I have a server, my indesign files create a temporal file (idlk) for backup reason, Indesign delete this archive automaticaly on document close. My document is closed and the temporal file is still open. HELP ME PLEASE.

    Look here for an answer: http://helpx.adobe.com/contact/index.html

  • I'm having problems with a message that says: An error occurred while Attempting to create the directory: C:/program files/itunes/cd configuarion

    I know this is a long story, but I'll be damned if I'm not going to get the most specific help I can (as Apple seems to specialize in assuming user error for all its demonic software). I've never had issues with iTunes before (barring a "Connect to iTunes" snafu with my iPod Touch) -- and never, in fact, with Windows Vista, if you believe that -- but this is the most bizarre thing I've seen.
    I recently downloaded the new iTunes v 9.0.3 as I am occasionally prompted to do whenever a new version comes out, and immediately I had problems. Access to the iTunes and Quicktime folders was mysteriously denied after the update, and after several hours of frustration, I was able to grant my own Administrative access to these two folders and installation went through. Thank God.
    Then I bought some music. No problems -- downloaded just fine, along with a copy of Cinderella Man and the new episode of Smallville. Life was good for a few days.
    Then I connected my iPod Touch to the computer. All of a sudden, Microsoft Windows informs me that the "Apple Mobile Device Service stopped working and was closed," with subtext, "A problem caused the application to stop working correctly. Windows will notify you if a solution is available."
    Bullsh*t Windows can help me with anything from Apple.
    So I've tried to get iTunes to work with me on this. I've come up against the infamous "iTunes could not connect to this iPhone because an unknown error occurred (OxE8000001)" message. My God, when does it ever end?
    So I go into Control Panel > Administrative Tools > Services > Apple Mobile Device and start it back up... only to watch it stop again inexplicably moments later. Hmm... Restart. Stays on. Unplug the iPod and plug it back in. Apple Mobile Device Service stops again. Maybe it's the iPod Service itself. Hey, that one's not started! [Start] "Windows could not start the iPod Service service on Local Computer -- Error 5: Access is denied."
    What the f*ck is it with this "Access denied" crap? I've never been denied access to even the most intimate functions, files and folders on my freaking computer before! What has Apple created!?
    I thought, perhaps Apple Mobile Device software was somehow removed. Okay, let's redownload iTunes (aka Repair the program from the Programs and Features menu in the Control Panel -- same thing). Huh. "An error occurred while attempting to create directory C:\Program Files\iTunes\CD Configuration," and I can choose to Retry or Cancel. So, instinctively, I deleted the CD Configuration folder, assuming iTunes Setup would just recreate it.
    Well, that didn't work now, did it? I deleted it and hit Retry, and it said, "The installer has insufficient priveleges to access the directory: C:\Program Files\iTunes\CD Configuration. Log on as administrator or contact your system administrator." Running the .exe file as an adminstrator changes NOTHING about this predicament.
    So that's where it stands. No CD Configuration folder; full access to all files and folders involved; Apple Mobile Device Service still keeps going off for no reason; iPod Service still doesn't run; Repairing/Reinstalling iTunes, Quicktime, Bonjour, etc. does nothing; and God (aka Steve Jobs, apparently) hates me.
    . . . . . . . . . . . . Help me.

    Hi there,
    I would recommend taking a look at the troubleshooting steps found in the article below.
    Trouble installing iTunes or QuickTime for Windows
    http://support.apple.com/kb/ht1926
    -Griff W.

  • InDesign CS3 crashes without error when opening any 2nd InDesign file

    Issue: InDesign CS3 crashes without error and remains resident in memory if we have an InDesign file open and attempt to open a second InDesign file.
    OS: Win XP SP2
    InDesign Version: 5.0.2
    Hardware: Dell Precision WorkStation T3400, 4 gigabytes of memory, Intel Core2 Quad processor Q6600
    Details: No messages in the event viewer about the problem. We renamed the InDesign Defaults and the InDesign Saved Data file. We removed Creative Suite, restarted and then reinstalled Creative Suite (I could not remove and reinstall InDesign individually). We have created a new Windows profile for this user. I have one computer having the trouble. Other InDesign installations are working fine. This computer has 559 files in C:\windows\fonts. Other people that are not having the problem have a larger number of fonts installed.
    The issue is not file specific. We are not running out of memory as I checked the task manager after the first InDesign document is open.
    Why is opening a second document different than opening the first document?

    Hello Peter and Josh,
    I'd just like to assert that I am having the exact same problem as Josh. I've spent the time to go through the steps listed above and have found the same results.
    The issue as we see it multiple times daily is as follows:
    (1) User opens File1 (everything works fine)
    (2) User goes to open File2 (via explorer or via file->open) or print File1
    (3) The User Interface for ID disappears (InDesign.exe still appears in Task Manager and is NOT listed as "Not Responding", ID does not appear in the Task Bar)
    (4) The only way to continue work is to End Task/End Process InDesign.exe and relaunch.
    No error messages appear, no error logs are created(that I can find). Non-related concerns caused us to upgrade this users PC. With a completely new install we are still having the problems. The systems are listed as follows:
    OS: Win XP SP2 (fully updated minus SP3)
    InDesign Version: 5.0.2
    Newest Hardware: Custom Built Computer, 4GB RAM installed (3.24 recognized by windows), Intel Core2 Quad processor Q6600 @ 2.4Ghz
    OS: Win XP SP2 (fully updated minus SP3)
    InDesign Version: 5.0.2
    Older Hardware: Custom Built Computer, Intel D945GTP Motherboard, 2GB RAM installed, Intel Pentium D processor @ 2.8Ghz
    Troubleshooting:
    (1) Alt+Space and M then using arrow keys moves every other window the user had opened other than In-Design. The user has two monitors. (a) 1280x1024 and (b) 1200x1600 (yes she uses the monitor rotated 90 degrees
    (2) Log files - Non exist in the C:\Program Files\Adobe\Adobe InDesign CS3 folder. I've also done a search across the entire hard drive for any "*.log" files, none of which were adobe related.
    (3) Default Printer - Changing the default printer to Adobe PDF is not really an option. I was able to convince the user to temporarily switch to a different networked printer and await the results (most likely today or tomorrow it should recreate)
    (4) /3GB switch - Getting that last 700 something MB of memory isn't an issue. I've run MemTest.exe on all the available system memory overnight in a "burn in" test. The system ran fine the sticks were nice and warm when I got in from all the hard work :)
    (5) Order of Opening - The problem repeates regardless of order. The trick seems to be opening File2 or printing File1 (I had the user only work on one file at a time (required her to close any open files before opening the next, that wasn't fun for my user but the system didn't crash on opening in this scenario, just on printing. Obviously not a permanent work around)
    Any help here would be much appreciated as this has been plaguing us for months now.

  • Zipped folders containing InDesign files

    Hi,
    I'm providing advertising material (ads in InDesign) on a FTP server ; the folders containing layouts and links are compressed in .zip.
    Some users can't open the .indd files, it seems they got corrupted, either while the FTP transfer or the zipping process.
    Has anybody heard of trouble with zipped InDesign files ? Should I compress them in .sit instead ??
    Any help greatly appreciated !
    jean-philippe

    One of the best reasons for zipping transferred files (whether transferred by email or FTP) is precisely so that you *know* about file corruption. If your users can extract the .indd file from the zip file, then the zip file made it through intact. If they can't extract the .indd file, then the zip file got corrupted.
    Because your users are able to unzip the .indd file you can be assured that they're getting the same .indd file you put into the zip file. There's some other reason they can't open the .indd files.
    In what way can they not open your .indd files? Do they get an error message?
    Ken

  • Issues with AUTO cycling through ....

    I'm trying to do this:
    Any help with one or the other is very much appriciated !!!
    1) When the Timer is finish auto cycling through the tabs (1 to 16) of the ViewStack, and switching over to tab (1) to STOP, I would like to address a function to do something ???
    The question is now how to write the code to ID that the Timer has come to a STOP on tab (1), and how can I incoperate this into the existing (onTimerOne) function.
    2) The second item I'm after is that if I'm amnualy select any tab (1 to 16) to address also a function to do something ???
    3) The third item I'm after is to automaticly zero (0) the ViewStack to tab number (1) if I click a Btn.
    <mx:Script>
    <![CDATA[
        import flash.events.TimerEvent;
        import flash.utils.Timer;
        private var timerOne:Timer;
        private function initOne():void {
            timerOne = new Timer(5000, myViewStack.numChildren);
            timerOne.addEventListener(TimerEvent.TIMER, onTimerOne);
        private function onTimerOne(evt:TimerEvent):void {
            if(myViewStack.selectedIndex == myViewStack.numChildren-1) {
            myViewStack.selectedIndex = 0;
            return;
            myViewStack.selectedIndex++;
        private function autoOne():void {
            if (!timerOne.running) {
            timerOne.start();
        private function manualOne():void {
            if (timerOne.running) {
            timerOne.stop();
    ]]>
    </mx:Script>
    4) Well, the fourth item I'm trying to work out is as I'm reading my data from an Xml file to have a TextArea which shows the different countries from the Xml file for each ViewStack tab while auto cycling through these tabs (1 to 16).
    The diffuculty here is that I use this Xml with a specific urlID="1" to urlId="16" as part shown below.
    <urlsOceania>
        <urlOceania urlID="1"/>
        <searchCountry>American Samoa</searchCountry>
        <etc></etc>
    </urlsOceania>
    I'm reading all the other items this way:
    source="{urlsOceania.urlOceania.(@urID==1).etc}"
    Thanks in advance aktell2007

    Thanks for the confirmation.  7 miles away is most likely using the same VZW tower but it does confirm the problem is not in your current location for us.
    You can look up local tower locations from many public websites such as the following:
    www.antennasearch.com
    www.cellreception.com
    http://www.evdoinfo.com/content/view/2990/63/
    The signal of -65 shows you have strong reception but it doesnt show the entire picture.  Your tower could be overloaded or unauthenticating you.  There are lots of little issues that exist outside of the raw signal strength between the towers and the connecting devices that we users have no control over.  As you may guess only a tower tech has access to identify and correct these things.
    Based on the picture of the back of the MBR1515/Netgear N300 router from Netgear I would assume that only a normal sized SIM card will fit.  I would not assume a micro SIM card will fit.  Since I do not have access to either of the VZW or non-VZW 4G LTE router I cannot confirm if it will work or not.  You might have to give Netgear a call and ask.  Based on what I can see from the User Guides of both devices the SIMs used for each should be compatible with eachother.
    If you decide to purchase the non vzw version please post back your findings for us.

  • Can anyone help me open these InDesign files?

    I've been trying all day to open files for a project I was working on in March with InDesign.  I could open them in March but now my computer is either crashing from trying to load the folder that contains the files, or it gives me one of two error messages.  The first saying I don't have permission to open the file, the second saying the file is already open with another user.
    I have tried opening from my computer and from an external drive, neither work.  I have tried restarting.  I've tried opening as a copy, original and normal.  I've tried opening InDesign as an administrator.  I have tried phoning Adobe and have been on hold for 25 minutes so far.  I have tried the online help but nobody available there.  I don't know what else to try.
    I can create a new InDesign files and I'm not having any trouble with any other Adobe products.  My subscription is until 29th August.  Any ideas appreciated.
    Thanks,
    Angs

    If you open it in a plain text editor, what do the first few lines look like? If there's no lock file, the next most likely cause for this error is that the files aren't really .indd files.

  • Batch importing Word files into separate InDesign files

    Hi,
    I have what I though would be a fairly common question, but I can't seem to find any information about it in this forum or on the web.
    I have a folder of Word files (over 100, which is why I don't want to do this manually) and one InDesign CS4 file that I'd like to use as a template (basically it's just a couple of pages with some threaded text boxes and a few images). I would like to write a script that will go through the Word files, one by one, and pull each into the text box in the InDesign file before saving it as a new copy (ideally with the same name as the Word file). So, if I have 100 Word files and one InDesign file in a folder, I'd like to be able to run a script and end up with 100 new InDesign files.
    I think I can deal with importing and placing the text, and saving the file again. It's mostly the question of using javascript to go through a folder to find all of the filenames so that I can pass the name to the import file command that is confusing me.
    Oh, I'm on a Mac with OS 10.6 and using InDesign CS4.
    Thanks!

    Before reinstalling (which is most often unneeded) it would be useful to test the way the app behave when it is used in an other User Account.
    If it behave flawlessly, no need to reinstall it.
    If it doesn't, it *_may be useful_* to reinstall it but it's not sure.
    Nothing prove that the problem is really linked to the installed application's files.
    It may be linked to a file built on the fly like preferences or fonts cache…
    Yvan KOENIG (VALLAURIS, France) vendredi 3 décembre 2010 15:55:58

Maybe you are looking for