While I don't much like the phrase "eating your own dogfood", the concept is good. Any software developer should use his or her own software on a regular basis. Sometimes that is a nuisance, but sometimes, like today, it is a pleasure. I realized that our Web Editors page had lots, as in 285, URL links, and that many of them had a target of "_top" to replace the current page, when I wanted them to have a target of "_blank" to create a new page. I changed about ten by hand, got bored, and wrote a quick Midas script which took care of them all in about 5 seconds (plus the five minutes it took to write). Here is the code:
Call rtitem.ConnectFormBody
(""
, "showcase.nsf"
, "WebEditors"
)Set rtchunk
= rtitem.DefineChunk
("URLLink 1"
)While rtchunk.Exists
target
= rtchunk.GetTargetProperties
("URLLink"
, "Target"
) If target <> "_blank"
Then Call rtchunk.SetTargetProperties
("URLLink"
, "Target='_blank'
")
rtchunk.GetNextTarget
Wendrtitem.Save
Messagebox("Fixed up all "
& rtitem.Everything.GetCount
("URLLink"
) & " URL hotspots"
)See, your own dogfood can taste good, once in a while. Of course, I could have written it more simply and efficiently, I now see, with:
Call rtitem.ConnectFormBody
(""
, "showcase.nsf"
, "WebEditors"
)Set rtchunk
= rtitem.DefineChunk
("URLLink *"
)Call rtchunk.SetTargetProperties
("URLLink"
, "Target='_blank'
")
rtitem.Save
Messagebox("Fixed up all "
& rtitem.Everything.GetCount
("URLLink"
) & " URL hotspots"
)which runs in about a second and a half, but in either case, it sure beats going to each hotspot manually.
Copyright © 2005 Genii Software Ltd.