General XMetaL Discussion
XMetaL Community Forum › General XMetaL Discussion › XMetaL v4.6 – Reload image after editing
-
brad_deteau June 7, 2010 at 9:40 pm
XMetaL v4.6 – Reload image after editing
June 7, 2010 at 9:40 pmParticipants 1Replies 2Last Activity 12 years, 9 months agoHow 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,
Braddcramer June 7, 2010 at 9:51 pm
Reply to: XMetaL v4.6 – Reload image after editing
June 7, 2010 at 9:51 pmYes, 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”) { [/code]
rng = ActiveDocument.Range;
rng.CollapsedContainerTags = true;
//Application.Alert(“collapsed”);
rng.CollapsedContainerTags = false;
}
]]>And then add an item to the contextual menu:
[code]
var curNode = rng.ContainerNode; [/code]
if (rng.ContainerName==”imagedata” && rng.ContainerNode.hasAttribute(“fileref”)) { Application.AppendMacro(“&Reload Current Image”,”Reload Current Image”);
}
]]>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
brad_deteau June 7, 2010 at 10:00 pm
Reply to: XMetaL v4.6 – Reload image after editing
June 7, 2010 at 10:00 pmThanks 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
-
AuthorPosts
- You must be logged in to reply to this topic.