Iteration through the activeDocument.layers is very slow

Hello

I am trying to build a table of all visible layers currently in a document, and the only way I know how to do it is by performing an iteration (by using where loop method) app.activeDocument.layers however, the problem is it is really slow for some reason any. For 37 layers, it will sit there for about 10 to 15 seconds and the mouse pointer will fluctuate between normal and busy pointer.

A few questions:

(a) is there a better way to build the list of visible layers?

(b) why it takes so long to complete this (Note: there is only a single action in the loop that is assigning the active layer in the layers panel to l):

var layers = app.activeDocument.layers;

for (var i = 0; i < layers.length; i ++)

{

var l = layers [i];

}


?

Any help on this will be appreciated!

Thank you

Nate

If you have CS4, you can use the function below to get the index of the selected layers AM.

function getSelectedLayersIdx(){
     var selectedLayers = new Array;
     var ref = new ActionReference();
     ref.putEnumerated( charIDToTypeID('Dcmn'), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
     var desc = executeActionGet(ref);
     if( desc.hasKey( stringIDToTypeID( 'targetLayers' ) ) ){
          desc = desc.getList( stringIDToTypeID( 'targetLayers' ));
          var c = desc.count
          var selectedLayers = new Array();
          for(var i=0;i

There isn't really any documentation by using the Action Manager. The javascript guide that ships with Photoshop lists the properties and methods for the action descriptor, Action reference and list of actions. And the app.object methods to convert an ID.

Tags: Photoshop

Similar Questions

  • Halo 2:When I use my mouse on the line, the cursor movement is very slow and jerky.

    original title: halo 2

    Hello... Just installed Halo 2 on my Windows 7, 64-bit desktop.  I have all the latest drivers. All other games work fine.

    When I use my mouse on the line, the cursor movement is very slow and jerky. Unplayable.

    I was looking for a patch for the game or suggestion on how to correct adjust them.  I tried the option in game of adjustment of moving the mouse, but it did not help.

    Suggestions please...

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

  • the system is running very slow

    slow cursor system, sometimes suspended, desappers of the screen, responding to very slow key board operation,

    Windows 7 is slow

    (1) unplug all devices such as printers, external hard drives, microphone, webcams etc.
    (2) make sure that your BIOS and drivers are up to date. Update of the BIOS can be risky, don't do that if nothing else works.
    (3) defragment your Windows 7 computer:
    http://Windows.about.com/od/maintainandfix/SS/SBSdefragWin7.htm

    (4) reduce the start up programs:
    (A) click Start, type MSCONFIG in the search box and press ENTER.
    OK the authorization of user account control and password if necessary
    (B) on the general tab, click Selective startup.
    (C) then change the tabs by clicking on the start tab
    (D) uncheck the programs that you do not want to start when your computer starts (do not turn off your antivirus).
    (E) click OK, and then restart the computer.

    (5) disable some visual effects in Windows 7
    There are many Visual effects that can be disabled safely to speed up windows 7.
    A. to do this right click on "Computer" and select 'Properties' in the right click menu.
    B. click on "Advanced system settings" in the left pane to open the"System Properties".»
    C. Select the "Advanced" tab from him. Then under 'Performance', click on 'settings '.
    D. now uncheck all the options that you do not want to use (some options disables Aero).
    E. restart the computer.

    (6) open the resolution of Performance problems
    A. open the Troubleshoot utility of performance by clicking on the button start.
    (B) in the search box, type "convenience store" and then click Troubleshooting.
    C. under system and security, click on search performance issues.

  • When I transfer files from my hard drive on a USB flash drive, the transfer rate is very slow, about 250 KB / second. Is it possible to increase the speed of transfer rate

    When I transfer files from my hard drive on a USB flash drive, the transfer rate is very slow, about 250 KB / second. Is it possible to increase the speed of transfer rate

    depends on the speed, support USB 2.0, USB 2.0 ports, and with active BIOS settings

    (2) you can increase the speed, if your motherbaord has a USB 3.0 port and must be enabled in the BIOS

  • Lightroom CC running slow after recent update. [was: most of the time it's very slow]

    After that the 2015 update is very slow to 90% of the time

    Hi raleighg,

    Suggest you follow the steps below:

    1. go in the Lightroom preferences > General > uncheck "Show Add Photos Screen.

    2 preferences > Performance > uncheck "use the graphics processor.

    3 restart Lightroom, and check again.

  • When I try to install Adobe Creative Cloud stops, stops at halfway of the installation point and closes. (The download is also very slow) can someone help me please? Thank you!

    When I try to install Adobe Creative Cloud stops, stops at halfway of the installation point and closes. (The download is also very slow) can someone help me please? Thank you!

    Please, try the following steps:

    Guinot

  • the desktop icons get very slow at startup - compaq presario r4000

    How can I fix a very slow desktop icons appearing very thin & slow?

    Dear friend,

    Please try the following methods to solve your problem
    Applicable operating systems:
    Windows XP
    Possible causes
    1. Several startup programs.
    2. Any startup virus scan.
    3. Corruption of user profiles
    4. ShellIconCache corrupted restaur頳era file
    In this case the shellIconCache file has been corrupted. Its a hidden file located in the windows directory level that contains a copy of all the icons of the desktop by default. To resolve this problem, re-create the ShellIconCache file by deleting.
    Open folder options by typing the command files to RUN quickly. Select view and select Show hidden folders and files , and then click OK.
    Locate the C:\Documents and Settings\Your User of utilisateur\Local Settings\Application Data patch. Delete the file Iconcache.db.
    Restart the computer.
    Concerning
    Jinish.K.G
    HCL Infosystems LTD, Pondicherry
  • My computer does not start, the alarm tone the aa from the hard drive, then back to the top and is very slow...

    My Pc does not start at times, especially first time in the morning, an alarm tone sounds, then it tries to start, Frost pattern on the screen... or black at all. then after pressing the new button could start up of normal, it will be very slow. Help, please

    Hi WolfgangKlinger,

    ·         Did you do changes on the computer before the show?

    ·         You're able to boot in safe mode?

    ·         You get the error message?

    Follow these methods.

    Method 1: Disconnect all external devices except the keyboard and mouse.

    Method 2: Start your computer in last known good configurations.

    How to start your computer by using last good known Windows XP Configuration

    http://support.Microsoft.com/kb/307852

    Applies to:

    • Microsoft Windows XP Home Edition
    • Microsoft Windows XP Professional

    Method 3: Follow these steps:

    Step 1: Start the computer in safe mode and check if the problem persists.

    A description of the options to start in Windows XP Mode

    http://support.Microsoft.com/kb/315222

    Step 2: If the problem does not still in safe mode, perform a clean boot to see if there is no conflict of software like clean boot helps you eliminate software conflicts.

    How to configure Windows XP to start in a "clean boot" State

    http://support.Microsoft.com/kb/310353

    Note: After completing the steps in the clean boot troubleshooting, follow the section How to configure Windows to use a Normal startup state of the link to return the computer to a Normal startupmode.

    After the clean boot used to resolve the problem, you can follow these steps to configure Windows XP to start normally.

    (a) click Start, run.

    (b) type msconfigand click OK.

    (c) the System Configuration Utility dialog box appears.

    (d) click the general tab, click Normal startup - load all services and device drivers and then click OK.

    (e) when you are prompted, click on restart to restart the computer.

    Method 4: Follow the steps in the article.

    Advanced Troubleshooting for General startup problems in Windows XP

    http://support.Microsoft.com/kb/308041

    For reference:

    How to make a computer faster: 6 ways to speed up your PC

    http://www.Microsoft.com/atwork/maintenance/speed.aspx

  • Noise comes from the computer and is very slow

    I just got a new power supply because there was an amber light and installed after the computer is very slow and makes a grinding noise and the fan is ruining very hard.

    My pc is a Dell XPS 410
    Windows Vista SP2
    Here's the part
    1DJ301Kit, mouse, Universal Serial Bus, 2BTN, optical, Lead Free Black1DT240Card, graphics, 7300, weak encryption, MRMGA10, 22X8388Dual In-Line Memory Module, 512667M, 64 X 64, 8, 240, 2RX81HF730Display, flat screen, 20W2007WFP, black, Dell Americas Organization1KJ293Assembly, Panel, fill, floppy, TANK, Workstation1DY654Kit Precision drive, software, works 8.5, Office TRIAL, English1JF495Modem, V.92, Data Fax, SON2 internal, without lead, Dell Americas Organization1MY531Assembly, DVD +/-RW, 16, TSST SATA , READER Black1JX718HARD..., 250G, S2, 7.2 K, 3.5, WD-HAWK0149DFINFORMATION..., PREPARATION MATERIAL..., DEVIATION..., PRECISION WORKSTATION... INCREASE..., #21TH659PLACEMAT..., GETTING STARTED..., DIMENSION..., SYSTEM PERFORMANCE EXTREMES..., 4101YH251GUIDE..., OWNER..., DIMENSION..., PERFORMANCE EXTREMES SYSTEM..., 410, ENGLAND/ENGLISH... 1HU608Kit, software, Norton Internet Security, 2007, 15MTH, English1RH659Keyboard, 104, UNIVERSAL SERIAL bus..., UNITED STATES..., Black, DARFON ELECTRONICS, Corp.... 1JW762Kit, software, packaging, digital video disc VHP32 Drive English1UH837Kit, Speaker, 12V, AS501, Nmb Black001323INFORMATION...,..., CHASSIS NO ITEM1DH108ASSEMBLY......, DIMENSION 9200/410, PWA INTEGRATED... 1JX144Processor, 6300, 1.86, 2 M, Core Duo-conroe, Burn 21NJ131INSTRUCTION... L6 CHAS DEVIATE ON L5.51XP850Assembly, radiator, protective, MATRIX TANK DESKTOP...

    You probably have a hardware problem.

    grinding noise refer to metal on metal contract-fans, hard drive, everything that revolves.
    noisy fans mean generally the CPU is running too hot (for some reason any).
    If you know enough about the material to troubleshoot/fix the problem, Best Buy/s Geek Squad of free basic diagnostics, they will check it out and let you only know what they think is the most likely cause.
  • After 2015, Muse of the update is now very slow

    After you apply the recent update of the 2015 of Muse, everything has become very slow.

    I worked on the same websites to Muse over 12 months now, and after this update Muse becomes almost unusable.

    I use 2 end 2011 Mac Book Pro:

    1: Mac Os Yosemite 10.10.2,"limited 500 GB SD with 300 + GB of free space, 8 GB of RAM

    2: Mac Os Yosemite 10.10.2,"limited 500 GB SATA with 300 + GB of free space, 4 GB of RAM (backup device)

    A few examples:

    • Use of loading: Pre 2015 update, about 1 minute. Post 2015 update, 2-5 Minutes.
    • A website I'm working on that would take about 1 minute for Site Preview in the browser. The same site, after the update of 2015 takes now up to 7 minutes of preview in the browser. This applies to all sites, the largest site, the longer the delay.
    • Adding an image would take a few seconds to implement now, it may be up to 30 seconds or more.
    • Highlighting a chart area or text box results in similar delays.
    • Loading a page in the chart window will take at least 30 seconds or more.
    • Preview a site in Google Chrome - page loading lasts up to 3 minutes.
    • Preview a site in Safari - loading pages lasts up to 3 minutes each, the scrolling is fragile.

    Basically, what I could do in 1-2 hours before the update can take throughout the day now, if I can perform a task at all.

    Suggestions (with the exception of the most recent purchase Mac ) to speed up the update of Muse 2015?

    Scientific tests not here, but I think that the creative cloud App can have some influence here.

    I've been playing with the firewall settings after discovering the CC tried to synchronize files - which would take approximately 47 hours! Hmmm.

    After pausing synchronization CC disable firewall from Apple, then juggle some more with it and turning back on, I noticed a speed immediately gain Muse and the problems that I said that I had. Not to say that it is suddenly fantastic once again, but I'm now at a point where the Muse is still usable.

    Also, I had the bad evil with flow here in Indonesia. No more.

  • The graph refresh is very slow with large data sets

    When the graphics of large sets of data in tiara, the construction of the graph is slow (3 pts M takes 30 sec). Fair enough-, the problem is, however, some little change do you later to the curve, it will refresh all over again, and during this time you can't do anything else with DIAdem.

    Any way to relieve it?

    Problem seems to be solved - restart of DIAdem restored time to update to an acceptable level, or at least it seems that restarting is the only change.

    I tried later with the two parameters of charge mentioned by AndreasK and both just as powerful.

    I tried remote desktop access and it works all too well - also go remote DIAdem (to see if it's a graphics driver issue)

    I feel kind of silly not being able to identify what was wrong and I thank you for your help.

  • The system performance is very slow

    Original title: Servicepack3 uninstall

    My Inspiron Dell1501 is running slower and slower with symptoms as follows (as well as Missig on the charater occaional... that this example)... Running Windows Home edition 5.1.2600 SP3 build2600...

    C:/windows has many $NtUninstallKB files * $... I can't help thinking that they should not be there... what they are... they are updated to SP and could not clear?

    also

    Start/environment/information software system research... There are many progsduplicated running (cannot identify the applications), but users are listed as "NT Authority system" AND "Default". This might be the reason when I open a Word or Excel file, the system tells me that the file is already used and I want to make a copy. I always click on no.

    Windows error reporting log shows many system block also?

    also I often lose connectivity with my Internet Explorer automatically retrieves.

    Ideas please or do consider a shop for a drains

    Thank you

    Hi mowerv,

    1. don't you make changes before the show?

    Your original title is uninstall service pack 3. Did you install service pack 3 before the show?

    In addition to the suggestion of JRosenfeld:
    If the problem persists, restore the computer to an earlier time and check if the problem persists.
    See How to restore Windows XP to a previous state

    See also, How to remove Windows XP Service Pack 3 from your computer

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • How to improve the performance of the computer which is very slow at startup in Vista?

    WOT programs I need to run at startup my slow cam of computers verry because someone helpRemember - this is a public forum so never post private information such as numbers of mail or telephone!

    WOT programs I need to run at startup because it takes 7 to 10 minutes to get running?

    Ideas:

    • You have problems with programs
    • Error messages
    • Recent changes to your computer
    • What you have already tried to solve the problem
    Saturday, may 29, 2010, 11:46:15 + 0000, dave wilson332010 wrote:
     
     
    > full throttle programs do I need to run at startup because my computer verry slow cam, someone help
     
     
     
    Everyone is different and has different needs and different desires.
    There are * no. * programs that everyone should run. See below for
    Tips on what you should maybe stop start automatically,
    But first of all to consider the possibility that your problem with what he is
    slowly maybe nothing to do with what starts automatically.
     
    Perhaps the most common performance issue of today is malware
    infection and the first thing you should do is be sure that you are not
    infected. So, what anti-virus and anti-spyware programs run, and
    If they are updated?
     
    Once you talked about this question and that is rid of all
    Malware or get assured that you are not infected, you can address
    the issue of automatic startup programs:
     
    First of all, note that you should be in * all * programs that
    starts automatically, not only those who enter in the system tray.
    Not all the programs auto-start manifesting by an icon in the
    Status bar.
     
    On each program, you don't want to automatically start, check its
    Options to see if he has the choice of not start (make sure you)
    Indeed choose not to run, not just a "don't show icon.
    Optional). Many can easily and better be arrested like that. If that is not
    work, run MSCONFIG from the start. Run the line, and then click the Startup tab.
    Uncheck the programs that you do not want to automatically start.
     
    However, if I were you, I wouldn't do it just for the application of
    the minimum number of running programs. Despite what many people say
    you, you should be concerned, not with the way * a lot * of these programs
    you run, but * that *. Some of them can degrade performance severely, but
    others have no effect on performance.
     
    Don't stop all programs to run willy-nilly. What you need to do
    is to determine what each program is, what its value is up to you which
    the performance cost is its running all the time. You can try
    Internet search and ask questions about the details here.
     
    Once you have this information, you can make a smart informed
    decision on what you want to keep and what you want to get rid of.
     
     
    Ken Blake, Microsoft MVP (Windows desktop experience) since 2003
     

    Ken Blake

  • BlackBerry Smartphones updated using the BlackBerry Desktop Manager - VERY slow!

    Hello

    Brand-new Blackberry.

    Updated the OS on my 8530 using the Desktop Manager software version 5.0.1 pc and the usb to the phone connector. I started at 11:00 this morning. It's now almost 15:00.

    It always shows 346 528 modules in the device software download part of the process. At this point, it's a failure... But he said not to disconnect your device... or other.  What now? Very disappointing.

    --

    Bill

    'Now for the future... ". I do NOT recommend the use of desktop upgrade of the Unit Manager, ever. It is simply too buggy and too many things can go wrong happen with which you have no control. »

    I tried the update site as you said but made the mistake of direct download instead of dl to pc and then to the phone as you said. Then... Well, I found the best way yet: I'll take it to the Verizon store and ask them to do every time. I'm a pretty grumpy guy, being a programmer and all except... I just haven't the patience or willingness to spend that kind of time with a phone. I mean - it's a phone. Really?

    --

    Bill

  • The function "Remove the device safely" is very slow

    When I click the icon 'Remove hardware safely' in the notification area, it takes a long time to display the list of devices.

    It is a new installation of Windows 7 Ultimate 32 bit on a new ThinkPad.

    Suggestions and advice are welcome.

    It seems that the wait is simply the same. I think that when you click on the safely remove icon, it triggers the same process as the opening of the devices & Printers. In addition, I noticed that the results of the analysis of material seem to be cached for a while if you open devices & Printers first.

    Better prognosis:

    The feature is slow because it is by making a list of all the things attached to the laptop from scratch (almost) every time that we click on the icon.

Maybe you are looking for

  • No caller ID

    Hi, I just activated my 60 minutes a month of the microsoft office pack credit. When I call my phone, it does not show a caller ID. How can I fix it?

  • Satellite M100 PSMADL - what drivers do I need?

    I bought a Satellite M100 18 months in Singapore.I would like to update its drivers & BIOS etc but I can't identify with certainty at 100% which model I have exactly.The part number on the underside of the laptop reads as follows: PSMADL - 00G 005 Ca

  • Incorrect values of frequency quadrature encoder measurement

    Hello I use a rotary encoder with the slice has and tranche B and an exit on the ground, attached to an M - series SCB-68 that is attached to an NI PCI-6221. I use the soul hollow low frequency Freq 1 Ctr.vi I added some time a loop to and is attache

  • my computer gives error 80080005. Can not find new downloads.

    Who can help me. My computer gives error 80080005. He can not find new downloads.I used Windows Vista Edition home premium. Peter

  • mobile mouse wireless MS 4000

    Wireless MS Mobilec mouse 4000.  What is the purpose of the silver button on theleft side?