Copy link to clipboard
Copied
Here is a simple Extension that works fine in DW CS3 and doesn't work in DW CS4 (trial version):
The File myObj_Startup.htm was placed in Folder Configuration/Startup. It initializes a quite simple Javascript-Object during Startup of DW.
Content of myObj_Startup.html:
<!-- MENU-LOCATION=NONE -->
<HTML>
<HEAD>
<TITLE>beim Öffnen</TITLE>
<SCRIPT LANGUAGE="javascript">
myObj =
{
showMsg : function (msg)
{
alert(msg);
}
};
function onOpen()
{
myObj.showMsg("startup");
}
// SCRIPT ENDE
</SCRIPT>
</HEAD>
<BODY onLoad="onOpen();">
</BODY>
</HTML>
Besides this, an additional menuitem was defined in menus.xml to use the JS-object myObj:
...
<menu mmstring:name="menus/DWMenu_File" id="DWMenu_File">
<menuitem name="Test" command="myObj.showMsg('Testing');" enabled="true" domRequired="false" id="DWMenu_File_SIEMENSTEST" />
<menuitem mmstring:name="menus/DWMenu_File_New" key="Cmd+N" command="dw.newDocument()" enabled="true" domRequired="false" id="DWMenu_File_New" />
...
With Dreamweaver CS3 everything works out fine: I get a Alert-message: "startup" during Startup and when I'm clicking Menu->File->Test I get a Alert-message: "Testing".
With Dreamweaver CS4 (trial version) I get a message: "startup" as well but when I'm clicking Menu->File->Test I get no message.
Instead I get a Logfile "C:\Documents and Settings\user\Application Data\Adobe\Dreamweaver CS4\en_US\Configuration\Logs\DW JavaScript.log" telling me:
JS Error:
myObj is not defined
filename:
lineno: 0
While executing DWMenu_File_TEST command in menus.xml, the following JavaScript error(s) occurred:
ReferenceError: myObj is not defined
Why is this simple extension working in DW CS3 and not working in DW CS4?
Did they change the treatment of JS-objects initialized during startup?
Is the object out of scope?
Are such extensions not working in trial versions of DW CS4?
I cannot explain this behavior - please help!
Copy link to clipboard
Copied
Hi,
I have an similar problem and couldnt find an workaround for the problem.
When i add an new menu item to the menus.xml file, the menu item shows up, but my custom command (simple alert) wont trigger.
Can somebody please help?
Find more inspiration, events, and resources on the new Adobe Community
Explore Now