CMXtraneous: JavaScript

Right on the edge of useful

Undocumented Dreamweaver: dreamweaver.popupCommand() and extra arguments

Posted Wednesday, March 30, 2005 12:17:48 AM by Danilo Celic

Danilo Celic

While it's deprecated, dreamweaver.popupCommand() is used in several places within Dreamweaver, it isn't documented as that method that is supposed to be replacing it, dreamweaver.runCommand(). In the documentation for dw.runCommand() it states that you can pass in option arguments that will be procesed by the receiveArguments() function within the called Command. dw.popupCommand() also can take optional parameters to pass on to the called Command. For example, if you wanted to pass along a first name, last name, and age of a user to a Command, you could use the following code:

dw.popupCommand('MyCoolCommand.htm','Bill', 'Horvath', 97);

Again, this method has apparently been deprecated since Dreamweaver 3, but its still around, at least through Dreamweaver MX 2004, 4 versions later.

Category tags: Dreamweaver, Extensibility, JavaScript

Undocumented Dreamweaver: dw.loadString()

Posted Saturday, March 05, 2005 7:08:20 PM by Danilo Celic

Danilo Celic

Many times you'll need access to similar messages that you present to the user, whether in alerts for errors, or in notes on dialogs in a Dreamweaver extension. You could include the same text over and over again, in all of the extensions you have as part of your project, or you could write your own custom file manipulation functions that would share a common file to store your common text. Well, the great folks that bring you Dreamweaver also thought of this second method, they just happened to not document it just yet, and it's called dreamweaver.loadString().

Essentially, the loadString method takes as a parameter, an identifying ID that identifies the particular string that you're trying to use within your extension. Well, what does that mean? Ok, here's a code snippet to test out using Tom's JavaScript Eval panel:

alert(dw.loadString('General/docEncoding'));

On my system, I get alerted: iso-8859-1

So, where, and how do you store your strings so that that you can load them when needed?

As usual, you need to get into the Dreamweaver configuration folder. Go to the Configuration/Strings/ folder. You store your data in a specially formatted XML file. See the following code for an example of the format:

<strings>
  <string id="uniqueIdentifier" value="string to store">
</strings>

You can have multiple <string> tags within the parent <strings> tag.

Make sure that you uniquely identify your strings, preferably by "scoping" the strings by including your company name, or your initials, and also save your strings XML file with a unique name inside the Strings folder. All this is to avoid any naming conflict with other developers, or with built in stings, and strings XML files.

Category tags: Dreamweaver, Extensibility, JavaScript

sIFR 2.0 RC4 is Available for Download

Posted Thursday, March 03, 2005 5:13:43 PM by Stephanie

Stephanie

It's good for search engines and it's good for accessible beauty. If you're bored with the same old fonts, be sure to give sIFR a whirl. Mike Industries has released Release Candidate 4 -- it's getting closer to final all the time due to Mark Wubben's (yes, he's about 18) tireless work on tweaking the javascript. This time, they've disabled IE Mac (since it's so quirky) and given instructions on reenabling if you desire. There's better transparency and selector support in this version as well. They've also given us access to some cool add-ons like, preference manager and rollback (for style switchers). More info is available in The sIFR wiki. The wiki has lots of other good info, so use it or the new forums to stay apprised of the newest info.

So hurry over and download sIFR today. :)

Category tags: Accessibility, CSS, Dreamweaver, Flash, JavaScript, Search