How to turn in lots on / turn off the layers in a large group of files

I lifted this code to another debate that is supposed to say it works, but it doesn't.

I get the error message: object does not support the method or property 'length '.

I looked at other scripts to batch process this line of code seems to be OK.

I know it's a very simple script and that the Tower on / turn off the part of the layer of the script works perfectly well (on individuall pages), but for some reason I can't get this lot of process.

I have a set of several version of files with layers like 'from' for the Germany, "us" for the United States, etc. that I need lots open until I can print.

Here's what I have:

myFolder var is Folder.selectDialog ("Select folder Indesign");.

var myIndsnFiles = myFolder.getFiles ("*.indd");

for (k = 0; k < myIndsnFiles.length; k ++)

{

var myIndsnFiles = app.open (myIndsnFiles [k]);

var myIndsnFiles = app.documents [0];

var answersLayer = myIndsnFiles.layers.item ("us");

answersLayer.visible = false;

app.activeDocument.close (SaveOptions.yes);

}

Can you correct/explain what I am doing wrong?

I had the Sergey Version to work. See below. It is very different from my original. I understood why my original wasn't, but could not know how to solve this problem. I tried to insert Laubender code in it, but I got the same error as above "object does not support the property or method 'length.

I made a few adjustments so that the script turns off all the layers that need to be turned off and then turns on the layer I need.

Everything works perfectly except that I wonder if there is a way I can disable all warnings, such as missing links, so that it treats the whole batch without a break. Maybe that's what Laubender spoke.

myFolder var is Folder.selectDialog ("Select folder Indesign");.

If (myFolder! = null)

{

var myIndsnFiles = myFolder.getFiles ("*.indd");

for (var k = myIndsnFiles.length - 1; k > = 0; k-)

{

Try

{

myDoc var = app.open (myIndsnFiles [k]);

Marquetry var = myDoc.layers.item ('in');

inLayer.visible = false;

var itLayer = myDoc.layers.item ('it');

itLayer.visible = false;

deLayer var = myDoc.layers.item("de");

deLayer.visible = false;

var ukLayer = myDoc.layers.item ('uk');

ukLayer.visible = false;

var usLayer = myDoc.layers.item ("us");

usLayer.visible = false;

var intLayer = myDoc.layers.item ("INT");

intLayer.visible = false;

deLayer.visible = true;

myDoc.close (SaveOptions.yes);

} catch {} (error) ;// try-catch

} ;// for

} ;// If

Tags: InDesign

Similar Questions

  • P5P34EA: how to turn off the FN key?

    Hello

    How to turn off the fn key?

    Please READ: everyone saying fn = f10 or fn + f2

    but it's not doing nothing for me! and ctrl + esc just display

    me information of sistem!

    Help, please

    Thanks, March

    Hello

    Try the next method.

    Hold the left SHIFT key you click Shutdown to temporarily prevent hybrid boot.

    Let off the laptop computer for 10 seconds.

    Start by typing esc button permanently as soon as you press the power button (do not wait for the prompt) and see if it will access the start menu - if that is the case, select f10 to open the Bios Menu.

    Kind regards

    DP - K

  • How to turn off the Toshiba Hotkeys properties?

    How to turn off the Toshiba Hotkey properties so that I can install Microsoft Money? I get a message telling me that the installation cannot continue because the properties of the shortcut keyboard Toshiba is running, but I don't know how to turn it off, or when it is!

    Hi coxrhu,

    the fastest way to stop hot keys is to remove the Hotkey Services in the Windows startup process.

    Launch msconfig, look at "Startup" and search for "00Thotkey" and "000StTHK".
    This programs are normally responsible for the service.

    Hope this helps
    I will assume no responsibility for accidents to your system or loss of data.

    BR

  • How to turn off the microphone on an iPad Pro 12.9 H

    How to turn off the microphone on an inch of iPad 12,9 Pro

    Settings - Privacy - Microphone - disable each app

    Not sure that there is a global setting.

  • How to turn off the pane in the reading mail

    How to turn off the pane in the reading mail

    Hello! I think that the thing by Duane helps you solve your problem.

    Show/Hide Preview mail pane

  • How to turn off the blue lights under the speakers on Satellite P100?

    Does anyone know how to turn off the blue lights that lie beneath the speakers on a Satellite P100? They are evil in my sight!

    Thank you, John.

    Hello

    You are a lucky man. This is a very new unit and I wish that I would also have one of the new Satellite models. But you know, the money is the key :(
    However, I don't think that it is possible to put out these fires.
    In my opinion, it is a part of the design of laptops. It seems very futuristically.

  • How to turn off the Wireless on NB100?

    How to turn off the Wireless on Netbook NB100?

    Hello

    The WLan on NB100 can be enabled and disabled by using the FN + F1 keys.
    By pressing Fn + F1 change wireless (Wlan/BT/wireless WAN) and outside

    Welcome them

    By the way; If you check the user manual, then you will find the info too. ;)

  • How to turn off the functions zoom and scroll to the touchpad on the Satellite

    Hello.

    Can someone tell me how to turn off the scroll and zoom for the Synaptics Touchpad v7.2 functions.
    Can't seem to do it via the control panel.

    All of the suggestions.

    Hello

    You can do it in the settings of the touchpad.
    You can find these settings will:

    Control Panel-> mouse-> tab advanced-> button Advanced settings future

    Here you need to uncheck the option called use scroll function

  • My 5s torch lights up when a message arrives... How to turn off the it

    My 5s torch lights up when a message arrives... How to turn off the it

    Check: Settings - general - accessibility - Flash LED for alerts = Off.

  • Satellite U500-1E0 - how to turn off the mouse "by clicking on" noise

    Please can someone tell me how to turn off the little "click" the mouse buttons do when they're depressed?

    Thank you.

    Hello

    What rattling noise do you hear?
    The rattling noise which is made by touchpad?
    Is - this mechanical noise or sound comes from the speakers?

  • How to turn off the 3 g 2g

    Help, please

    How to turn off the 3 g or 2g? I don't want my phone to be constantly pulling down or obtaining data when he feels like it and I can't find the setting. I don't want the wireless on except if I choose...

    Cheers for the help

    If you want to switch between 3G and 2G to save battery: settings | Wireless controls. Mobile networks | Select network.

    If you want to disable the data without the use of airplane mode which also disables your vocation (which looks like), search the market for APNdroid. Great app that will do it. It is light. Just make sure that you have disabled (i.e. to have access to the Internet) before uninstalling. It does nothing with the wifi.

  • How to turn off the microphone for sony hdr-pj260v

    How to turn off the microphone for sony hdr-pj260v

    Hi dstrakal,

    Option to disable the built-in microphone is not available in the camcorder. However, the camcorder has an input jack to connect an external microphone, there are two possible solutions for this:

    1. Connect a microphone with a switch ON / OFF the microphone on the camcorder decision-making. Then, set the switch to the external microphone to the OFF position. This will disable the microphone on the camcorder.

    2. Connect a dummy stereo mini plug to the microphone on the camcorder Jack.

    If my post answered your question, please mark it as "acceptable Solution".

  • I have a dell laptop with windows XP I want to use a wireless mouse but cannot figure out how to turn off the pc mouse

    I have a dell laptop with windows xp I want to use a wireless mouse but cannot understand how to turn off the pc mouse

    Thank you for your help, I saved it for future use. My computer it turns out that's very smart after all the fourth test of every thing, I turned it on and the mouse remotely worked, thanks again

  • Does anyone know how to turn off the Magnifier, don't need but it keep jumping on screen

    does anyone know how to turn off the Magnifier, do not want ir on ANYTIME

    Click the Start button
    All programs
    Accessories
    Ease of access Center

    Then click on "Make the computer easier to use" downwards.

    Then uncheck "turn on Magnifier." Press OK and you're done.

  • How to turn off the constant updates for Vista?

    disable the update

    How to turn off the constant updates for Vista? I'm fed up with them. every day the computer has so much more to do than what I want to do. I put Windows Update automatic to advise me when there are updates available. Update told me that everything is up to date. I turn on the next time and it will automatically download the new 6 * important * uopdates.  XP has never used a parasite like this stuff constantly new download.  HOW CAN I GET RID OF HIM?

    Thank you

    The updates released this week are updated for security. If ignore them, your computer is vulnerable to malicious software.

    http://TechNet.Microsoft.com/en-us/security/bulletin/MS11-Sep

    http://TechNet.Microsoft.com/en-us/security/bulletin

Maybe you are looking for

  • different noise on playback of music

    I get different sound plans with songs on a playlist of songs I purchased on iTunes store. I use an iPhone 6 to store all my music. I spent / or I have to put something to improve the sound quality? any help much appreciated.

  • 32BV801B HD tuner receives do not

    I have a * 32BV801B * I bought about 18 months ago. Recently, it has been an adjustment in the sturdies & for a few mornings seemed to have problems starting up, but I unplugged everything and set it up again and it seemed to work OK. However, I disc

  • Satellite P100-324: problems with the installation of Vista-&gt; cursor flashing

    All greetings. Tried to put one of these days of Windows Vista. But my attempts to failure are completed. After the first? There is a black screen and blinking cursor. So any activity HDD and DVD, it is not respected. Recently updated BIOS updated to

  • Problem when running of several blocks of entire function

    Hello I'm building a great system/function using LabVIEW. Therefore, to practice and make look it tidy, I create a VI of blocks to separate and combine certain functions. But, my problem is when I did, the simulation seems to work really slow and the

  • Curve adjustment not linear function

    Hello everyone: I'm a little new here and at the same time a new learner for labview. My need for laboratory to adjust the data which are not linear, so, I choose to use the model non-linear curve VI. But when I run the VI, the error is that:NI_Gmath