Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Extension error if DW is not restarted between uses

Guest
May 07, 2008 May 07, 2008

Copy link to clipboard

Copied

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?

_______
TOPICS
Extensions

Views

395
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 20, 2008 May 20, 2008

Copy link to clipboard

Copied

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] = "\&#151;"
> mddrep[5] = "\&#181;"
> mddrep[6] = "\&#177;"
> mddrep[7] = "\&#176;"
> mddrep[8] = "\&#174;"
> mddrep[9] = "\&#169;"
> mddrep[10] = "\&trade;"
> mddrep[11] = "\&#188;"
> mddrep[12] = "\&#189;"
> mddrep[13] = "\&#190;"
> mddrep[14] = "..."
> mddrep[15] = "&euro;"
> mddrep[16] = "&#167;"
>
> //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>
>

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 22, 2008 May 22, 2008

Copy link to clipboard

Copied

LATEST
These answers are brilliant and are the best answers you are going to get

http://www.cozzieworld.com/ play games, look at media, have free membership with many benefits right here at cozzieworld

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines