Inserting a library item on a page using Javascript

Hello,
I have a library with 6 different layouts in it.  I need to be able to place these on the page from an external program.  I have all my code in place to send commands to Indesign, but I'm not sure how to reference the Library items.  Can I reference them by name?  As well, I would like my external custom app to be able to list all the library items so that the user can select which one to insert.  I'm at a total loss as to how to do this.
I need help with these two things:
1) obtain an array or list of all the items in a particular Library, which is already open.
2) Once I have the list of library items I need to be able to place one or multiple on the page keeping track them so I can place images and text in the appropriate boxes.
Any help with this would be greatly appreciated.  I'm using Indesign CS3 and my external app is coded in Objective-C on a Mac.  I prefer Javascript as I'm very familiar with it as opposed to Applescript.
Thanks for any help provided.
Dave Williams

Assuming you have access to the equivalent of doScript, when that is used to run a JavaScript, the final value of the script is returned (coerced to a string? I'm not sure).
Of course, you can always pass information from one place to another by using keyed labels. In my work (I spend most of my time writing scripts for Typefi Publish wherein the same script might get executed at the end of every page as the Typefi Engine composes the document), I often will add a keyed label to the document that passes information from one run of the script to the next. Here's an example (that includes reading the script itself to extract version information from the second line) -- while slightly inefficient, it has the benefit of putting the version info in a defined, easy to find place:
    function registerFirstCall(aDoc, interactive) {
        var scriptFile = getScriptPath();
        var scriptName = scriptFile.name;
        if (aDoc.extractLabel(scriptName) == "" || interactive) {
            scriptFile.open("r");
            var firstLine = scriptFile.readln();
            var secondLine = scriptFile.readln();
            scriptFile.close();
            if (secondLine.indexOf("//VERSION: ") == 0) {
                var msg = secondLine.split("//VERSION: ")[1].split("\n")[0];
            } else {
                var msg = "unknown";
            aDoc.insertLabel(scriptName, "Registered");
            TPSlog(scriptName + " version: " + msg, interactive);
    }// end registerFirstCall
Ah, I see it uses the getScriptPath function, so for completeness, here it is:
    function getScriptPath() {
        // This function returns the path to the active script, even when running ESTK
        try {
            return app.activeScript;
        } catch(e) {
            return File(e.fileName);
        } // end try
    } // end getScriptPath
The TPSlog function either pops up an alert (when working interactively -- usually means during debugging) or adds a log message for the session (that also is managed with a document keyed label). The keyed label in this case is performing the trivial task of recording that the script has previously been run against this document, in which case, it doesn't need to log a message identifying its version info.
Hope this helps.
Dave

Similar Messages

  • Cannot insert second lib item on same page (DW CS3)

    Hi, I am asked to build a website with 53 pages. My client, most likely, will come up with changes/desired extra pages in future, so I thought library items would be appropriate for navigation (correct? I am new to lib).
    After inserting one library item (vertical menu with roll-over images) in a page, I also want to use this type of nav horizontally at the top of the pages.
    However, DW (cs3) does not allow me to do so. This is the message: "Making this change would require changing code that is locked by a template or a translator. The change will be discarded."  The parent page is not a template, just an ordinary new html page. I inserted the vertical nav lib into a div.
    I understood it should be possible to insert more than one lib item in a page, what can be the problem here?
    Thank you very much for any tips, suggestions and help.

    function(){return A.apply(null,[this].concat($A(arguments)))}
    You know what? I stopped working with the lib items, because I found out that working with SSI is much easier!
    Same here.
    I haven't used DW's Templates or Library Items for several years. I used to spend too much time having to find my way around the editables and non-editables. They just got in my way. SSIs are much easier to create and far, far easier to maintain.
    function(){return A.apply(null,[this].concat($A(arguments)))}
    (Server must be php complient).
    Not necessarily.
    SSIs can be used on plain HTML pages, PHP, ASP, ASP.NET and ColdFusion pages.
    The principle is the same, but the Include code in the parent page is different.
    ASP and .NET includes use the same syntax as plain SSI:
    <!--#include virtual="/includes/filename.htm" -->
    ColdFusion
    <cfinclude template="/includes/filename.htm">
    PHP
    <?php require_once('/includes/filename.htm'); ?>

  • Shortcut for inserting a library item?

    Dear Dreamweaver people,
    i am busy inserting a library item (some html that creates a
    form) in about 400 pages. Automating this task is probably to
    complicated for me, but, hitting this insert button is tyresome as
    well. Is there any shortcut possible for this button? I cannot find
    a possibility in the editing shortcuts panel.
    I am using dreamweaver CS2
    Thanks for any help

    I wouldn't recommend this. You would be MUCH better off using
    server-side
    includes instead of a Library item (I can't find a compelling
    reason to ever
    use Library items, honestly).
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "jojo1971" <[email protected]> wrote in
    message
    news:glq81q$cou$[email protected]..
    > Dear Dreamweaver people,
    > i am busy inserting a library item (some html that
    creates a form) in
    > about
    > 400 pages. Automating this task is probably to
    complicated for me, but,
    > hitting
    > this insert button is tyresome as well. Is there any
    shortcut possible for
    > this
    > button? I cannot find a possibility in the editing
    shortcuts panel.
    > I am using dreamweaver CS2
    >
    > Thanks for any help
    >

  • How I add a LIBRARY ITEM to a page layout, top/bottom ?

    how I add a LIBRARY ITEM to a page layout, top/bottom ? in
    dwmr mx 2004 and cs4 ?

    Have you looked at the DW help file - it will explain all
    about library items :-)
    Nadia
    Adobe® Community Expert : Dreamweaver
    Unique CSS Templates |Tutorials |SEO Articles
    http://www.DreamweaverResources.com
    CSS Tutorials for Dreamweaver |
    http://www.adobe.com/devnet/dreamweaver/css.html
    Book: Ultimate CSS Reference (aff link) |
    http://www.sitepoint.com/launch/005dfd4/3/133
    http://twitter.com/nadiap
    "lse987" <[email protected]> wrote in
    message news:gpsvtt$t5q$[email protected]..
    > how I add a LIBRARY ITEM to a page layout, top/bottom ?
    in dwmr mx 2004 and cs4 ?

  • Creating Library Item results in series of JavaScript error messages?

    I've made two attempts to create library items from a page. One is a navigation bar and the other a side bar that has some lists and "non html code" in it.
    In both cases as the library item was created I rec'd a series of alerts warning of JavaScript errors.
    See attached images, which show just two of the error messages.
    It appears that the library item is then created but if I insert it into another document I get more JavaScript error messages.
    What do I do to avoid having this JavaScript problem?
    Thanks

    Troubleshooting JavaScript errors in Dreamweaver

  • How to show modal window without popup in a web page using javascript

    Hi,
    How to show modal window without popup in a web page using javascript, means when the modalwindow is opened it should not ask for popup blocker alert......
    pls help me.....

    Thanx for ur reply,
    Actually the senario is when i click on a button, another jsp page should be displayed in a modal window without popup, but the functions alert() and confirm() will not accept the url path of the another jsp page...

  • Controlling shockwave content (dcr) from a web page using javascript

    Hi,
    Is it possible to control shockwave content (dcr; object="application/x-director") from a web page using javascript?
    I believe this is possible using 'FSCommand' in Flash...
    I'd like to use HTML to do something like:
    - html_object[1].go(10);
    to send playback to frame 10.
    Thanks.
    Mark

    Sean,
    Thanks - this is exactly what I was looking for.
    'Shockingly' difficult ( pun intended :-)
    Someone really put in some effort on this.
    Very creative solution, putting a flash ( swf ) component in a director project and communicating indirectly through the flash element.
    Apparently, Javascript can communicate with the SWF file & the SWF file can communicate with the DCR file, but it is not possible to have Javascript communicate directly with the DCR. Too bad.
    After looking over this example I think I'll rethink my project.
    Thanks again.
    Mark

  • InDesign CS4 Library- can't get library items on to pages

    I'm fairly new to InDesign CS4.
    A book I'm reading has a tutorial telling me to drag library items from the library to a page.
    This is a library that the book author created that came with the book.
    However, I can't get material from the library to any of the pages.
    Anytime I try dragging any of the images or other items from the library to my page in InDesign CS4, I get a small "No" symbol (a circle with a slash through it).
    So I clicked on the image in the library that I wanted to add to the page, and using both the content menu (and later, the library panel's menu) to select "Place Item," nothing happened.
    How do I get content in a library on to a page?
    Dragging and using "Place Item" are not working for me.

    Hello, Lee Sarah, and thanks for answering.
    If I understand you correctly, this is what I did:
    I "right" clicked on the Library file icon on my hard drive, called "Healthy Pets CS4."
    This brought up a context menu.
    From there, I went to "Properties."
    Under "Properties" > "Attributes," "Read only" is not checked off, nor is "hidden" checked off.
    In the "Healthy Pets CS4 Properties" dialog box, I then clicked on the the "Security" tab, which brought up all sorts of stuff about permissions, read /write,  etc.
    I guess I should mention at this point that I'm on a computer running Windows Vista, since this might be pertinent to my issue (?)
    Although it's my computer, it has me on here as two different people (I'm on as Administrator and under my first name, which let's just say is "Graphics Cuddly Bear.")
    On the "Security" tab page of the dialog box is a heading called "Group or user names," and from there, depending on which name you pick from the user names, different options get high lighted in the ""Permissions for Authenticated Users" box below it.
    So, under "Permissions for Authenticated Users" (when the users "Autheticated Users" and "Admins" are selected) the following are checked off with a check mark,
    (as if to say, "These are the things you have permissions to do with this file"):
    Modify
    Read and Execute
    Read
    Write
    The only things I do not have permissions for when I check off  "Administrator" on that list is "Special Permissions."
    When AU (Autheticated Users) is checked it says I do not have "Full Control" or "Special Permissions."
    However, when I clicked on my name (GCB - "Graphics Cuddly Bear") under the heading of "Group of user names," these two things are the only ones checked off:
    Read and Execute
    Read
    So I went in to another area of this box and gave my account ("GCB") the "Write" ability.
    When I went back to the box, a check mark next to "Write" then appeared. So it appears to be telling me that under GCB, I can now write to that file.
    So when I opened and closed out of InDesign and re-opened it, it still will not allow me to drag the files/text/images from the library.
    I still get the little "No" symbol.
    It also still will not let me use the "place" command, either.
    I've gone ahead and worked thorugh this chapter without being able to use the author's library items, but it makes working on her tutorials very difficult.
    And it's rather pointless, since the entire chapter is about how to use the software's library.  
    I got a response from the book's publisher (Delmar / Cengage) to ask them for help, if they would provide me with working copies of the files, or some other work around, and they were NOT the least bit helpful.
    A representative from Delmar/ Cengage e-mailed me to say that because I purchased the book at Amazon's site (rather than from them directly) that they would not help me, which I thought was cruddy and not classy.
    I don't see that it entirely matters where I bought the book from; they're the ones who made it.

  • Insert data into table from JSP page using Entity Beans(EJB 3.0)

    I want to insert data into a database table from JSP page using Entity Beans(EJB 3.0).
    1. I have a table 'FRIENDS', (in Oracle 10g database).
    2. It has two columns, 'NAME' and 'CITY'. Both have datatype strings(varchar2).
    3. Now from a JSP page, having two textfields, 'NAME' and 'CITY', I want to insert data into table 'FRIENDS'.
    4. In between JSP and database is a Entity Bean(EJB 3.0) and a stateless session bean.
    5. I am using JDev as editor.
    Please provide me code ASAP or link with similar example.
    Thank you.
    Anurag

    Hi,
    I am also trying that scenario. So u can
    Post the jsp form data to a Servlet which will act as a Controller.
    In the servlet invoke the business method.
    Similar kind of app is in www.roseindia.net
    Hope this would help u.
    Meanwhile if u get any optimal solution, pls post it.
    Thanks,
    Happy Java Coding.

  • When saving library item, only OPEN pages updating (closed pages not updating)

    When I save my library item it only updates the pages that are OPEN and not the ones that are closed. It starts the update process then stops after updating the open pages and never completes the process. I have to click "stop" after a minute or so. Then it prompts me to update the pages again.
    How can I get it to update ALL pages associated with the library item?
    Here's the library code:
    <!-- #BeginLibraryItem "/Library/menu_left.lbi" -->
    <link href="css/stevens.css" rel="stylesheet" type="text/css">
    <table width="197" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td><a href="buy-wallace-stevens-biography.com"><img src="images/buy-wallace-stevens-biography.gif" alt="Buy Wallace Stevens: A Dual Life as Poet and Insurance Executive" width="197" height="42" border="0" /></a></td>
              </tr>
              <tr>
                <td class="menu1"><a class="menulink" href="default.htm">Home</a></td>
              </tr>
              <tr>
                <td class="menu1"><a class="menulink" href="praise-for-wallace-stevens-biography.htm">Praise for the Biography</a></td>
              </tr>
              <tr>
                <td class="menu1"><a class="menulink" href="buy-wallace-stevens-biography.com">Ordering Info</a></td>
              </tr>
              <tr>
                <td class="menu1"><a class="menulink" href="excerpts-from-wallace-stevens-biography.htm">Excerpts</a></td>
              </tr>
              <tr>
                <td class="menu1"><a class="menulink" href="wallace-stevens-photos.htm">Photos</a></td>
              </tr>
              <tr>
                <td class="menu1"><a class="menulink" href="wallace-stevens-poems.htm">Selected Poems</a></td>
              </tr>
              <tr>
                <td class="menu1"><a class="menulink" href="wallace-stevens-reading-his-poetry.htm">Wallace Stevens<br />
                  Reading his Poetry</a></td>
              </tr>
              <tr>
                <td class="menu1"><a class="menulink" href="wallace-stevens-and-elizabeth-park.htm">Wallace Stevens <br />
                  and              Elizabeth Park</a></td>
              </tr>
              <tr>
                <td class="menu1"><a class="menulink" href="wallace-stevens-lecture-by-noted-critic-helen-vendler.htm">Lecture on Stevens by  Noted Critic
    Helen Vendler</a></td>
              </tr>
              <tr>
                <td class="menu1"><a class="menulink" href="about-alison-johnson.htm">About the Author</a></td>
              </tr>
              <tr>
                <td class="menu1"><a class="menulink" href="other-works-by-alison-johnson.htm">Other Works by<br />
                  Alison Johnson</a></td>
              </tr>
              <tr>
                <td class="menu1"><a class="menulink" href="contact-wallace-stevens-biographer.htm">Contact</a></td>
              </tr>
              <tr>
                <td height="45" valign="top"> </td>
              </tr>
            </table><!-- #EndLibraryItem -->

    The following lines in the Library item are invalid code
    <!-- #BeginLibraryItem "/Library/menu_left.lbi" -->
    <link href="css/stevens.css" rel="stylesheet" type="text/css">
    <table width="197" border="0" cellspacing="0" cellpadding="0">
    <link href="css/stevens.css" rel="stylesheet" type="text/css"> belongs in the <head> section of the HTML page
    <table width="197" border="0" cellspacing="0" cellpadding="0"> belongs in the <body> section.
    Valid code would be
    <!-- #BeginLibraryItem "/Library/menu_left.lbi" -->
    <link href="css/stevens.css" rel="stylesheet" type="text/css">
    </head>
    <body>
    <table width="197" border="0" cellspacing="0" cellpadding="0">
    But I would expect the Library item to only include the table

  • Inserting new line item into existing delivery using BAPI

    Hi
    can you send me the code for inserting new line item into existing delivery either using BAPI or
    Function module.
    We are using SAP 4.7 version

    Hi Sreekanth,
    Refer to this links
    New item for outbound delivery via FM/BAPI?
    /message/3976349#3976349 [original link is broken]
    BAPI_OUTB_DELIVERY_CHANGE Help - Add new line item
    hope it is useful to you.
    Regards!

  • Cannot drag and drop library items to master page

    I'm using Windows 8 and just downloaded Muse. In following along the tutorial (https://helpx.adobe.com/use/how-to/create-website.html) the instructor has us download some graphics. One is a library item, which opens fine in the panel, but I cannot complete the action the instructor does, which is to grab the color swatches from the library panel and place them on the main template. Any ideas?
    TIA
    Liz

    I called Adobe support and it turns out that my desktop computer is 32 bit. When I tried it later on my newer laptap which is 64 bit, I can follow along on with the video without any problem. The 'updated' version on my desktop is a slighter different version than the one for my laptop. Don't know if that helps anyone else.

  • How to know if a file browser item is not null using javascript fucntion

    Hi
    <br><br>
    I tried to use javascript for validation. I have a file browser item named P55_FILE_NAME and I would like to know if this item is null or not before submit.
    <br>
    I wrote this function :<br><br>
    function validate_import(f_n){<br>
         if (trim(document.getElementByName(f_n).src) == "")<br>
         {<br>
         alert ("File name is empty.");<br>
         document.getElementByName(f_n).focus();<br>
         }<br>
         else{<br>
         doSubmit('SUBMIT');<br>
         }<br>
    } <br><br>
    When I press submit button I got an error, sounds like the src method does not exist in my input item. <br>
    Then, I looked my source page an I found this :<br><br>
    input type="file" name="p_t01" size="30"
    <br><br>
    there is know src method and the name is not P55_FILE_NAME and I don't want to use <b>p_t01</b> that will change.<br>
    <br>
    I need your help.<br>
    Benn

    Hello,
    The p_txx notation is the internal name the ApEx engine attaches to each page item. It starts with p_t01 (for the first item on page) and can end with p_t99 (hence, the max 99 items per page limit). You can see these names in your HTML source code.
    The bug in the File Browse item (fixed in version 2.2) is that the ID of the item is the internal name instead of the item name. Hence, in order to use DOM, you need to use this internal notation.
    If the File Browse item id is p_t01, you can null its content by using something like that (V2.0 notation) :
    html_GetElement('p_t01').value = '';I'm using the same, and similar code, for manipulating this type of item with no problems.
    Please document the use of this workaround, as when you'll upgrade your ApEx system, you will have to change this code back to the standard – item id equal item name.
    (Please follow Scott's advise, and keep your logic connected issues on the same thread. It will get you more quick and accurate help).
    Regards,
    Arie.

  • How to Redirect to another page Using JavaScript in ADF Faces?

    Hi Guys,
    I have a UI user case that has a af:menu which contains mutiple af:goMenuItem. When user click on the menu, the menu slides down and shows up the af:goMenuItem. As we know, you could define the page destinations in af:goMenuItem to go to another page when user clicked, but af:menu itself cannot be redirected to another page. Well, the user case wants the menu itself could be redirected if user click on it.
    So I am thinking using JavaScript to do this: when the af:menu gets clicked, redirect to another page. BUT, I looked over the ADF Faces Javascript API and was not able to find that piece of code to do this. Any help???
    Another work around for the user case scenario is to use HTML marks + CSS/JavaScript instead of af:menu and af:goMenuItem but this changes the scope of technology although it's not hard to do
    Any other idea to accomplish the user case other than what I could think of ?
    Thanks Guys!
    Jay

    Hi,
    1 - you can have a hidden command item to do the navigation based on a control flow case. In this case, you access the command component from JavaScript create a new ActionEvent and queue it
    2 - JavaScript can use an af:serverListener to call into a server side managed bean method to perform the navigation
    there is no JavaScript API for navigation in ADF Faces because navigation in JavaServer Faces is an event driven framework and we don't support developers fighting the framework.
    Frank

  • SharePoint 2013 implement simple logout button which do not redirect to default sign out page using JavaScript client object model

    I am using windows authentication in my web application.
    My requirement is to implement a sign out button which will sign out the user without having him to close the browser and application should not ask him to login again.
    I tried following two options:
     1. Redirecting the user to default signout.aspx page " /_layouts/15/SignOut.aspx "
     2. Using "Sign In as a different user" URL " /_layouts/15/closeConnection.aspx?loginasanotheruser=true "
    In first case, user is redirected to default sign out page but he can press "Go Back to Site" link to revisit the site. Another major issue is that the user has to close the browser to sign out from the application completely, which is not desirable
    in my project requirement.
    In second case, the the current user is signed out of the application but if the user has saved the password in browser, he gets signed in automatically to the application.
    I also came across the solution where we replace the default sign out page with a custom sign out page, but I am not sure whether it can be implemented using JavaScript Client Object Model of SharePoint.

    Hi 
    I'm basically looking for the exact answer for the query.
    Meanwhile you need to go through the link mentioned below in order to understand how to do it.
    Debugging and Logging Capabilities in SharePoint 2010
    Indul Hassan
    Microsoft Community Contributor
    http://www.indulhassan.com
    You Snooze.. You Lose !!

Maybe you are looking for

  • Songs in my history that i purchased that i can't get to

    Hi,      I had a very extensive song library, songs bought dating back to 2006.  when i changed over from a windows computer to a mac i didn't transfer my library over properly and lost a lot of songs.  when i log into my account and check history it

  • Can you find a ipod nano 7gen?

    can you find an ipod 7gen anyway possibel? can it be traced?

  • Delta download of material with filter on "ZFIELD" not working :-(

    Hi We have made a new field in basicdata of the material master (table MARA). We would like our EBP material filter to react on the value of this field. But it's not working In table SMOFFILFLD we have added the new field: Objekt MATERIAL table MARA

  • How to upload single heavy video file by flash AS2.0

    How can I upload single heavy video file by AS2.0 with php backend? I have video file of 200 GB but flash officially supports 100MB. http://help.adobe.com/en_US/AS3LCR/Flash_10.0/flash/net/FileReference.html Then how this can be achieved?

  • PCM installation on MS SQL 2008 R2

    Hi Experts, I am installating PCM 7.5 on MS SQL 2008 R2, but it gives me an error, the message is "Failed to connect to the Primary Server. The following error occurred: 80880007 Incorrect Database Version". Is there a new installation which works fo