Help with the scripts of "event handler".

Ok. I am new to using event handler and the Listener Script for I have not every little thing down yet.

What I'm trying to do is set up an event handler to activate a script when I select a layer. As I have now, the active script no matter what I choose and I'm unable to limit it to only activate when I select a layer. The ScriptListener output was:

var idslct = charIDToTypeID ("TPCV");
var desc10 = new ActionDescriptor();
var idnull = charIDToTypeID ("null");
ref19 var = new ActionReference();
var idLyr = charIDToTypeID ("Lyr");
ref19.putName (idLyr, 'Face');
desc10.putReference (idnull, ref19);
var idMkVs = charIDToTypeID ("MKV");
desc10.putBoolean (idMkVs, false);
executeAction (idslct, desc10, DialogModes.NO);

I used TPCV under the name of the event during the creation of the new event in the event handler. However, this same ID is used when a tool is selected. This isn't a huge problem, but for the fact that my reason for setting this up is so that when I select a layer, first I want to implement a predefined specific tool to use on it. If I can change the tools (select another tool) and have always the same layer selected in the script automatically selects the initial tool to the layer which is always selected this layer is always the active layer.

Example: Suppose I have the following layers...

Texture

Heal

Tones

Eyes

Lips

Face

These are not my normal layers, but for example when I select the layer "Cure" I would like to start with the Healing Brush tool. However, sometimes I want to use clone on this layer as well. Using the event at this time, Heal would still be the active layer when I make the choice to the clone tool so the script would then return the selected tool, Healing Brush tool.

So, is it possible to limit the selection event ID to activate only when a layer is selected? I noticed that the line above in bold/red is the event ID of layer. I don't know how to do this in the event handler or the script.

Thanks for any help.

Mike

Here ya go...

//
// SelectLayerHandler.jsx
//

function _selectLayerHandler(desc) {
  // do whatever when a layer is selected
  var doc = app.activeDocument;
  var layer = doc.activeLayer;
  alert("Layer " + layer.name + " selected");
};

cTID = function(s) { return app.charIDToTypeID(s); };
sTID = function(s) { return app.stringIDToTypeID(s); };

try {
  if (arguments.length >= 2) {
    var desc = arguments[0];
    var event = arguments[1];
    if (event == cTID('slct')) {
      var ref = desc.getReference(cTID('null'));
      var cls = ref.getDesiredClass();
      if (cls == cTID('Lyr ')) {
        _selectLayerHandler(desc);
      }
    }
  }
} catch (e) {
  alert( "Error: " + e + ":" + e.line );
}

"SelectLayerHandler.jsx";
// EOF

Tags: Photoshop

Similar Questions

  • Can someone help with the scripts on this file?

    Hi, I hope someone with a bigger brain can help me here.

    I have an existing Flash CS3 file that makes up the result to http://www.infusion-set.com/Flash/eLearning/Inset30/inset30_eguide.html .

    The customer asked if I could add an extra tab at the top after that 'group' called 'Contact us' with link to an additional page. The design was done in ActionScript 2 with references to XML files for dynamic content because it has been done in other languages.

    I modified the XML file with the correct references to a new page and a .swf file that accompanies it to play in the field of animation.

    I tried a .fla version where I duplicated one of the existing tabs script, changed the XML references and changed the variables if necessary to "con or"Con"(which is to reach us). Unfortunately, he made the menu tab go completely off the page and was patently false in some way.

    Can someone give me a clue as to what to change here on the original file that I am a novice with ActionScripts, so ask me.

    For reference, I have attached the HTML files with scripts of original file and my incorrect version. The chronology is 103 images with the scripts placed in frame 1 and 102

    Thank you.

    Garry

    The buttons are all created using the same library object (but MC), except for the code you have in the revised file does not call on it for the con button.

    You calling on something with a name of 'con' link, which tells me that a quick check is not - then it is undefined in the code when you try to use it.  I found this by using trace (newConBut._x); After its _x value was assigned, as I said, you should try.   So the first thing you want to do is to change the following line from...

    var newConBut = _root.attachMovie ("con", "conbut", _root.getNextHighestDepth ());

    TO

    var newConBut = _root.attachMovie ("but", "conbut", _root.getNextHighestDepth ());

    so that it uses the but MC who is used to this end in the library.  So, you want to correct the assignment _x of the buttons and I think that you had previously...

    newConBut._x = 650 - newConBut._width;
    newRecBut._x = newConBut._x - newRecBut._width;

    Here is a picture of what these changes (note, without the XML file, I had to finagle things just to work, then the labels of biutton are not what they will be)...

  • Help with the flow of events!

    I'm in trouble during the expedition and listening to events in my application, I can send events from an object that is not on the display list and have a display object to listening to this event?
    I do the following, I have a DataGrid component listening to an event he is sent to a non-visual object. the event contains information on the new dataProvider for the DataGrid, here is the code:

    With the DataGrid component
    "" < mx:TitleWindow xmlns:mx = ' http://www.adobe.com/2006/mxml ' layout = "vertical" width = "550" height = "600".
    showCloseButton = "true" closed = "PopUpManager.removePopUp (this)" >
    < mx:Script >
    <! [CDATA]
    import com.legosoft.events.DataProviderChangeEvent;
    Import mx.managers.PopUpManager;

    public void manejaEvento(event:DataProviderChangeEvent):void
    {
    pickListResult.dataProvider = event.newDataProvider;
    }

    []] >
    < / mx:Script >

    < mx:DataGrid id = "pickListResult" width = "100%" height = "50%".
    creationComplete = "pickListResult.addEventListener ('newDataProvider', manejaEvento)" >
    < / mx:DataGrid >
    < / mx:TitleWindow >

    Here is the class that dispatches the event

    SerializableAttribute public class GetTiposFacultadesCommand extends EventDispatcher implements Command, responder
    {
    public void execute(event:CairngormEvent):void
    {
    var delegate: BusinessDelegate = new BusinessDelegate (this);
    delegate.getTiposFacultades ();
    }

    public void onResult(event:*_=_null):void
    {
    var _dataModelEvent:DataProviderChangeEvent = new DataProviderChangeEvent ('newDataProvider', false, false);
    _dataModelEvent.newDataProvider = event.result.toArray ();
    dispatchEvent (_dataModelEvent);
    }

    public void onFault(event:*_=_null):void
    {
    }
    }

    The thing is that the DataGrid never receives the event, I have no idea why it doesn't work. Can someone help me?

    The point is that I don't want to pass the instance of the GetTiposFacultadesCommand to intercept the event. The point is to send an event anywhere and be able to catch anywhere in the application.
    I found a solution to this, I have created my own EventDispatcher object as a singleton in the application, whenever I want to send an event and be able to catch him anywhere, I get the instance of this object and send the event, anywhere I want to catch it I get the instance of this object and have to listen to it, in other words, I coded the EventDispatcher object is a generic object that will send and receive events allowing others to get this instance and do something for the event.
    This object has a getInstance() method that returns the instance of this object, don't forget that it is a singleton, there is that only one instance of it in the whole application, any object can obtain this instance and send/receive an event.

  • Help with the problem of event possible mouseEvent/keyboard

    Hi guys, I have problems with a game I've created now.  The problem seems to lie on the mouse / keyboard event.

    Basically I have a character that the player can control using the arrow keys on the keyboard and it works perfectly well on its own.  Whenever the game begins, the player can control the character instantly with the keyboard. Here's the problem now, after that I added another page (in box 1) and created a game start button, keyboard events does not start immediately more.  The player must click on the stage before it works.  Is there a method to solve this problem?

    At the present time, here is my page of the Start button.

    var start_btn:Start_btn = new Start_btn;
    start_btn.addEventListener (MouseEvent.CLICK, goGame);

    function goGame(event:MouseEvent) {}
    gotoAndStop ("game"); The game framework
    this.removeEventListener (MouseEvent.CLICK, goGame);
    }

    Here is a code for the actual game part.

    stage.addEventListener (KeyboardEvent.KEY_DOWN, keyP resurrected);

    function keyPressed (e:KeyboardEvent): void {}
    Code of character... like charcter.x ++ movement, x - etc.
    }

    Thanks in advance

    How about you try:

    internship. Focus = stage;

    in goGame().

  • Help with the Script checkbox

    I'm trying to create a script that says that if CheckBox22 is selected then CheckBox21 must be deselected.

    If anyone can help?

    Thank you

    NP

    You use LiveCycle Designer or Acrobat to create your forms.

    You must create an exclusion group. In Acrobat, you can give the same name but different values export buttons.

  • Need help with the Script to remove the option data download of a page

    Hi all

    I have a requirement where in I need to delete download option given specifically to a page for a particular set of reports. I wrote a java script...

    < script type = "text/javascript" >
    function RemoveOption()
    {
    TDS var = document.getElementsByTagName ('a');
    for (td var = 0; td < tds.length; td ++)
    {
    If (tds [td] .className! = "NQWMenuItem")
    {
    continue;
    }
    var tHTML is tds [td] .innerHTML;.
    tHTML = tHTML.replace ("download data","" ");
    TDS [td] .innerHTML = tHTML;
    }
    }
    Window.OnLoad = RemoveOption;
    < /script >

    that works very well up to a point every time IE it deletes a page load. but in case I have a view selector in a report or on a table whn I click the next Recordset it only gives me the desired result.

    Then...

    I was hoping that if someone has a better way to do it... If so can you please share it...


    Thanks in advance...

    Published by: Ashu M 25 May 2010 13:28

    Try to use the event window.onFocus instead.

    What about John
    http://obiee101.blogspot.com/

  • Need help with a script (o - o8) *, see the Virgin if there is no

    Hi all what I need help with a script I can't find an example.

    I'm trying to subtract 2 numbers and then multiply this product. (o o8) * one but I just want to do the calculations if all fields have the numbers IE field o, o8 of field and field one.

    Thank you in advance. I was stuck on this days searching the Internet.

    Assuming you want to affect the outcome of this calculation in another text field, use this code as a custom field calculation script:

    var o = this.getField("o").valueAsString;
    var o8 = this.getField("o8").valueAsString;
    var a = this.getField("a").valueAsString;
    if (o!="" && o8!="" && a!="") event.value = (Number(o)-Number(o8))*Number(a);
    else event.value = "";
    
  • lately and I don't know why I see a pop up of a problem with the script. can some1 help me?

    There is a pop up of a problem with the script. He asked end and contuniue the script. I didn't have this problem before. Please help me this is getting really annoying. He asks a lot

    I changed a theme and almost never have a problem again...

  • Help with the Powershell script to collect logs from all domain controllers

    I am writing a script to retrieve the last 5 days of application, security and log files from all domain controllers. The script runs, but fire the logs from the local server only. The variable $Computer has all of my DC so it's the fine mark. I guess it's a problem with my line ForEach-Object, but is not error. See the below script.

    $log = 'application '.
    $date = get-date-format MM-DD-YYYY
    $now = get-date
    $subtractDays = new-object System.TimeSpan 5,0,0,0,0
    $then = $Now.Subtract ($subtractDays)
    $Computers = get-ADDomainController-filter *.
    ForEach-Object - InputObject $Computers - process {Get-EventLog - LogName $log - after $then - before $now - EntryType error | select EventID, MachineName, Message, Source, TimeGenerated |} ConvertTo-html | {Out-file $env:TEMP\Applicationlog.htm}
    Invoke-Expression $env:TEMP\Applicationlog.htm

    Thank you

    Rich

    Hello

    To help with the repost the question script to the script Center Forum

    http://social.technet.Microsoft.com/forums/scriptcenter/en-us/home

  • I've been trying to get out of my printer and scanner works with the features, it can handle but you need the orginal software cd you can down line load a copy _ @ _. ___

    How can I get a copy of the cd that will work with your old software. I've been trying to get out of my printer and scanner works with the features, it can handle but you need the orginal software cd you can down line load a copy to * address email is removed from the privacy *

    Hi Oscar,.

    Thanks for the post.

    It seems you are trying to download the application printer and scanner. Please answer the following questions, which will help us to guide you in the right direction.

    1. What is the brand and model of the printer?

    Suggestions for a question on the help forums

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

    Send us more information to help you better, we will be happy to help you!

  • Having a problem with the script error message

    The error message and web page script error every move I make now. I tried to check and uncheck boxes tab in advance internet options. I also ran a check of the system that did not help either. Any suggestions? Thank you

    Hi Mic,

    From the description, it seems that you have a problem with the script error message in Internet Explorer.

    To better understand the question, please answer the following questions:

    1. is specific to a particular Web site question?

    2 have you made changes on the computer before this problem?

    3. What is the exact full error message and web page of script error message?

    4. When you get exactly the script error message and web page error message appears?

    5. what exactly you're talking about when you say "system check"?

    See the article mentioned:

    How to troubleshoot script errors in Internet Explorer

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

    Hope the above information is helpful. If you have any question back to us, we are happy to help you.

  • Need help with the API Explorer

    Hi all

    I am creating a workflow to automate certain tasks of P2V and I want to disconnect the NETWORK adapter prior to anyting on virtual machines. When everything is done, I want reconnect you this NIC I play with vCO for a few months now and I need to get help with the part of the script. I always managed to find a code but this time I did not find anything!

    So I need to script this part! I think I found a way to change the connection settings of the VMXNET3 NETWORK adapter with this part of the code:

    System.getModule("com.vmware.library.vc.vm.spec.config.device").getVirtualVmxnet3(backing,connectable,controllerKey,deviceInfo,key,unitNumber,addressType,macAddress,wakeOnLanEnabled)
    var connectset = new VcVirtualDeviceConnectInfo();
    connectset.connected = false;
    connectset.startConnected = false;
    

    Now, I need to find the way to set these parameters to a VM VMXNET3 adapter?

    How to off the virtual machine to these settings?

    Thanks for your help!

    If you are connected to a distributed switch, they canned for this com.vmware.library.vc.networking.connectVmNicNumberToVirtualDistributedPortgroup action.  If this isn't a vds connect you to, then you need to change then it will have to be slightly modified to use normal NIC instead of vds support.  You will also need to add these lines to the device configuration section:

    devicespec. Device.connectable = new VcVirtualDeviceConnectInfo();

    devicespec. Device.connectable.Connected = true;

    devicespec.device.connectable.startConnected = true;

    I copied this action and added these 3 lines to achieve what it looks like you are trying to do.  We don't really use standard switches in our environment.

    Paul

  • help with resizing script

    I found an online script that turns pictures into a square (by increasing the size of the canvas on the short side to match the length of the long side) which is awesome, but I would like to make an extra step and I have no experience with script so I hope someone can help.

    now that my images are square, I want to put a maximum of 2500 x 2500 px size, I found scripts to set a resolution of a specific size, but I want to make sure to avoid is upsampling, so I want just any image is greater than 2500 x 2500 px down sample to 2500 x 2500 px

    all information on the code for this would be much appreciated.

    When I'm at the machine with the script that I currently use will be to paste it here in the meantime if you know something about the scaling of the images down, but preventing their intensification I could probably chimpanzee with the code I have and make it work.

    Something like this might work, you can change the ResampleMethod, however:

    top-down images of squares more 2500px up to 2500px.

    2012, use it at your own risk.

    #target photoshop

    If (app.documents.length > 0) {}

    myDocument = app.activeDocument;

    value of pixels;

    var originalRulerUnits = app.preferences.rulerUnits;

    app.preferences.rulerUnits = Units.PIXELS;

    get the dimensions;

    var theWidth = myDocument.width;

    var theHeight = myDocument.height;

    If (theWidth == theHeight) {}

    If {(theWidth > 2500)

    myDocument.resizeImage (2500, 2500, myDocument.resolution, ResampleMethod.BICUBICSHARPER)

    };

    }

    else {alert ('not square')};

    reset;

    app.preferences.rulerUnits = originalRulerUnits;

    };

  • I need help with the control of two .swf in third.

    Hi, thanks for reading!

    I need help with the control of two .swf in third.

    I have a problem when I need to use a .swf in a digital signage solution, but were advised by the Legal Department, it cannot be changed in any way, I can not also have the source file blah blah blah. I pulled the .swfs on their site and I decompiled to see what I was up against.

    The main SWF that I need control is HCIC.swf and the problem is that it starts with a preloader, which, after the loading stops on a framework that requires user input to (button) on a play button, until the film will proceed and replay.

    What I've done so far is to create a SWF container, HCIC_container.swf, which will serve as a target for the HCIC.swf and I would like to send actionscript in the file, I am not allowed to edit.

    I managed to get done with help from someone on another forum. It is my hope that the following script just start HCIC.swf a framework after the preloader and button play and just play through.

    var container: MovieClip = createEmptyMovieClip ("container", getNextHighestDepth());
    var mcLoader:MovieClipLoader = new MovieClipLoader();
    mcLoader.addListener (this);
    mcLoader.loadClip ("MCIC.swf", container);

    function onLoadInit(mc:MovieClip) {}
    mc.gotoAndPlay (14);
    }

    But unfortunately it does not solve my problem. Because there is a media - controller.swf, which is charged by HCIC.swf who has orders, including the play button to start HCIC.swf.

    Here is a link to a .zip with all 3 files .swf file and all 3 .fla files.

    http://www.axiscc.com/temp/HCIC.zip

    What I have to do is to automatically start the HCIC.swf file, bypassing the pre-loader and play button without having to edit it or in the media - controller.swf in any case. Thus, all scripts must be done in HCIC_container.swf.

    I know it is confusing and it is difficult to explain, but if you look at the files it must make sense.

    ActionScripting is far from my point hard, so I'm definitely over my head here.

    Thanks for your help.

    Got my solution on another forum.

    http://www.ActionScript.org/forums/showthread.php3?t=146827

  • What is the correct way to ask for help with the forum, rather than product, questions?

    I can't find the right way to ask a question about the forums themselves.

    PAGulley said

    I can't find the right part of the forum to ask questions about the forum itself and its features. I wonder what the right place and the way is to get help with the forum system itself. I can find the place to ask questions about specific Mozilla products very well.

    Look up where it says contributor tools and select Contributor Forums. Make sure that you scroll to the top or you'll get a bar with different links instead,

    The forum is https://support.mozilla.org/forums where you question would be better in the SUMO community discussions.

Maybe you are looking for

  • Lack of device drivers for Windows 7 HP 15 - J009

    Did a new install of Windows 7 ulitmate 64. I am out five drivers. Help, please! Laptop HP 15-J009 PRODUCT ID: J2V78UA #ABA Lack of drivers hardware i.d. ETHERNET CONTROLLER PCI\VEN_10EC & DEV_8136 & SUBSYS_216F103C & REV_07 NETWORK CONTROLLER PCI\VE

  • I started my computer today and it crashed.

    Computer crash I started my computer today and it crashed. It does the same thing a few hours later. I'm not sure how to check the stats of crash, or I post them.

  • SonicOS Enhanced 5.9.1.5 for 105W device

    Earlier this year, I found an update at the beginning of the liberation of my current 5.9.1.1 - 39o "early release" firmware which was released in June 18, 2015. I upgraded to 5.9.1.5 and it doesn't seem like it no problem, but now, on the download s

  • How to USE the information the user entered via BasicEditField or AutoTextEditField

    What BlackBerry watch document - step by step - how to extract the data that the user has typed on the screen using BasicEditField or AutoTextEditField. and use it in a Java program? If BB doesn't have a good document, here are all the samples you ha

  • replication target versions support vSphere

    HelloI could not find if there is limitation between the versions of the unit of replication when I defined the target sites.I am creating the target between 5.8.1.10254 2915556 build and 6.0.0.1 build 2718739, it gives a generic error.Y at - it limi