General XMetaL Discussion

XMetaL Community Forum General XMetaL Discussion Is there a way to programmatically reload a single image?

  • dcramer

    Is there a way to programmatically reload a single image?

    Participants 1
    Replies 2
    Last Activity 13 years, 1 month ago

    Hi there,
    Often users modify images using a separate utility (I've added “Edit svg in Illustrator” and “Edit .vsd source in Visio” macros available from contextual menus to make that easier to do). When that happens, the only way I've found to get XMetaL to show the changes is to reload the whole document. I can manually cut the path to the image from the fileref attribute to make the image disappear and then paste the path back into the fileref attribute in the attribute inspector, but that's quite clumsy.

    Is there a way to tell XMetaL to reload one (or all) images without reloading the entire document?

    Thanks,
    David

    Reply

    Derek Read

    Reply to: Is there a way to programmatically reload a single image?

    Collapsing and expanding the element should do it, something like this works for me:

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

    You could cycle through all images in the document to get them all to redraw.

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

    Note that this does not alter any associated attribute values. That would need to be dealt with separately if you want to change them.

    Reply

    dcramer

    Reply to: Is there a way to programmatically reload a single image?

    Oh Derek, is there anything you don't know?

    That's exactly what I needed…a macro so they can right click on an image and select “Reload this image” (no need to reload all images).

    Thanks,
    David

    Reply

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

Lost Your Password?

Products
Downloads
Support