[JS](CS3) EventListerner: afterOpen

Hello everyone,
I was wondering if anyone knew why Adobe choose to open a document "hidden" in the event "afterOpen"? Or was it to handle different events when opening several documents at once? In that case none of them would be the activeDocument. The problem is you have to maintain 2 sets of scripts: One for user actuated (Doc = app.activeDocument) and a second for the eventListener (Doc = event.parent).
Am I correct in my assumption or is it possible for the script to determine if it was executed manualy or by eventListener?
Thanks in advance, Alex.

Hi Harbs,
I get your point but can't apply it.
doc = File(mypath)
doc.pageItems.length > error
doc.filePath = mypath > error (read-only)
doc = File(mypath).open() > error
Do you mean if(app.documents[0].filePath = mypath)...?
thx
Loic

Similar Messages

  • (JS)(CS3) eventListeners: afterOpen UNSTABLE

    Hello everyone,
    I was able to emulate what inEventScript CS2 plug-in did, using the EventListener new function build into CS3. UNFORTUNATELY as soon as I close the document(s), InDesign crashes. The script is reliable as it has been used in CS2 for the past 6 months. All I did was to write the script that creates the event. The event gets triggered, the script executes and the handler closes once the script is finished. I can open several Docs. and they all get scripted correctly. It looks like something terminates INCORRECTLY once I close one of the document!
    Any suggestion or input will be greatly appreciated. Alex.
    Here is the EVENT Script.
    ===============================================================
    #target indesign
    #targetengine "session"
    app.scriptPreferences.version = 5.0;
    //******************** BEGIN Main ********************
    main();
    function main()
    //** Number 0
    app.addEventListener( "afterOpen", EventOpen, true);
    function EventOpen (itsEvent)
    app.scriptArgs.set("Event_Listener", itsEvent.parent.toSource());
    var myExeSrcFile = new File (app.scriptArgs.get("Event_Open"));
    if (myExeSrcFile.exists)
    myExeSrcFile.open ('r:(read)')
    app.doScript(myExeSrcFile, ScriptLanguage.javascript);
    myExeSrcFile.close();
    alert ("Finished Execution"); //*** Debug: Confirms HANDLER termination
    else
    alert ("Error! Missing File:\n\n" + myExeSrcFile.fsName);
    return;
    =================================================================
    The scriptArgs are defined during a Startup Script. The "Event_Listener" passes the document opened as an argument to the script and is correctly evaluated w/i the "Event_Open" script.

    Hi Harbs,
    I get your point but can't apply it.
    doc = File(mypath)
    doc.pageItems.length > error
    doc.filePath = mypath > error (read-only)
    doc = File(mypath).open() > error
    Do you mean if(app.documents[0].filePath = mypath)...?
    thx
    Loic

  • [JS CS3] AfterOpen event (extension of a former topic)

    Hi considering this thread :
    http://www.adobeforums.com/webx/.59b59abf/3
    I get a semi-successful result.
    Pointing to the activeDocument using app.documents[-1] works well when I open the first document. Everything is fine.
    BUT as soon as I open a second document, it yells that the object doesn't exist anymore :-(
    using app.documents[0] seems to produce the same effects.
    Did anyone solved that error ?
    Thx to all.
    loic

    Hi Harbs,
    I get your point but can't apply it.
    doc = File(mypath)
    doc.pageItems.length > error
    doc.filePath = mypath > error (read-only)
    doc = File(mypath).open() > error
    Do you mean if(app.documents[0].filePath = mypath)...?
    thx
    Loic

  • [JS] (CS3) eventListener & doScript

    Hello everyone,
    Is it possible to create an eventListener, like "afterOpen" that would trigger a script file?
    In CS2, I wrote a few scripts that were managed by inEventScript Plug-in. We are upgrading to CS3 and this plug-in was not transported to CS3 since "eventListener" is available.
    So if possible, what is the syntax to execute the doScript within the Event Handler Function? It would not be app.doScript. So what?
    Thank you, Alex.

    I am running into another issue now.
    It does execute the script "afterOpen", but it is displaying my alert "No document open!!!" from my test: app.documents.lenght == 0.
    So is there no Open Document altough it is an "after"???
    The goal is to be able to execute some my regular script AND have have them attached to some events ("Open, Close, Copy & Paste). Or am I stuck to modify & include them in the STARTUP script. I know I can use event.parent to access the Document opened.
    Also, are there events attached to pasting & copying (Before &/or after)?
    Here is the Startup script.
    #targetengine "session"
    main();
    function main()
    var myScriptName = app.activeScript.fsName;
    var myScriptPath = app.activeScript.path;
    // var myPath = app.filePath + "/Scripts/Scripts Panel/~InEventScript/";
    //** Number 0
    var myFile = new File (myScriptPath+"/PrePressOPEN.jsx");
    if (myFile.exists)
    app.addEventListener( "afterOpen", myFile, false );
    else
    alert ("File:\n" + myFile.fsName + "\n...has NOT been Installed!!!");

  • AddEventListener afterOpen to Document

    The CS3 scripting guide specifically mentions that you can use the "afterOpen" event on either an Application or Document object. I seem unable to bind to the afterOpen event on a document, however. What I am trying to do is detect certain files being opened, read metadata from them, close that document, and open a new document based on the metadata of the original.
    It sounds like it should be easy, but the "afterOpen" event is a little misleading. Although it contains information about the document, the application has not yet finished opening the document - meaning it does not yet have a window or has not yet become the activeDocument. I have a reference to the document being opened, but addEventListener has now apparent effect and I cannot call doc.close() without a javascript error being thrown.
    The code is fairly straightforward so far:
    function doAfterOpen(event) {
    var doc = event.parent;
    //read from the first story
    var story = doc.stories.firstItem();
    if(story) {
    var realFilePath = story.extractLabel("realPath");
    //I now have the realpath and need to close this temporary document
    doc.close(); <--- Throws a javascript error: 1 (I'm guessing cause it's not yet open which belies the afterOpen name)
    -- OR --
    doc.addEventListener("afterOpen",function(event) { alert("docOpen"); })) <---- it never fires
    Anyone have any idea if there is actually a way to bind to a REAL afterOpen event, meaning that the document as in fact been opened???

    I just jumped on this bandwagon. When I realized that afterOpen fires before the first window appears, I tried opening one in my event handler:
    //DESCRIPTION: Start-up Script
    #target indesign
    #targetengine 'onOpen'
    (function() {
      app.eventListeners.add("afterOpen", afterOpen);
      function afterOpen(myEvent) {
        myEvent.target.windows.add();
    This worked. The window was drawn. But when I tried to close the window, InDesign CS4 crashed. To be thorough, I shall now go through the process again to make sure it is repeatable ... Yes it is. I just tried again with a different document -- happens it was one that had to be converted from CS3. Same thing happened. One window only which on closing caused the crash.
    Then, restarting CS4 caused the document to be recovered with two windows.
    Looks like APID is the way to go if you want to do anything useful with a document when it opens.
    Dave

  • Adobe Bridge CS3 windows error

    Hi,
    When I open Bridge cs3 on its own after a few seconds the window banner comes up. Adobe bridge has encountered a problem and needs to close.We are sorry for any inconvenience. The same happens if I try to open bridge from within Photoshop cs3
    I can still work in the programme ok and move the windows error aside, I would like to fix the problem, Tried to debug but the programme just closes.
    I use windows xp pro with all the latest updates that are available.
    have any others experienced this problem and how to fix it.
    Thanking you in advance.

    Mikep500 wrote:
    This is a copy of the message that comes up.
    No messageto see, but you can check your Startup Scripts in Bridge preferences. Mine are like this:

  • Text Wrap options not showing in InDesign CS3

    Using InDesign CS3 on a Mac 10.4.  I've had this problem for a couple of months now and it's getting past the point of annoying.  When I open my text wrap options pallete it's blank even when I expand options.  I can see the text wrap icons in my header panel, but I no longer have options to change the right/left/top/bottom margins.  Just a general "add wrap" and "remove wrap".  Is there any way I can get my pallete back?  I've tried defaulting my tools, but still it does not show up.  I don't know what to do to get it back.

    Did you try resetting preferences? While pressing Shift+Option+Command+Control, start InDesign. Click Yes when asked if you want to delete preference files. If you don't get the message about deleting preferences, you weren't fast enough.
    http://livedocs.adobe.com/en_US/InDesign/5.0/help.html?content=WSa285fff53dea4f86173837510 01ea8cb3f-6d1e.html
    Ken

  • I am unable to open raw files from my Canon T1i in Adobe Camera Raw of my version CS3 of Photoshop.  I have tried to update my ACR by downloading version 4.6 from the Adobe website but I am still unable to open raw files, just JPEG.  Is there a way to use

    I am unable to open raw files taken on my Canon Rebel T1i in my version of Photoshop CS3.  When I import raw files into Bridge they come up as patches with CR2 on them and when clicked on, a notice comes up stating that Photoshop does not recognize these files.  I tried to update my Adobe Camera Raw by downloading version 4.6 from the Adobe Website, but when I clicked on the plus-in, I got another message that Photoshop does not recognize this file.  I spoke with a representative from Canon who said that I could not update CS3 and that I should subscribe to the Cloud.  I would prefer to use my CS3, if possible.  Can anyone advise me what to do?

    The T1i was first supported by Camera Raw 5.4 which is only compatible with CS4 and later
    Camera Raw plug-in | Supported cameras
    Camera Raw-compatible Adobe applications
    Some options:
    Upgrade to CS6
    Join the Cloud
    Download the free Adobe DNG converter, convert all T1i Raw files to DNGs then edit the DNGs in CS3
    Camera raw, DNG | Adobe Photoshop CC

  • Double-click/Drag-&-drop Photoshop files opens application but not file or I get a message saying that some files in Application Support are missing and I have to reinstall. (Photoshop CS/CS2/CS3)

    This is most commonly due to installing Photoshop CS/CS2 <i>before</i> doing an archive and install of Mac OS10.3 or OS10.4.<br /><br />One solution is to reinstall Photoshop 7/CS/CS3 after you have installed Mac OS10.3 or OS 10.4.<br /><br />If you have Photoshop 7 and 8(CS), the easiest way to reinstall Photoshop (without disturbing the original installation) is to install to your desktop. After the install is done just trash the Photoshop folder on the desktop.<br />Note: This will only work with Photoshop 7 and 8(CS) but not with 9 (CS2).<br /><br />Photoshop CS2 you must delete the Photoshop CS2 folder. If you have any 3rd party Plugins or presets remove them from the folder before deleting. Just placing the folder in the trash will not work it must be deleted. After reinstalling CS2 you can now put all 3rd party Plugins and presets back in the new folder.<br /><br />---------------------------<br />Another solution courtesy Anne Shelbourne<br /><br />Open your Previous System folder. <br />Find "Adobe Unit Types". <br />Copy it into: <Your current system Hard Drive>/Library/ScriptingAdditions/<br />Then reboot your Mac.<br /><br />---------------------------<br />However, if you happen to be running a non-English version, like Photoshop CS CE or Photoshop CS ME, it appears the missing file does not get installed. You would need to install and delete the international English version first.

    The problem you got into is a known problem after updating to Tiger. It is a small 4K file that gets trashed with the update. It is called the Adobe Unit Types. Both Photoshop and Photoshop Elements need this file to function.
    One way to get it back is to reinstall Photoshop, the other is to add this file again.
    You can get the file from here http://www.dd.se/Tips/bildbehandling/downloads/AdobeUnitTypes.zip
    It is only 3,7 KB big.
    You put the file you download here:
    [hard disk] /Library/ScriptingAdditions. If you don't have a Scripting Additions folder, you create it.
    As you trashed Photoshop, you need to completely deinstall it to be able to reinstall it.

  • PhotoshopNews: Adobe Photoshop CS3 at a glance!

    http://photoshopnews.com/2006/12/14/adobe-photoshop-cs3-at-a-glance/
    Even more content out there now on the home page of PhotoshopNews.com

    I haven't been able to download CS3 yet, but the Martin Evening pdf (thanks for the link!) has what looks like a piece of great news buried in it:
    "For example, before you first had to create an empty new document with the exact pixel dimensions before you could place an image (such as a raw file) as a Smart Object. With Photoshop CS3, you can now place a raw capture file as a Smart Object layer in a single step."
    If I understand this right, it means that the functionality of the old Dr Brown Place-a-Matic script is now available from Aperture. We can -- or this makes me hope we can -- send a RAW from Aperture to PSCS3 for editing, and then Place the same image, perhaps twice, as a Smart Object, edit away, and when we Save get the whole edited image back in Aperture without going through the Finder.
    I used to use this (from Bridge) all the time to double-expose RAW shots: adjust the sky to one exposure and the ground to another, masking to get both into the final image, all without messing with the pixels of the RAW image. I've missed it. Whoopee.

  • Do I need to install CS3 on Windows 7 64 bit before installing CS5 Upgrade?

    I am replacing a graphic designer's Windows Vista laptop with a Dell Precision T5500 desktop.  Do I need to uninstall CS3 from the laptop and decommission the serial number?  Then do I need to install CS3 on the new desktop before installing the CS5 upgrade?  I was told I needed to decommission the installation, but I don't remember having to do that with other installations.  Thanks in advance!

    You should definetly deactivate any software before uninstalling. But you don't have to install CS3 in order to install CS5. Just have the serial number handy for verification. That said, depending upon the user's needs, you might want to leave CS3 available.
    Bob

  • My harddrive crashed.  I got a new hard drive, and attempted to port my CS3 design software onto my new hard drive.  It says it cannot work and I must uninstall and reload the software.  I registered the software and have the serial, but cannot find the o

    I bought the design premium in 2007 and can no longer find my original software.  I need to uninstall and reinstall but again can't find my software, but all applications are in my backup drive. Any help?

    Julia,
    Here is a download site which goes back to CS3:
    http://technolux.blogspot.co.nz/2011/02/adobe-direct-download-links-less-akamai.html#more
    Or you may use this one, (t is crucial to follow all the initial steps precisely):
    http://prodesigntools.com/tag/ddl
    There are known issues with Yosemite, if that is the OS, but according to this site, someone has made Yosemite work with almost all CS/CC versions.
    http://roaringapps.com/apps?index=a
    For a specific CS3/Yosemite issue, namely CS3 crashing on opening under Yosemite, this solution,
    1) Open System Preferences > Java
    2) Wait for the Java Control Panel to load
    3) Open Adobe Illustrator (while keeping the Java Control Panel window open)
    has been given by Allycs in post #10 in this thread:
    https://forums.adobe.com/thread/1610653
    1) Open System Preferences > Java
    2) Wait for the Java Control Panel to load
    3) Open Adobe Illustrator (while keeping the Java Control Panel window open)

  • [JS CS3, Win] Saving InDesign using app.activeDocument.save

    Hello.
    I am having problems saving an InDesign document using Javascript.
    My aim is to have a box in the document where I will type the filename and path where I want the InDesign file to be saved (eventually this will be generated from a datamerge).
    I then want to run a script which will read the contents of the box and then save the document to that filename or location.
    At the moment I have:
    //SaveText.jsx
    //An InDesign CS3 JavaScript
    //Saves the document to the provided path
    //get contents of the FileNameBox box on the document
    var varFileName = app.activeDocument.textFrames.item("FileNameBox").contents;
    //now save
    app.activeDocument.save("/"+ varFileName+".indd");
    //alert (app.activeDocument.filePath);
    When I run the script (with "Hello" in the FileNameBox) the file changes name on the top bar of InDesign to "Hello.indd", but (when I run the commented out alert at the end) the file is not actually saving anywhere.
    If I close InDesign and then open it the file is listed under "Open Recent" on the menu, but clicking it does nothing - again the file doesn't exist.
    Does anyone have any ideas to help me from tearing my hair out?
    Where is my file saving? (Or, if it isn't, how can I make it save!).
    Thanks in advance for any help you can offer.

    var myFolder = new Folder("~/Desktop/Test");
    if (!myFolder.exist) myFolder.create();
    var varFileName = app.activeDocument.textFrames.item("FileNameBox").contents;
    app.activeDocument.save(myFolder.fsName + "\\" + varFileName+".indd");
    alert(app.activeDocument.filePath);

  • Photo gallery in DW CS3

    Can someone tell me how to make a photo gallery in DW CS3? I
    mean a site with thumbnails that are linked to larger images,
    preferably all thumbnails on one site, not the filmstrip system. I
    read that there would be a gallery option in DW, but I cannot find
    it in the help, nor in the books I have. Thanks

    Nobody???

  • Adobe bridge and CS3 I have down loaded trial version...

    two problems--when i down load my pics- jpeg&raw- from EOS5D camera into adobe CS3 bridge i only get jpeg images not raw--my zoom browser does it!
    also when i double ck on thumbnails in BR i get raw processing--when i then go to photo shop by cking -save objects-when images opens up in phot shop i can not make any color adjustments--I have wasted 4 hrs with adobe techs--They had me remove adobe CS3 4 x and reload--problem still exists--is there adjustments in BR that affects this situation..?
    br carmen-i have vista operating system

    Vista has a problem with Canon cameras, not Bridge's fault. Copy the images directly to the hard drive. Check MSFT for any updates...
    The "Save Object" is for making Smart Objects and from the sounds of it, you are unfamliar with the concept? You need to double-click the Workflow options in Camera Raw and uncheck the Smart Objects options...then images will open as images not Smart Objects.

Maybe you are looking for

  • Duplicated records

    Dear friends, One question for you from a PL/SQL beginner: I have to individuate duplicated records (and set them as errated): With the below code I retrieve only the plus records, but I need ALL the duplicated records (example, if I have 2 equal rec

  • Can I tag titles and do other SEO functions in iweb?

    What can I do to boost SEO in my iweb site? I heard of one trick which is to have a text box of keywords in the background color so it's invisible. Otherwise, can I tag titles?

  • Account Broken - new id spawned

    Hi Admins Tried all the 4 steps of logging out, clearing cookies. The correct id is little*big*man The new incorrect spawn is little*big*man-ESRzuh Thanks! Sean

  • ITS screen hangs when downloading a report to an excel from an ITS screen

    Hi All, We are having an Transaction iview which is used by manager to generate reports, When the user tries to download the report to a local file the screen just hangs and nothing happens. We get an error at the IE status bar saying "Load: class Qu

  • Element is not declared error both in BizTalk 2013 and AX 2012 R2

    Hi: We continue getting “element is not declared” in BizTalk and AX. Appreciate any help and hints. Regards, Toraj Background: We have BizTalk 2013 and AX2012 R2. From BizTalk Suspended Job System.ServiceModel.FaultException: <s:Envelope xmlns:s="htt