Switch layers Script Question

Hi I have a small script here which someone of these online forums there is too long... it was Christmas? Whatever it is, this script is fantastic and brings up a submenu for the documents. When the menu appears, it displays a list of all the open documents in Photoshop. (Actually, I modified this script so there is no switch documents instead of copy the active layer to another document... somehow I managed with very basic knowledge, I )

The selection of default document (the name of the document that is highlighted in the menu) when the list is opened is '0 '.

I am looking for a way to recover the highlighted selection to take into account the document assets instead of '0 '.

I think it's somewhere in this line of code:

victory. NewList.selection = 0;

and I tried to change the value 0 to "actLay" and also "activeLayer" but he throws me an error message. Is there a way to get the current document as the selection? Here's the code...




var aDoc = app.activeDocument; 
var AllDocs = app.documents; 
var actLay = aDoc.activeLayer; 

if (AllDocs.length > 1) { 
var itemDoc = null; 


var win = new Window("dialog","Switch Documents"); 
this.windowRef = win; 
win.Txt1 = win.add ("statictext", undefined, "Switch to which document?"); 
win.NewList=win.add ("dropdownlist", undefined) 
for (var m = 0; m < AllDocs.length; m++) { 
win.NewList.add("item", AllDocs[m].name)  
} 
win.NewList.selection = 0; 
itemDoc = win.NewList.selection.actLay; 

win.cancelBtn = win.add("button", undefined, "Switch"); 


win.cancelElement = win.cancelBtn; 



win.NewList.onChange= function () { 
    itemDoc = win.NewList.selection.index; 
    return itemDoc; 
    } 

win.show(); 

app.activeDocument = app.documents[itemDoc]; 

app.refresh(); 
} 

Here is your code of origin with only slight changes:

Added a var to contain the index of activeDocument.

Added if statement to set the variable above.

Added a line to set the dropdownlist selection.

You should also start the scripts with the target application. In this case: #target photoshop

#target photoshop
    var aDoc = app.activeDocument;
    var AllDocs = app.documents;
    var actLay = aDoc.activeLayer;
    var activeIndex;//add var to hold activeDocument's index

    if (AllDocs.length > 1) {
    var itemDoc = null;  

    var win = new Window("dialog","Switch Documents");
    this.windowRef = win;
    win.Txt1 = win.add ("statictext", undefined, "Switch to which document?");
    win.NewList=win.add ("dropdownlist", undefined)
    for (var m = 0; m < AllDocs.length; m++) {
    win.NewList.add("item", AllDocs[m].name)
    if(AllDocs[m].name == aDoc.name){activeIndex = m}//set activeIndex if activeDocument name matches current doc in list
    }
var docR = activeDocument

    win.NewList.selection = activeIndex;   //Set selection for dropdownlist

    //itemDoc = win.NewList.selection.actLay;

    win.cancelBtn = win.add("button", undefined, "Switch");  

    win.cancelElement = win.cancelBtn;  

    win.NewList.onChange= function () {
        itemDoc = win.NewList.selection.index;
        return itemDoc;
        }  

    win.show();  

    app.activeDocument = app.documents[itemDoc];  

    app.refresh();
    }

Tags: Photoshop

Similar Questions

  • Unity double switch integration - licensing question unity 4.0 (3)

    Unity double switch integration - licensing question unity 4.0 (3)

    The unit was sold as a single IP integration. My client needs Dual Switch with an Ericsson PBX. I received the license key of ORC, and I opened a folder of TAC.

    TAC said that the license file will not allow installation double switch integration. The Cisco SE on the account indicates that the license key will allow me to make the integration of the double switch.

    Who is right? I heard that the moderator here has all the answers :)

    The is correct. Any customer with a license 4.0 can do double switch. You don't need a special permit.

    Thank you

    Keith

  • Firefox is having "Script" questions (no response) und eventually Flash issues?

    Okay, downloaded Firefox for the first time like a year yesterday. It worked perfectly, oh, how I missed it. I hate using Google Chrome with a fiery burning passion.

    However, although it worked perfectly yesterday, I have not downloaded anything or has any plug-ins/extensions, whatever.

    Today, however, I can go on www.google.com (on firefox), but if I try to go on my site banks, Habbo.es, or something like that, all the sudden Firefox decided to hang. It freezes und I get that annoying "(ne répond pas)" upstairs. " I have to shut completely out of the browser, open und renounce session restore.

    Some websites is okay, however, it seems that many of them are not.

    I get a script error message, this day for Neopets.com , which displayed was "lookout.bluecava" or something like that. Asked if I wanted to wait for script to respond or if I wanted to stop him. Whatever it is, it ends with closing me und on return from google.

    Ask this question, I had to re - download google chrome, und log in from this browser since Firefox is not even want to support right now, it's own support forum! Stuff of crazy, right?

    In any case, since it is having a problem with "script", I went to java, made sure I had the java update installed on my computer, then I made sure that I got the update java plugin. Und I even downloaded java 64 bit for him as well, the 7u45 or something else.

    So, my java on my comp und firefox browser are apparently up to date, und the thing of the add-on for Firefox to check if the plugins are up to date says that they are all up to date.

    Still having the issue. At the time where I go to imvu or another site that has this issue, it freezes for 10 seconds und that's all she wrote.

    So I'm not really wanting to go back to Google Chrome for another year, I miss the hell out of Firefox.

    To add: the question that I have now with Firefox is the same problem, I had a year before, when I had to uninstall firefox und go with Chrome in the first place.

    But, since yesterday it was normal when I installed it, I thought it was fixed. Wrong in less than 24 hours.

    Before I submitted this, I decided to jump on Firefox und try something.

    I disabled the Shockwave Flash und plugins Shockwave Director. Now, Firefox works again.

    so.

    He asks me if I want to install the 'flash' plugins needed to view content on the page (I used Neopets.com trying after disabling the Shockwave), but still runs.

    So, what should I do for flash? Or better yet, what is happening with it?

    I downloaded the flash yesterday in a half hour startup of Firefox after you download it. Und it worked very well for hours.

    I turned off the computer, he packed up, went home, back to work, hop on the net und BAM. All the shock wave suddenly is having problems with Firefox when nothing was done he commit? Is not supposed.

    Other info:
    Windows 7 Home Premium on HP laptop.

    Well, I don't know what was the root cause of the problems I had. But I had a friend completely erase my computer und installation Windows 7 Professional on this topic. Und now, I no longer have problems with Firefox about flash. It's purr in this Department.

  • 10.2 ATG with sendEmail script question

    Hi all

    I use ATG10.2, and I have created a registry script that sends an email, welcome as email of new records.

    I have configured all the smtp properties, but the email is not send. I checked the property of the EmailEtat function in the profile, and it's valid status.

    I don't have any error, and debug component scenarioManager I saw that the event is atg.dps.Register, it seems.

    But I got this in my debug as:

    "the individual instances 0 were found for the user object: 4604715.

    Any idea?

    Thanks in advance

    Not sure what exactly is the problem in your environment, but just throw in some ideas... TemplateEmailSender has a property to send emails in the same thread. You can check that I think that for the events of local scenario it can be safely set to false.

    Try to set dummyMode to true in SMTPEmail and check if you can see all of the markup of your email template rendered in the console ports server logs / every time e-mail action is triggered. I say this just to confirm that e-mail action is getting triggered after each event registration, so we're good up to this point. Sometimes, if you have multiple instances of ATG to connect to the same database, it is possible an instance of thugs (who might have been saved as ESG/PES) may out messages before internal event queue JMS gets it a legitimate server. So be sure that you are not running in this kind of situation.

    In the ATG, when e-mail messages are sent using sender of model, an HTTP request is generated and maintained to make the JSP email template. So another area, you can watch it if any custom pipeline servlet which is originally a question because this request goes through the pipeline.

  • VM model deployment Script Questions

    I found a script to launch some virtual machines from a template via the import-csv via this script:

    $vms = Import-CSV C:\Scripts\NewVMs.csv
    
     
    
    foreach ($vm in $vms){
    
          $Template = Get-Template $vm.template
    
          $VMHost = Get-VMHost $vm.host
    
          $Datastore = Get-Datastore $vm.datastore
    
          $OSCustomization = Get-OSCustomizationSpec $vm.customization
    
          New-VM -Name $vm.name -OSCustomizationSpec $OSCustomization `
            -Template $Template -VMHost $VMHost -Datastore $Datastore -RunAsync
    
    }
    

    I have a few questions...

    I would like to add the virtual machine to a cluster of data store (running esxi 5.0) and not a specific datastore... not sure the powercli command to do this, I guess I would replace just datastore in the script with X X being any cluster data store are called in the cmdlet.

    I want to add to a real cluster, not a VMHOST... and I'm not sure the order to replace VMHOST with...

    Is it possible to add RAM, CPU and the location of the folder to put the virtual machine in this script? Obviously I would need to add those in the excel file.

    Any help would be appreciated.

    Thank you!

    You can pass a name of DSC on the parameter data store.

  • Action script question on a loop to a part of the line of the time

    Hi all!

    You have another question about an action script editing in Adobe Flash. Earlier this year, I asked for help to set up a script of action where the video itself would start when the user hovers over the scene and loops from the beginning to the end.

    Now, I need to adapt it so that instead of a loop all the way back to the beginning, it goes rather to the points later in the animation (for example, say 10 seconds in) rather than backwards to the beginning.

    The Script that was created for me it was:

    FLV.source = "Flash.F4V";
    flv.autoPlay = false;

    flv.autoRewind = true;
    flv_btn.addEventListener (MouseEvent.ROLL_OVER, rolloverF);
    flv_btn.addEventListener (MouseEvent.ROLL_OUT, rolloutF);

    function rolloverF(e:Event):void {}
    FLV. Play();
    }
    function rolloutF(e:Event):void {}
    FLV. Stop();
    }

    flv.addEventListener (Event.COMPLETE, completeF);

    function completeF(e:Event):void {}
    FLV. Play();
    }

    Now, I think that what needs to be changed is the autoRewind = true section, but being a complete novice, I don't know where to start. I've seen articles online on a goto command, but my attempts to change the code did not work properly. Any ideas?

    use:

    FLV.source = "Flash.F4V";
    flv.autoPlay = false;

    flv_btn.addEventListener (MouseEvent.ROLL_OVER, rolloverF);
    flv_btn.addEventListener (MouseEvent.ROLL_OUT, rolloutF);

    function rolloverF(e:Event):void {}
    FLV. Play();
    }
    function rolloutF(e:Event):void {}
    FLV. Stop();
    }

    flv.addEventListener (Event.COMPLETE, completeF);

    function completeF(e:Event):void {}
    FLV. Seek (20);  use the right time

    FLV. Play();

    }

  • Newbie script question: how to change a story in a particular style

    I am new to scripting and I'm getting to know the built-in script FindChangeByList. (I use InDesign CS4 for Windows.) I use the excellent script to find tapes of changes by Martin Fisher (modified by Kasyan Servetsky). It works brilliantly, but I have a question. I want to add a string of FindChangeList who take an object any selection or history and put it all in a style particular (the real name of my style is "Body2.TextIndent"). This should be the best thing to do, but as a newbie, I'm puzzled. The only thing I could come up with was to find 'any character' and replace it with the style I wanted, so something like this:

    text {"findWhat: ' ^?} "} {appliedParagraphStyle:"Body2.TextIndent", changeConditionsMode:1919250519} {includeLockedStoriesForFind:false, includeLockedLayersForFind:false, includeHiddenLayers:false, includeMasterPages:false, includeFootnotes:true, wholeWord:false, caseSensitive:false} //Transform the history in the Body2.TextIndent style

    This does not work, but it's very, very slow. I guess the program must change all the characters of the style I want, that's why it takes so long. Is there a faster and more efficient way to write this? Yet once, I'm just trying to turn the story into a particular style. Obviously, this could be done in two clicks in correct InDesign, but I want to integrate this into the syntax FindChangeByList.

    Thank you!

    P.S. is there a difference in the use of FindChangeByList in the Javascript version compared to the version of Visual Basic? I took the version of Visual Basic to chance and that's what I use.  (I use the script to find tapes of change to develop my strings, as I indicated above.)

    Of course, this could be done in two clicks in correct InDesign, but I want to integrate this into the syntax FindChangeByList..)

    Why do you want to use FindChange for this? It is horribly inefficient. Whence this requirement? Or you just want to tell you want to do in a script, not that it must be a FindChange script?

    The paradigm of right in the scripts here is the same that interactively - set the appliedParagraphStyle for each of the selected paragraphs, a loop on those paragraphs. Do not do operate at the level of the character and do not use FindChange.

  • Script question simple calc

    Hello

    Newbie question here. I have the following Calc script for which I am trying to affect the projected balance sheet amounts based on a Jun (last period) closing balance. i.e. I want to forecast my account of Fund to be $ 100 next year, and I use this calculation to allocate the balance of the previous month.

    FIX (& CurrYr, Business Plan, "0000")
    '1000001' = (Jun) / (Jun-> & PriorYr->->-> "0000" final actuals) * (& PriorYr->->-> "0000" final actuals);
    '1000002' = (Jun) / (Jun-> & PriorYr->->-> "0000" final actuals) * (& PriorYr->->-> "0000" final actuals);
    '1000003' = (Jun) / (Jun-> & PriorYr->->-> "0000" final actuals) * (& PriorYr->->-> "0000" final actuals);
    '1000004' = (Jun) / (Jun-> & PriorYr->->-> "0000" final actuals) * (& PriorYr->->-> "0000" final actuals);
    '1000005' = (Jun) / (Jun-> & PriorYr->->-> "0000" final actuals) * (& PriorYr->->-> "0000" final actuals);
    ENDFIX;

    Probably very few effective, but it works. If "1000000" is the parent of all of the accounts listed above, how can I change this statement to FIX to work for slices of accounts?

    My dense dimensions are account and period. The rest are rare.

    Thank you!

    You can try something like

    Fix (&CurrYr,Enterprise,"0000",@Children ("1000000"))
    Plan = (Jun-> Plan) / (Jun-> & PriorYr-> actual spending-> Final-> "0000") * (& PriorYr-> actual spending-> end-> "0000").
    ENDFIX;

  • Apple Script Question

    I am learning Apple Script and I came across a roadblock. I was playing around with "get position and it does not work."

    The script is: tell application "Finder" to get the position of Finder window 1.

    It compiles OK but when I run it I get this error: error "Finder has been an error: cannot get the window id position Finder 661 ' number 1728 from the position of the Finder window id 661.

    My latest version of Mac OS is 10.11.5.

    The script editor version is 2.8.1.

    Also I use Apple Training Series: Applescript 1-2-3.

    Thanks for any help.

    Replace postion by position.

    (143422)

  • Script question

    I use the JavaScript below to close the browser for my booth - it works for IE but not FF - suggestions?

    <script>
    function closeTop()
    {
      var top = window.open("", "_top");
      top.close();
    }
    </script>
    
    <a href="javascript:closeTop()"> Close </a>

    When Firefox gives him a warning, the user does not see it seems that in the error Console.

    Can we have users launch the training using window.open() module in another page, or can only be launched by starting Firefox?

  • Switch Y570 GPU question

    Hello!
    I have a problem with the switch that changes the 2 GPU. I read that you need to keep it rocking. I support just on me and he passes, but the light would not light is located next to the switch, so I don't know what GPU that I currently use. Is this a driver problem or should I contact my guy guaranteed local?


  • Scripting question - how do you close an application

    I got an excellent script by Bill James that opens a series of requests after having timed delays (see below). I would like to adapt the script to CLOSE an application that has been opened, but does not know how to do this. Any tips? Thank you

    PJS

    Script delay, Bill James (http://billsway.com/vbspage/)

    SecondsToDelay = '5 '.
    ProgramToRun = 'iexplore' [insert the full path]
    Wscript.Sleep(SecondsToDelay * 1000)
    PROG = Chr (34) & ProgramToRun & Chr (34)
    CreateObject ("WScript.Shell"). Run (Prog)

    SecondsToDelay = "10".
    ProgramToRun = 'winword' [insert the full path]
    Wscript.Sleep(SecondsToDelay * 1000)
    PROG = Chr (34) & ProgramToRun & Chr (34)
    CreateObject ("WScript.Shell"). Run (Prog)

    Thank you. Will do.

    PJS

  • WRT320N used as switch gigabit single - Question

    Hello friends,

    I use WRT320N a few days now and I'm happy with it so far! It has not overheated as many people reported and performance is also great (wifi and gigabit ports). I tested all the functions (NAT, Advanced Wireless Settings, Port Forwarding,... Access Restrictions) - all the great work, but I'm bit stuck on that easier - temporarily configure it as regular gigabit switch with an IP address: I put my cable WAN and LAN cables in ethernet ports 1-4. NAT, DHCP and firewalls are disabled in the router. I have the DHCP server in my network which is based on the MAC address IP address assignment. In "Setup" > "Basic settings" > "Router IP," I want to set up automatic configuration - DHCP, but it is not possible, so I just type the same IP address, it must obtain from the DHCP server (in this case 10.109.249.42). All ethernet ports 1-4 has the same MAC address (in this case, 00:25:9 C: 4 d: 16:86)?

    Everything works fine, my computer's IP addresses are correctly assigned (as well as wifi devices) from the DHCP server on my network, but I feel like WRT320N address is unaffected - the problem is that I can't connect to the router under http://10.109.249.42 administration. There is no IP restrictions for remote management. Any ideas?

    Screenshot of my "status" > "Local network".

    Routers Linksys WRT are not designed to be used as a simple access point/ethernet switch. That's why you won't find any configuration options you like for this configuration. You must configure a static IP address to the address LAN IP on the WRT. There's no other way. It's always a static IP address. The WRT will never get the address LAN IP of the server because it is designed to serve as a internet gateway and the DHCP server.

    It is clear to me why you are not able to access http://10.109.249.42/ while you are able to access the status page...

    Is the computer from which you are trying to access the router within the 10.109.249. *?

  • IPCC Enterprise 5.a Script question

    Hello

    I have a problem of script in an environment of IPCC Enterprise 5. 0a.

    What I need is:

    I want to have the option of specifying a particular agent I want to call by pressing numbers of the officers 'CDA' line. (Just like in the script of Agent2Agent) If the agent is busy, the call should be queued to the agent. If the Agent is not connected, it should give a busy signal.

    Here's what I did:

    In the script editor of ICM, I use a 'Run external Script"in which I use the 'Dec' to get the number of the Agent. After that, I use a QueueToAgent node. In the QueueToAgent node, I'll choose the agent on 'Search agent refeerences by the expression', because I have 200 agents in the system. Otherwise, I could have used the "explicit references Agent" (it works just fine, but then I have to use a lot of IF-nodes and QueueToAgent to get I work for all agents).

    Y at - there someone who can help me solve the problem...

    Attached document contains: Skillgroup, EnterpriseSkillgroup, EnterpriseRoute, Agent Configuration + screenshot of formula I used ScriptEditor

    Try to use the Agent node tab queue files in the Scripts of the ICM

  • IPCC Express Premium Script question

    I made the script that records the message of the appellant on the disk and that it plays to the agent when it is available. But if another caller left the message that the new replaces the old. How to set the variable in order to overcome this problem?

    THX

    There are referential holiday Cisco Script script, which will show you how to read the current date to convert to string.

    Wei

Maybe you are looking for

  • When they end OS Support?

    For mid-2009 Mac Pro, 7 years later, not by Sierra. That means, if I buy a 'new' trash Mac Pro with 2013 vintage pieces, it run any OS beyond 2020? I'm worried that buying a new Mac Pro to $4-5 k in the last months of 2016 only give me a 4 year life

  • error 66 has updated constantly failing

    For last three weeks every time that I log out of windows tells me that it is installing update 1 of 1. I only just realized that it is updating the same thing again and again and failing. The update is updated with security updates for Microsoft NET

  • Unwanted rattling is driving me CRAZY!

    I'm a junk ping every minute or two, but it doesn't seem like it has a specific pattern.  It looks identical to the how I adjust the volume upward or downward.  It pings even if the audio is muted.  I thought it would be a program telling me it neede

  • No updatable Sansa product has been recognized

    Hi all I know this has probably been asked before, but I'm stuck. I formatted my Sansa Clip of Zip in Windows 7 and now I can't reinstall the OF or the OS (I'm not sure which would be the correct term here) on this subject. the ideea of formatting ha

  • Vista system stops during startup and asks to press F1 to continue

    I am running Vista32bit Home premium... I was wondering if there was a way to prevent the computer from stop when starting.  My computer stops after the diagnosis of the screen and asks me to press F1 to continue (boots in windows) or delete to enter