General XMetaL Discussion
dcramer August 13, 2009 at 5:12 pm
Is there a way to programmatically reload a single image?August 13, 2009 at 5:12 pmParticipants 1Replies 2Last Activity 13 years, 1 month ago
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?
DavidDerek Read August 13, 2009 at 5:40 pm
Reply to: Is there a way to programmatically reload a single image?August 13, 2009 at 5:40 pm
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;
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.dcramer August 13, 2009 at 6:40 pm
Reply to: Is there a way to programmatically reload a single image?August 13, 2009 at 6:40 pm
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).
- You must be logged in to reply to this topic.