[CS3][VB] AssociatedXMLElement

Hi
There must be something wrong with AssociatedXMLElement property in CS3.
It throws an InvalidCastException with the message, "Return argument has an invalid type." if a TextFrame or Rectangle has a Tag
What is wrong with this code...?
Dim Rec As InDesign.TextFrame
Rec = myDocument.TextFrames.FirstItem
Dim x As Object
x = Rec.AssociatedXMLElement
/Andy
Using VS2005 and CS3 5.0.3.662

Hi
I agree. There must be a problem with the type library, because that error is persistent.
Anyone care to elaborate?
Thanks,
Ruvan Fernando
Frontlab

Similar Messages

  • [CS3/CS4 JS] How can you get the associatedXMLElement of a merged cell in a table?

    Hi!
    Inserting a table, and autotagging it, I get a table with a number of cell elements in the XML Structure.
    Selecting an item in the table, I can find the associated XML by the following line of code:
    app.selection[0].associatedXMLElement
    My problems begin when cells are merged. Then the associatedXMLElement for the cell returns null.
    How can I find the associatedXMLElement for a merged cell?
    Using the getElements makes no difference.
    app.selection[0].getElements()[0].associatedXMLElement
    (returns null)
    In the XML structure I can see that the merged cell is still associated to an XML Element, which becomes underlined and also referrs back to the cell, selecting it when double clicking the XML Element link in the structure.
    Is there no way to get to the xml element of a merged cell?
    I have tested in CS3 and CS4 as well, and they act in the same way.
    I also found a similar, unanswered, question from Anne-Laure Jallon in the "With CS3, some things have changed" ( http://forums.adobe.com/message/1105813#1105813 ):
    Hello,
    I'm working with VBscript.
    Is there a difference between cell.associatedXmlElement in CS2 and CS3?
    All my cells in CS2 had an associatedXmlElement.
    In CS3, my table has an associatedXmlElement, but all its cells don't (The value is Nothing)
    Is this a bug? Is it linked with XML evolution?   Thanks Anne Laure
    Adding some more info:
    I made a test, by selecting the XMLElement in the structure, and from that object finding the cell, and finding back to the assiciatedXMLElement:
    app.selection[0].getElements()[0].cells[0].associatedXMLElement
    Result: [object XMLElement]
    So that kind of "chain" works.
    But with the merged cell as only reference, I can't find its associatedXMLElement. Any ideas would be appreciated.
    Best regards,
    Andreas Jansson
    Message was edited by: Andreas Jansson

    In my opinion, locate a cell according to his content is not so effortable. What happens if contents of more than two cells are equals?
    I take xml elements of associated xml element of table and put them into an array.
    This array contains associated xml elements of every cell ordered by cell positions into table.
    Now, locate associated xml element of a cell based on its array position (index) is more reliable:
    var myCell_cell = app.selection[0];
    var myElement = myCell.associateXMLElement
    if (!myElement || !myElement.isValid)  {
         var table =  myCell.parent;
         var xml_tab = table.associatedXMLElement;
         var xml_cells_arr = xml_tab.xmlElements.everyItem().getElements();
         var idx = myCell.index;
         myElement = xml_cells_arr[idx];
    Alex ;-)

  • [JS,CS3,CS4] Converting Paragraph numbering to text

    I'm trying to add line numbers by applying paragraph numbering to selected text (which I call "myText"), then converting numbers to text (then later I'll use GREP to remove the period and shift them to the right).
    I'm new to scripting, and wonder why the following doesn't work:
    myText.bulletsAndNumberingListType=1280601709;
    myText.convertBulletsAndNumberingToText();
    The first line seems to add the numbering as I'd like, but the second line just makes them disappear again!
    Thanks for any help you can give -- Jeremy

    I just had a similar problem.
    I have no idea whether my solution works in CS3.
    ( function() {
         var doc = app.activeDocument;
         // the image page item
         var r = doc.rectangles.item(0);
         // the destination textframe to hold the inline
         var tf = doc.textFrames.item(0);
         // it should already be tagged.
         // create a nested, blank tag
         var xe = tf.associatedXMLElement.xmlElements.add("bla");
         // copy the rect as inline
         xe.placeIntoInlineCopy(r,true);
    Dirk

  • [JS][CS3] Change the content type of a text frame

    Hi,
    a bit basic maybe but I'm stuck on this from an hour...
    I need a textFrame to become a graphic object.
    The textFrame has no content.
    How can I change the contentType on that object?
    Thanks anticipately.

    This looked like an interesting challenge, so I'm taking a shot at it. I created a new document and added three text frames (unpopulated) to the first page. I tagged them "Image", "Caption" and "credit". I then exported as a snippet, deleted the document and opened another new one. Then I placed the snippet (so far, everything has been manual -- no scripts) and indeed, the snippet placed and the frames were added to the document's structure and were properly tagged -- the three tags were automatically created by the action of placing the snippet.
    So, let's duplicate this in a script. Even though I know exactly where the snippet is, I'm going ask the user to find it. That way, I eliminate the issue of getting the path to the snippet wrong:
    var myDoc = app.documents.add();
    var myPage = myDoc.pages[0];
    var myPlacePoint = [myPage.marginPreferences.left, myPage.marginPreferences.top];
    var mySnippetFile = File.openDialog("Choose the snippet");
    if (mySnippetFile == null) { exit() }
    var mySnippet = myPage.place(mySnippetFile, myPlacePoint);
    And that worked. The snippet is on the page exactly where I wanted it. So, now we need to find the text frame that has the "image" tag. First, we must explore just what mySnippet consists of.
    OK, it's an array of three stories. That's a tad weird. Why isn't it an array of three text frames? I wonder what would happen if two of the frames in the snippet were threaded -- but let's address that later after we solve the immediate issue. The point is that we know that the snippet consists of three separate text frames that aren't threaded. So:
    for (var j = mySnippet.length - 1; j >= 0; j--) {
         var myTag = mySnippet[j].associatedXMLElement.markupTag.name;
         alert(myTag);
    And this gives me the three tags (and reminds us that when you tag a text frame you're also tagging the story that holds it. So:
    var myDoc = app.documents.add();
    var myPage = myDoc.pages[0];
    var myPlacePoint = [myPage.marginPreferences.left, myPage.marginPreferences.top];
    var mySnippetFile = File.openDialog("Choose the snippet");
    if (mySnippetFile == null) { exit() }
    var mySnippet = myPage.place(mySnippetFile, myPlacePoint);
    for (var j = mySnippet.length - 1; j >= 0; j--) {
         var myTag = mySnippet[j].associatedXMLElement.markupTag.name;
         if (myTag === "Image") {
              var myFrame = mySnippet[j].textContainers[0];
              myFrame.contentType = ContentType.graphicType;
              break;
    And that does the job.
    Thomas,
    You were very close but you forgot that the text frames that make up a story are addressed as textContainers from CS3 onwards. Your code would have worked in CS2.
    Dave

  • AssociatedXMLElement InvalidCastException

    Hi
    I've tried asking this in the Scripting forum but no reaction so far..
    Maybe some of you C++ guys have worked with InDesign as a COM object in VS and have an idea on how to solve this.
    I can't use AssociatedXMLElement property in CS3.
    It throws an InvalidCastException with the message, "Return argument has an invalid type." if a TextFrame or Rectangle has a Tag
    What is wrong with this code...?
    Dim Rec As InDesign.TextFrame
    Rec = myDocument.TextFrames.FirstItem
    Dim x As Object
    x = Rec.AssociatedXMLElement
    /Andy
    Using VS2005 and CS3 5.0.3.662

    Hi Andy,
    I've somehow missed your question in the other forum, but the short answer is: don't use Dim. Turn Option Explicit off. In essence, act as if you are working in VBScript (member of the VB family supported by InDesign), and you'll get much better results. InDesign scripting relies on the Variant type, and is loosly-typed by design. Trying to use stronger typing will only cause problems.
    Thanks,
    Ole

  • CS3 - Add xmlElement to footnote reference

    Hi All,
    InDesign/Javascript/Windows/CS3
    I am setting the process for Indesign XML, in this process footnote has giving more problems, footnote will not allow to add tags, i want to add the footnote reference number to '<fc>1</fc>' like this.
    How can i get the number from footnote?
    Regards,
    sudar

    Hi,
    well you will have to convert footnotes to text to add tags to them.
    This is a task that I will have to do in about a few weeks.
    Use the following code as a first idea and as a skeleton.
    Given: a tag named 'footnote', a tagged story with footnotes, and the cursor placed in text of the story.
    var myDoc = app.activeDocument;
    var myStory = app.selection[0].parentStory;
    var myNote = myStory.footnotes.firstItem();
    var myTag = myDoc.xmlTags.item('footnote');
    // add xmlElement
    var myXMLElement = myStory.texts.firstItem().associatedXMLElements[0].xmlElements.add({markupTag:myTag});
    // markup insertionPoint after the footnote
    myStory.insertionPoints.item(myNote.storyOffset.index+1).markup(myXMLElement);
    // move text of the footnote into the markedup insertionPoint (leaving footnotenumber and space behind in the footnote)
    myNote.characters.itemByRange(2,myNote.characters.count()-1).move(LocationOptions.AFTER, myStory.insertionPoints.item(myNote.storyOffset.index+2));
    // remove footnote
    myNote.remove();
    What does it do?
    1. Add a xmlElement to the associatedXMLElement of the story (with markupTag 'footnote')
    2. Markup the the insertionPoint after the footnote with this xmlElement.
    3. Move the text of the footnote into the tagged insertionPoint after the footnote (but leave the number and the space at the beginning of the footnote where it is).
    4. Remove the footnote.
    Repeat this while the count of footnotes of the story is not equal to 0.
    After having converted the footnotes to text (and marked them up with the footnote-tag) you will have to markup more elements of the footnotes like text applied with characterStyles or like paragraphs. Maybe you can do this immediately after the conversion of one footnote to text or you would better do this after the conversion of every footnote to text stepping thru the footnote-xmlElements.
    Martin

  • CS3/VBScript: Retrieving LabColor Info From Swatches

    Back in AI 7.0, I was able to both create swatches and spot colors via VBScript, and retrieve color information.  With CS3, I am able to create spots, but not retrieve the color information from them.  Is intentional, or am I doing something wrong?
    Using VBScript, I would like to return Lab information from a series of swatches in an open document.
    Any and all help would be greatly appreciated.

    In my opinion, locate a cell according to his content is not so effortable. What happens if contents of more than two cells are equals?
    I take xml elements of associated xml element of table and put them into an array.
    This array contains associated xml elements of every cell ordered by cell positions into table.
    Now, locate associated xml element of a cell based on its array position (index) is more reliable:
    var myCell_cell = app.selection[0];
    var myElement = myCell.associateXMLElement
    if (!myElement || !myElement.isValid)  {
         var table =  myCell.parent;
         var xml_tab = table.associatedXMLElement;
         var xml_cells_arr = xml_tab.xmlElements.everyItem().getElements();
         var idx = myCell.index;
         myElement = xml_cells_arr[idx];
    Alex ;-)

  • 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);

Maybe you are looking for

  • How to load/place an Image in Window UI (ID CS4)

    Hi, Can anybody help me on how to place an Image in User interface window. Thanks, Gopal

  • Recovery in noarchive mode

    My oracle database 11g running in no archive mode, Accidently some of the user datafiles move to some other location and them move back to same location with os command while database running in open mode , at that point in time redo log files changi

  • How to create multiple tables in Adobe air?

    Hi, I am using Flash CS5 coding for adobe air 2.0. How do you create a database with multiple tables and link them together? I know how to do it in SQL just can't seem to get it to work in Flash CS5 Adobe air. The following is ONLY an example of a da

  • How to develop a vendor....

    Hi,       How to Develop a vendor master analysis report, which lists the material including material number and storage location

  • Question for Verizon Reps

    Hello, I have a couple of questions: I ordered an iPhone 6 and an iPhone 6+. Will they ship separately since the availability date was different? I believe the 6 was available on 9/19 and the 6+ on Oct. 7. When I ordered the 6+ it asked me if I wante