After selecting the graphic's name (e.g., "picture" is the name in "picture.jpg") I select "Convert Graphic" from my HTML menu. The following script copies the selection and creates an {imageref()} macro, including a "left" tag. This particular version places the information at the top of the document, which is where the current batch of images appear. You'll need to modify the placement to suit your needs. If anyone knows of a complete parser for graphics let us all know.
on addGraphic ()
local (start, end, x)
wp.setTextMode (true)
wp.getSelect (@start, @end)
if start == end // Nothing selected
wp.setselect(0,0)
wp.insert ("\{imageref(""+source+"",attrib:"align=left")}")
else
local (source, html)
source = wp.getSelText ()
wp.setselect(0,0)
wp.insert ("\{imageref(""+source+"",attrib:"align=left")}")
window.update (window.frontmost ())
return (true)
Editor's Note:: Jeb Bateman's "Enhanced imageRef Macro" contains a ContentServer callback that converts image tags to imageRef macros.