General XMetaL Discussion

XMetaL Community Forum General XMetaL Discussion XMetaL v4.6 – Reload image after editing

  • brad_deteau

    XMetaL v4.6 – Reload image after editing

    Participants 1
    Replies 2
    Last Activity 12 years, 9 months ago

    How do I reload an image after editing the source on my hard drive?  The only way I have been able to get around this is to rename the image file name.  Otherwise, I see the old image.

    I read how to write a script …

    //XMetaL Script Language JScript:
    //Select the image before running this script…
    rng = ActiveDocument.Range;
    rng.CollapsedContainerTags = true;
    Application.Alert(“collapsed”);
    rng.CollapsedContainerTags = false;

    There is also ActiveDocument.Reload() but that reloads the document from disc.

    … but I'm not a programmer … just a DA user.  Maybe it's time for a quick tutorial on how to incorporate this script.

    Thanks in advance gurus,
    Brad

    Reply

    dcramer

    Reply to: XMetaL v4.6 – Reload image after editing

    Yes, that's the way to do it (I believe the code snippet you found was Derek's answer to my question). Add a macro to reload the image. In my case the image element name is imagedata:

    [code]  if (rng.ContainerName == “imagedata”) {
    rng = ActiveDocument.Range;
    rng.CollapsedContainerTags = true;
    //Application.Alert(“collapsed”);
    rng.CollapsedContainerTags = false;
        }
                                                                                                               
    ]]>
    [/code]

    And then add an item to the contextual menu:

    [code]var curNode = rng.ContainerNode;
    if (rng.ContainerName==”imagedata” && rng.ContainerNode.hasAttribute(“fileref”)) {   Application.AppendMacro(“&Reload Current Image”,”Reload Current Image”);
    }
                 
    ]]>
    [/code]

    Now the user can right-click on the image and select “Reload Current Image”.

    Adjust for the names of the elements in your dtd.

    David

    Reply

    brad_deteau

    Reply to: XMetaL v4.6 – Reload image after editing

    Thanks for the quick reply, David.

    I've never added a macro, nor edited the contextual menu.

    I see how to record a macro, but not add one.  Can you detail the steps for me?  I would be much obliged to ya.

    B

    Reply

  • You must be logged in to reply to this topic.

Lost Your Password?

Products
Downloads
Support