I notice that you execute the JS inline. I think this is the
problem,
because DW loads extensions only once per session and then
stores them
for subsequent use. Try placing your JS in a function and
then calling
it in <body onLoad="yourfunc()">.
There is a lot of code in the Configuration folder, so search
through
for some examples.
Hope this helps,
Randy
must_be_user_error wrote:
> DWMX 2004 on a WinXP pro SP2 box. I am not running as
superuser, but I'm also
> only adding this script to my personal config folder.
>
> The extension is a very simple JS designed to automate
some redundant
> find/replaces when cleaning up code in documents
converted to HTML from within
> Quark.
>
> When I start Dreamweaver and run the script, it works
with no error. I can
> even run several similar extensions in a row. But try to
run the script a
> second time on a new document without closing and
restarting Dreamweaver, and
> rather than performing those nice automated
find/replaces, the script throws
> this into the head of the document, then does nothing:
>
> <head>
> <title>Cleanup</title>
> </head>
> <body>
> </body>
> </html>
>
> I'm developing this for a team of people that are not
going to want to have to
> restart DW every time they work on a new document.
>
> This is probably something simple that I'm just
overlooking. Code is below.
> Any ideas?
>
> _______
>
> <html>
> <head>
> <title>Cleanup</title>
> <script language="javascript">
> var counter = 0
> var dom=dw.getDocumentDOM();
>
> var mddfind = new Array()
> mddfind[0] = "?"
> mddfind[1] = "?"
> mddfind[2] = "?"
> mddfind[3] = "?"
> mddfind[4] = "?"
> mddfind[5] = "?"
> mddfind[6] = "?"
> mddfind[7] = "?"
> mddfind[8] = "?"
> mddfind[9] = "?"
> mddfind[10] = "?"
> mddfind[11] = "?"
> mddfind[12] = "?"
> mddfind[13] = "?"
> mddfind[14] = "?"
> mddfind[15] = "?"
> mddfind[16] = "?"
>
> var mddrep = new Array()
> mddrep[0] = "\'"
> mddrep[1] = "\'"
> mddrep[2] = "\""
> mddrep[3] = "\""
> mddrep[4] = "\—"
> mddrep[5] = "\µ"
> mddrep[6] = "\±"
> mddrep[7] = "\°"
> mddrep[8] = "\®"
> mddrep[9] = "\©"
> mddrep[10] = "\™"
> mddrep[11] = "\¼"
> mddrep[12] = "\½"
> mddrep[13] = "\¾"
> mddrep[14] = "..."
> mddrep[15] = "€"
> mddrep[16] = "§"
>
> //Make sure we're in code view
> dom.setView("code")
>
> while (counter < mddfind.length) {
> //get a value to find
> var mddfindstring = mddfind[counter].toString()
> //get a value to replace
> var mddrepstring = mddrep[counter].toString()
>
> dreamweaver.setUpFindReplace({searchString:
mddfindstring, replaceString:
> mddrepstring, searchSource: true, ignoreWhitespace:
true});
> dreamweaver.replaceAll()
>
> counter++}
>
>
dreamweaver.setUpComplexFindReplace('<dwquery><queryparams><find><qtag
> qname="font"></qtag></find><replace
action="stripTag"/></dwquery>');
> dreamweaver.replaceAll()
>
> </script>
> </head>
>
> <body>
> </body>
> </html>
>