Archive for June, 2007

Get your FREE Adobe AIR book!

I’ve read from Daniel Dura’s post yesterday that there’s a new AIR Pocket Guide book for JavaScript Developers on Amazon.

Well, just a day later, I saw this post from ajaxian.com that they have the book for download, FOC!

Get it here!

AddThis Social Bookmark Button

Tutorial: How To Add .chm Files To Dreamweaver’s Help

Objective

To add a .chm file to Dreamweaver’s Help

Files Required

Any .chm file (I’ve used PHP’s documentation)

Tested With

Dreamweaver 8 on Windows (If anyone tested this on a Mac, please leave a comment!)

Little Bit Of Background

I recently began to learn PHP, and wasn’t very happy to find that Dreamweaver had no language support for PHP natively. Googled for methods to “add .chm files to the Dreamweaver Help” did not yield any useful results as well. Closest that I got was this article on Adobe livedocs, which I had tried to implement but failed :( . So here’s my own step by step tutorial to anyone who wants to add .chm files to Dreamweaver’s drop down Help. :)

Let’s Get Started!

Step 1
Navigate to the following folder:
C:\Program Files\Macromedia\Dreamweaver 8\Help

Step 2
Place a copy of your .chm file there. (For this example, I’ll be using php_manual_en.chm)

Step 3
Open help.xml

Step 4
Add the following:

<book-id id="DW_PHP" win-mapping="php_manual_en.chm" mac-mapping="PHP Manual (English)"/>

to your code with reference to line 4 in the code snippet below.

1
2
3
4
5
<help-books>
    .
    .
    <book-id id="DW_PHP" win-mapping="php_manual_en.chm" mac-mapping="PHP Manual (English)"/>
</help-books>

Here’s the explainations for book-id’s attributes

  • id: A unique identity. Just make sure that no other text in this xml file clashes with what you entered and you should be safe.
  • win-mapping: The name of the .chm help file in Windows
  • mac-mapping: The name of folder that contains the html files in Macintosh.

Step 5
Navigate to the following folder:
C:\Program Files\Macromedia\Dreamweaver 8\Configuration\Menus

Step 6
Open menus.xml

Step 7
Add the following:

<menuitem name="PHP Manual (English)" enabled="true" arguments="'PHP'" file="Menus/MM/CSHelp.htm"  id="DWMenu_Help_PhpManual" />

to your code with reference to line 13 in the code snippet below. You can find it at the bottom of the whole xml file (add separators to beautify. :D ):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<menus xmlns:MMString="http://www.macromedia.com/schemes/data/string/">
    .
    .
    <menubar name="Main Window" id="DWMainWindow">
        .
        .
        <menu name="_Help" id="DWMenu_Help">
            <menuitem name="_Dreamweaver Help" enabled="true" arguments="'DWHelp'" file="Menus/MM/CSHelp.htm" id="DWMenu_Help_DWHelp" />
            <menuitem name="_Getting Started with Dreamweaver" enabled="true" arguments="'DWTutorial'" file="Menus/MM/CSHelp.htm"   id="DWMenu_Help_GettingStarted" />
            <menuitem name="Dreamweaver _LiveDocs" enabled="true" command="dw.browseDocument('http://livedocs.macromedia.com/go/livedocs_dreamweaver')" id="DWMenu_Help_LiveDocs" />
            <menuitem name="What's _New in Dreamweaver 8" enabled="true" arguments="'DWWhatsNew'" file="Menus/MM/CSHelp.htm"   id="DWMenu_Help_WhatsNew" />
            <separator />
            <menuitem name="PHP Manual (English)" enabled="true" arguments="'PHP'" file="Menus/MM/CSHelp.htm"  id="DWMenu_Help_PhpManual" />
            <separator />
            .
            .
        </menu>
    </menubar>
</menus>

Here’s the explainations for menuitem’s attributes:

  • name: The text that will be shown in the Dreamweaver’s Help.
  • enabled: Of course we want it enabled! :D
  • arguments: This is important. Take note of what you entered here, for we’ll be needing it in a very short while.
  • file: This is the file with the JavaScript to launch our .chm file. We’ll take a look into it next.
  • id: A unique identity. Just make sure that no other text in this xml file clashes with what you entered and you should be safe.

Step 8
Navigate to the following folder:
C:\Program Files\Macromedia\Dreamweaver 8\Configuration\Menus\MM

Step 9
Open CSHelp.htm using Dreamweaver (Note: this is the file that we had specified in the above file attribute.)

Step 10
Add the following:

} else if ( arguments[0] == 'PHP' ) {
        helpDoc = "DW_PHP:index.html";

to your code with reference to line 22 in the code snippet below:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
function receiveArguments() {
    if ( arguments[0] == 'DWUsing' ) {
        helpDoc = MM.HELP_mnuDWUsing;
    } else if ( arguments[0] == 'DWHelp' ) {
        helpDoc = MM.HELP_mnuDWHelp;
    } else if ( arguments[0] == 'CFUsing' ) {
        helpDoc = MM.HELP_mnuCFUsing;
    } else if ( arguments[0] == 'DWGuidedTour' ) {
        helpDoc = MM.HELP_mnuDWGuidedTour;
    } else if ( arguments[0] == 'DWTutorial' ) {
        helpDoc = MM.HELP_mnuDWGettingStarted;
    } else if ( arguments[0] == 'DWWhatsNew' ) {
        helpDoc = MM.HELP_mnuDWWhatsNew;
    } else if ( arguments[0] == 'UDGuidedTour' ) {
        helpDoc = MM.HELP_mnuUDGuidedTour;
    } else if ( arguments[0] == 'UDTutorial' ) {
        helpDoc = MM.HELP_mnuUDTutorial;
    } else if ( arguments[0] == 'Extending' ) {
        helpDoc = MM.HELP_mnuDWExtending;
    } else if ( arguments[0] == 'API' ) {
        helpDoc = MM.HELP_mnuDWAPI;
    } else if ( arguments[0] == 'PHP' ) {
        helpDoc = "DW_PHP:index.html";
    } else if ( arguments[0] == 'ConUsing' ) {
        helpDoc = "Con_Using:index.htm";
    } else {
        helpDoc = "DW_Using:index.htm";
    }
}

In the else if clause, the arguments[0] refers to the arguments attribute in the xml from Step 7. When assigning a value to helpDoc, the “DW_PHP” is referring to the id attribute in Step 4. And finally, we want the page to navigate to the index.html in the .chm file, so we have to add “:index.html” at the end. (Note: if you just assign “DW_PHP” to helpDoc, it will not work.)

Step 11
Save all files and restart Dreamweaver.

Step 12
When you launch the file from the Dreamweaver help menu, it might not show the intended index.html as we had expected. I can only assume that there’s some place that requires fixing, and frankly speaking, I have no idea where! :P As mentioned in Step 10, if you remove the “:index.html”, it will not even launch the appropriate .chm that you want as Dreamweaver has mapped the default to it’s own help.

Final Note

If anyone is able to fix the last issue, please drop a comment and let me know! Or if you have an easier method to make this work, I’ll be glad to hear from you and add a link here.

Hope this helps! ;)

AddThis Social Bookmark Button

Loading Text From XML

Made a silly mistake while loading text from an external XML file and I really really don’t want anybody to follow in my footsteps. :P

<strings>
    <string id="someString">
        <![CDATA[Sentence one\nSentence two]]>
    </string>
</strings>

Does the above code looks flawed to you? Take a moment and look it through. :)


When you do the below AS2 codes in flash, what the \n does in the string is basically creating a newline, and thus "Sentence two" will appear below "Sentence one".

var txt:TextField = createTextField( "txt", _root.getNextHighestDepth(), 100, 100, 200, 200 );
 
txt.text = "Sentence one\nSentence two";

Happily, I ported all these original strings into an XML and got it loaded. What puzzled me was that, when these text were actually loaded, the \n didn’t work! The textfield simply displayed "Sentence one\nSentence two" without the newline. I sought help from a fellow colleague, Arul, and together, we still could not see what’s wrong with it. We left office without solving that "bug".

That night, Arul called to say, "Hey, with CDATA, we don’t need the \n! We simply just need to hit <enter>!" Immediately it struck me, oh ya! That’s the whole idea of using CDATA isn’t it? We got too engrossed with the wrong problem! :D

The next day, I changed all the \n to <enter> key, and expected things to work. Unfortunately though, the text did not turn out as expected. Flash had interpreted my <enter> in XML as double <enter>s when it’s being displayed on the textfield!

I sought Arul’s advice again and this is what I got. Flash interprets <enter> in external text sources as "\r\n", which explains the double <enter>s being rendered. So, what I actually had to do is to run through the string, strips off the "\r", and change it to "" (empty string).

Here’s the code that solves the above issue.

function processString ( s:String ):String
{
    return s.split("\r").join("");
}

Hope this helps! ;)

AddThis Social Bookmark Button

Apollo, Moxie, Frogstar

I have no idea which one I should be more excited about! :D

Adobe Integrated Runtime (AIR)
Codename: Apollo
Name: Adobe Integrated Runtime (AIR)
Info: http://labs.adobe.com/technologies/air/
Description: Adobe AIR, formerly code-named Apollo, is a cross-operating system runtime that allows developers to use their existing web development skills to build and deploy rich Internet applications to the desktop.
Download Runtime (Beta) | Download SDK (Beta)

Adobe Flex 3
Codename: Moxie
Name: Flex 3
Info: http://labs.adobe.com/technologies/flex/
Description: Adobe Flex 3 is a cross platform, open source framework for creating rich Internet applications that run identically in all major browsers and operating systems.
Download Builder (Beta) | Download SDK (Beta)

Adobe Flash Player
Codename: Frogstar
Name: Flash Player Update 3
Info: http://labs.adobe.com/technologies/flashplayer9/
Description: Adobe Flash Player is the high-performance, lightweight, highly expressive client runtime that delivers powerful and consistent user experiences across major operating systems, browsers, mobile phones, and devices.
Download Player (Beta)

Along with the above mentioned series of exciting betas, there’s also a contest going on called Adobe AIR Developer Derby! Read more!

AddThis Social Bookmark Button

Lesser Space After Uninstalling CS3 Than Before?

It’s weird, but I need confirmation. Solutions are more than welcome. :)

I’ve installed and uninstalled Adobe CS3 Design Premium twice, and with each uninstall, the size on my hard disk seems to have gone down quite a bit (~600mb). I can’t confirm the actual size because in between the installation I’ve been adding some files on my computer but definitely not ~1.2gb worth.

After each uninstall, I’ll be emptying whatever contents (if any) in my recycle bin, cleaning up the temporary internet folders, and even defragmenting my registry and doing disk clean up. Tried to look into the Program Files folder to find any repository of temporary installation files that might have facilitated the installation, but to no avail. All that couldn’t get me back my lost space.

Anyone experienced this as well?

AddThis Social Bookmark Button