Sunday, March 27, 2005


Worked on the initialization function today. Created a separate function in the DirectoryToolSuite section of the DirectoryTool root (initializeTool). To start, I wrote a series of comments describing the functionality of the function, then started filling it in line by line. Setting the preferences in the DirectoryTool root was not too difficult, but I had a problem for a while in writing GIF images from the tool database to files. I read the section in the Matt Neuberg book on dereferencing (page 83, Chapter 8) and also looked at the Rogers Cadenhead book (Chapter 18, pp. 203-206, where he develops a script to to manage graphics files that come as email attachments.

I imported the folder and world graphics files into the tool database at DirectoryToolData.linkimages. When I used the file.writeWholeFile command to create the file, I had problems in dereferencing (got a lot of errors). I settled for putting the caret at the end of the address. However, I could not open the GIF file in Preview, and it did not show up in the browser. I then investigated setting the file type and/or creator. I went through a series of file operations to check the path, create a new file, set its type to "GIFf", open the file, write to the file, then close the file. This worked, but seemed like overkill to me. I then went back to just using file.writeWholeFile, but this time I used the address variable and dereferenced it, in addition to setting the file type. This worked as well - whew! From the online documentation for file.writeWholeFile, the additional parameters for file type and creator should be ignored on Windows, so this logic should be cross platform.

My next steps are to review the main functions to use the new preferences I have created in initializeTool. After that, I need to test with the new prefs, then review the documentation again to include the new pref information.


10:28:57 PM