How can I autorun a script that will process an XML file on open?

I am using Frame 11. I have a registered script that looks for event notification Constants.FA_Note_PostOpenXML. When this event fires, the script is supposed to examine the root element (so I only edit appropriate XML files), then make some edits to the file. Specifically, I want to be able to delete empty pages, remove room for side heads, and fix table formatting (such as left indent, which I can't directly access, apparently, in the EDD or R/W rules). The snippet of code that starts doing the work follows:
Notification(Constants.FA_Note_PostOpenXML,true);
function Notify(note, object, sparam, iparam) {
    switch (note) {
        case Constants.FA_Note_PostOpenXML:
            doTheWork();
            break;
function doTheWork() {
    var doc, flow, root, elemName, mPageAttrib, topicElem, topicElemName, allAttribs;
    doc = app.ActiveDoc;
    flow = doc.MainFlowInDoc;
    root = flow.HighestLevelElement; // will always get something even if unstructured document
    while(root.ObjectValid()) { //only do something for structured docs
        elemName = getElementName(root);
        ...more code to do stuff....
I then check the root element name, and if it matches, I make some changes. This code works fine when run manually. But, when run as a registered script, the app.ActiveDoc object is invalid, and there is no structure to edit. (I added debug line if(!doc.ObjectValid()){alert("not valid");}, which is not included above.) It appears that the Constants.FA_Note_PostOpenXML event fires as soon as the XML file is opened, but BEFORE Frame actually reads it.
Does anyone have any recommendations on how to work around this? Is there another event I could use instead of Constants.FA_Note_PostOpenXML? Is there any other way to automatically manipulate an XML file when it loads?
Thanks in advance

The Notify event receives four parameters: note, object, sparam, and iparam. For the event you are using, object should be the document object of the FrameMaker document being opened. So, you should be able to use this:
doTheWork(object);
Make sure you update your doTheWork function to receive the Doc object:
function doTheWork(doc) {
    var flow, root, elemName, mPageAttrib, topicElem, topicElemName, allAttribs;
    flow = doc.MainFlowInDoc;
    root = flow.HighestLevelElement; // will always get something even if unstructured document
    while(root.ObjectValid()) { //only do something for structured docs
        elemName = getElementName(root);
        ...more code to do stuff....
-Rick

Similar Messages

  • How can I set the page that will open, when I open a new tab, to be the same as the homepage?

    How can I set the page that will open, when I open a new tab, to be the same as the homepage?
    An app changed it to some other search engine, before installing the app, I the tab that would open was the homepage I set.
    In my case it is Google, and I want my new tabs to open on Google like they did before the installation.
    thank you,
    Asaf Privman.

    You can middle-click or Ctrl left-click the Home button on the Navigation toolbar to open the Home page in a new tab.
    You can look at one of these extensions:
    * NewTabURL : https://addons.mozilla.org/firefox/addon/newtaburl/
    * New Tab Homepage : https://addons.mozilla.org/firefox/addon/new-tab-homepage/

  • I accidentally deleted my old fb app on my iPhone 3g. Now i cant download new fb app as it requires ios 4.3. How can i get old app that will work on my old phone. Any suggestions???  plz help!!!

    i accidentally deleted my old fb app on my iPhone 3g. Now i cant download new fb app as it requires ios 4.3. How can i get old app that will work on my old phone. Any suggestions??? plz help

    As already provided, if you don't have such in your iTunes library, on your computer, then there is no way to put it back on your phone. Apps are DRM protected, so even if you found a copy somewhere, you wouldn't be able to use it.

  • Upon launching Thunderbird, how can I set a password that will prevent viewing of my emails if someone uses my computer?

    Upon launching Thunderbird, how can I set a password that will prevent viewing of my emails if someone uses my computer?

    100% this addons can help you
    https://addons.mozilla.org/en-us/thunderbird/addon/master-password/
    look at my Thunderbird when I open it

  • How can I export a video that will loop indefinitely when played from a usb drive?

    how can I export a video that will loop indefinitely when played from a usb drive?

    As far as I know, PPro does not have that capability
    If you were creating a DVD in Encore, you could put an "end action" on the video timeline to itself... so at the end of the DVD video it would go back to the beginning
    I am not aware of any way to do that for a simple file

  • I am trying to use an education program that needs Java applets to install and use and it will not use Safari. When I download IE from the web it will not install. How can I get a browser that will work on my MacAir for travel use of this program?

    I am trying to use and education program that needs Java applets and it will not run on Safari. IE will not install from the web. How do I get a browser that will work to install so I can use this program when I travel.

    Try using FireFox. IE will only run on a Mac if you run Windows on the Mac.
    Windows on Intel Macs
    There are presently several alternatives for running Windows on Intel Macs.
    Install the Apple Boot Camp software.  Purchase Windows 7 or Windows 8.  Follow instructions in the Boot Camp documentation on installation of Boot Camp, creating Driver CD, and installing Windows.  Boot Camp enables you to boot the computer into OS X or Windows.
    Parallels Desktop for Mac and Windows XP, Vista Business, Vista Ultimate, or Windows 7.  Parallels is software virtualization that enables running Windows concurrently with OS X.
    VM Fusion and Windows XP, Vista Business, Vista Ultimate, or Windows 7.  VM Fusion is software virtualization that enables running Windows concurrently with OS X.
    CrossOver which enables running many Windows applications without having to install Windows.  The Windows applications can run concurrently with OS X.
    VirtualBox is a new Open Source freeware virtual machine such as VM Fusion and Parallels that was developed by Solaris.  It is not as fully developed for the Mac as Parallels and VM Fusion.
    Note that Parallels and VM Fusion can also run other operating systems such as Linux, Unix, OS/2, Solaris, etc.  There are performance differences between dual-boot systems and virtualization.  The latter tend to be a little slower (not much) and do not provide the video performance of the dual-boot system. See MacTech.com's Virtualization Benchmarking for comparisons of Boot Camp, Parallels, and VM Fusion. A more recent comparison of Parallels, VM Fusion, and Virtual Box is found at Virtualization Benchmarks- Parallels 10 vs. Fusion 7 vs. VirtualBox. Boot Camp is only available with Leopard and later. Except for Crossover and a couple of similar alternatives like DarWine you must have a valid installer disc for Windows.
    You must also have an internal optical drive for installing Windows. Windows cannot be installed from an external optical drive.

  • HT1414 I have disabled the auto synch on connection of the IPhone5 and now ITunes will not show the iphone  as available. How can I find the dialog that will give me control over backup's?

    Where -on iTunes - can I find a control that will enable me to synch the Iphone.
    The auto synch on attaching is turned off

    There is no merge feature for itunes content, never was. Merge applies only to contacts and calendar entries.
    The itunes content sync is one way - computer to iphone. The exception is itunes purchases
    You can transfer the purchases from the iphone to itunes before you sync. File>Transfer Purchases

  • Pse11 that will process nikon d600 files?

    i there a raw plug-in compatible with pse 11 that will process nikon d600 raw files?

    Yes that would be camera raw 7.3, which you can get by going to Help>Updates from within the photoshop elements 11 editor.

  • How can I copy a webpage that will not let me highlight it, i.e. use the control c key strokes?

    How can I take a picture of a webpage that will not let me use the control C copy command? In other words, on this particular website, I try to highlight a passage that I want to save and put in a document, but the highlighting will not work. I asked them about that, and they simply said they did not have that facility, but I think the issue is protecting their copyrighted material. I know there is some way to take a picture of the page, and then I can use my picture editing software to crop it and enlarge it.

    Are you trying to take a "snapshot" in a PDF?
    If the part of the page or PDF you want to capture is fully visible, you can use the Windows print screen function to capture it. Either use the Print Screen key to capture the entire monitor display, or Alt+Print Screen to capture the active window.
    If you need to do this often, or if you want to save the snapshot straight to disk, or if you need more than fits in a single Windows screen shot, an add-on such as [https://addons.mozilla.org/en-us/firefox/addon/fireshot/ Fireshot] can be handy.

  • How can I make a button that will work on iPads? (animate only on Mousedown)

    I am making an interactive page in Adobe Edge Animate. It will double as a low-mem website and also as an iPad page and is part of a larger flash website which is highly animated.
    This website sports two kinds of buttons; the ones linking to a label in the timeline and the ones linking to a URL.
    The problem is that I do not want the buttons to work on mouseover because that will be completely useless on iPads and similar devices. That is why I want the thing to animate on mousedown.
    What I did initially was to load the on and off states of the button to my timeline and made them into a symbol, after that I made two labels inside of that symbol; one for the on state and one for the off state. Below the first label there is a "sym.stop("ONstate");" action  and then my off-state button graphic has a mousedown "sym.stop("skipON");" action. Then comes the tricky part, I wanted to reference the label on which it should land in a onclick action on a root level. It didn't work at all. I used "_root.stop("label");". As you can see my programming abilities are extremely poor, I'm a graphics guy.
    Next, I decided to leave the mousedown action inside the symbol and do the onclick action on the main timeline, which did work for the most part, however it behaved weirdly. First off, the mousedown action worked perfectly, but not at the same time with the onclick action; You would click on the mousedown thing and it would stop on the frame and then you would need to click it a second time to go to the label.
    There must be either something  I'm doing wrong or this function is not supported by the Edge Animate beta. But my programming abilities are so poor to pinpoint the real cause of the problem.
    Can anyone help me please?

    Hi, redcrowdesign-
    Part of the problem is that you're using ActionScript syntax in a JavaScript environment.  Instead of using _root, you can access the Stage object.  If your symbol is only one level down, you can use sym.getParentSymbol().stop("label");.  If you have a nested symbol, you may find sym.getComposition().getStage().stop("label"); more effective.
    That being said, you might want to rethink your UI model and focus your iPad interactions on the touch events, which are much more performant than the mouse events.
    Hope that helps,
    -Elaine

  • How can I have a button that will show/hide a text box and images on the same page?

    I have a page like below:
    I want to make so that those 3 buttons show different text under them when they are each pressed. How can I achieve this?
    Thanks.

    Hello,
    Please try using Tooltip Composition Widget to achieve that..
    You need to customize  the trigger as the button  and you can use the target to insert desired text box or images.
    you can find this in Widgets library panel > composition
    Please let me know in case you need any other clarification on that.
    Regards
    Vivek

  • How can I eject a dvd that will not play and says "supported dish not available,  also DVD player encountered a system error  -69902

    I am unable to eject a DVD.  When I try the screen says "Supported dish not available."  Before that a DVD stopped playing and the screen said 'DVD player encountere a system error  -69902.  How can I get the DVD out?

    restart your mac while holding down on the mouse.

  • How can I get a version that will allow me to download and install "Less Spam Please

    I try to download and install "less spam please", but it sends a message saying not compatible with Firefox version 15.0.1. my system is the a HTC One Android. Is it possible to get a different version of Firefox, one that would be compatible with my HTC android?

    Normally this would be done in Acrobat using the various form tools, or LiveCycle Designer which comes with Acrobat Pro. But there are some open source programs that will let you create interactive form fields, such as Scribus or Open Office (Writer). Note that you will not be able to save the resulting filled-in form with Adobe Reader since it won't be Reader-enabled, which is normally done with Acrobat. Some non-Adobe PDF viewers are able to save filled-in forms.

  • How can we tell the client that use process order or production order (proc

    Dear guru,
    My question on what reason we can tell the client that u have to use process order or production order .
    On what scenario we suggest client that use process order or production order

    Hi,
    Process manufacturing is primarily designed for the chemical, pharmaceutical, food and beverage industries as well as the batch-oriented electronics industry
    Discrete manufacturing is u201Cthe production of distinct items such as automobiles, appliances, or computers,u201D whereas process manufacturing covers u201Cproduction that adds value by mixing, separating, forming, and/or performing chemical reactions. It may be done in either batch or continuous mode.u201D
    Letu2019s think about what your company manufactures. Does it require mixing chemicals? If so, you may need an ERP system that does things like calculate ingredient quantities.
    If your company assembles products from many component parts, youu2019ll require discrete manufacturing functionality
    Other approach:
    If the finish good cannot return back to its basic components, your manufacturing is Process. For instance, the finish good is a can of soda. It cannot return back to its basic components such as carbonated water, potassium benzoate, aspartame, citric acid, and other ingredients. But if the finish good is car or computer, your manufacturing process is Discrete because it can be disassembled and the parts, to a large extent, can be returned to stock. Therefore Bill of Material (BOM) of discrete manufacturing consists of component parts for assembly while Process manufacturing consist of formulas, recipes and other ingredients
    Process manufacturing is scalable. If a formula calls for 1,000 pounds of cake flour, but you only have 500 pounds, you can still bake cakesu2014just not as many. Conversely, in discrete manufacturing, one missing part means waiting for it before the finished assembly unit can start rolling off the production line
    The obligatory requisite for process manufacturing is Lot Potency and Shelf Life where as discrete manufacturing values Serial Numbers, ECNu2019s and assembles.
    If it is discrete manufacturing ---go for Production order
    If it is process manufacturing ---go for process order
    thanks and regards
    Venkat V

  • How can I get the context-parm from a web.xml file using struts?

    Hello:
    I need get the context-param from the web.xml file of my web project using struts. I want configurate the jdbc datasource connection pooling here. For example:
    <context-param>
    <param-name>datasource</param-name>
    <param-value>jdbc/formacion</param-value>
    <description>Jdbc datasource</description>
    </context-param>
    and then from any Action class get this parameter.
    Similar using a simple server can be:
    /** Initiates new XServlet */
    public void init(ServletConfig config) throws ServletException {
              for (Enumeration e = config.getInitParameterNames(); e.hasMoreElements();) {
                   System.out.println(e.nextElement());
              super.init(config);
              String str = config.getInitParameter("datasource");
              System.out.println(str);
         public void doPost(HttpServletRequest req, HttpServletResponse res)
              throws ServletException, IOException {
              // res.setContentType( );
              System.out.println("Got post request in XServlet");
              PrintWriter out = res.getWriter();
              out.println("nada");
              out.flush();
              out.close();
    but only this works for init-params, if I use
    <servlet>
         <servlet-name>MyServlet</servlet-name>
         <display-name>MyServlet</display-name>
         <servlet-class>myExamples.servlet.MyServlet</servlet-class>
         <init-param>
         <param-name>datasource</param-name>
         <param-value>jdbc/formacion</param-value>
    </init-param>
    </servlet>
    inside my web.xml. I need something similar, but using struts inside the action class for that I can get the context-params and call my database.
    Thank you

    To get context parameters from your web.xml file you can simply get the ActionServlet object from an implementing action object class. In the perform (or execute) method make the following call.
    ServletContext context = getServlet().getServletContext();
    String tempContextVar =
    context.getInitParameter("<your context param >");

Maybe you are looking for

  • Automated loading and executing array of presets sequentially

    Hi, I have built a system that allows a user to set certain parameters and send those parameters to another program using an event case.  In order to have my controls update in real time I had to use nested while loops.  The inner loop contains the c

  • Create a pdf file from Outlook e-mails

    How can I create a pdf file from my Outlook e-mails?  I would like to export all of the e-mails for each client into a pdf once I close their file.  Help!

  • Matrix Add Row and Duplicate Row

    Hi All, Can anybody suggest me how to work on Add row and duplicate row in any document table. Lets take one example Sales order document In this doc we have table format where we specify item no, item description etc. In this table when we right cli

  • Anyway to register user defined org.omg.PortableInterceptor.ClientRequestInterceptor?

    For websphere 5.0 and up version, it's easy to register use defined interceptor to ORB request broker list. For example, in server.xml of websphere server configuration file, <services xmi:type="orb:ObjectRequestBroker" .. > <interceptors xmi:id="Int

  • IPad 1 32 GB  with sim- OS5 in reboot cycle - Itunes freezes

    My Ipad showed a popup saying it couldn't call anymore and needed reactivating. I restarted it (pressing the two buttons until the red slider showed) and it has been in a vicious cycle for hours now showing the black screen with the white apple - the