This article may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. To maintain the flow of the article, we've left these URLs in the text, but disabled the links.
|Web Q&A:Windows Script Host, Dropdown Menus, ASP-to-HTML, and More|
Q I recently read an article about Windows Script Host (WSH) 2.0. Before I become really interested, I have one question: can I use WSH to rename existing files? I downloaded the latest documentation from Microsoft, but I found no mention of this.
A Yes, you can. Through the use of the FileSystem object (as well as the File object) you can effectively rename files. The problem is you would expect to find it in the documentation under a name like Rename. Actually, the functionality is supplied via the MoveFile method. The only technical difference between a file move and a rename is that move usually indicates the ability to change the location of the file in addition to the name.
Q I have noticed the neat toolbar on the microsoft.com Web sites. I was wondering how those dropdown menus were designed. I've looked through the Backstage site (http://www.microsoft.com/backstage), to no avail.
A One of the beauties of the Web is that many of the interesting features people add to their Web sites are easily examined by simply looking at the source code for the pages, which (for the time being anyway) is still being sent to the browser as plain text.
This will allow you to save the file to your local hard drive. Do this for all three files and save them to the same location you used in the first step.
Open up the source HTML file that you saved earlier on your hard drive, and edit the three lines that I pointed out. Remove the path information for the src attribute so that all you have left is the file name itself (toolbar.js, global.js, and local.js), and then save this file back to your drive.
Now, open the HTML file you just saved in your browser. Aside from the fact that the images will not be found and most of the links will be broken, the toolbar should work. You now have all of the code necessary for the toolbar on your local machine.
By playing around with the code that you have downloaded, you should be able to see how this all comes together. No, the code presented is not quite as simple as inserting some canned functionality into your page that will magically work. You'll need to sweat a little in order to customize the code to meet your needs.
Q How can I launch an instance of Microsoft Internet Explorer 4.0 or later that does not have a toolbar or navigation bars? I sometimes want to call the browser from within my application, but I don't want to permit navigation.
A I expect that there are perhaps some command-line options that might be able to do this, but I wasn't able to find any specific information. I do know that the -k switch will bring Internet Explorer up in kiosk mode, and that -channelband will bring up the channel band.
Q We have been using ASP to create every type of page imaginable. The convenience of pointing a user to a Web-based data entry page for everything is great, but there is no reason for us to create a dynamic Web page for every user's input because some of these pages only change once a month. Is there some sort of ASP-to-HTML component that I can use to generate unchanging HTML code along the lines of "this is how your content will appear on the published page" without making it data-driven every time it's requested?
A The book Microsoft Internet Information Server Resource Kit (Microsoft Press, 1998) includes a companion CD that provides several different installable ASP components. One of them is "ASP to HTML," and sounds like it would do pretty much what you want. You could always be a fellow geek and feel obligated to write one yourself!
Q I have an ASP page that calls an ActiveX DLL from an intranet site. The DLL performs a lengthy database task. Unfortunately, while the task is in progress, Internet Explorer 5.0 decides that it has waited long enough and sends an error page back to the client. I have tried Response.Expires = 0 and setting the script timeout as high as possible. It appears that Internet Explorer will wait about three to five minutes for the DLL to finish its work before sending the error page. Is there a setting to force the browser to wait until the DLL in the ASP page is finished, either within the ASP code or for users within their browsers?
A First, I question the appropriateness of having such a long database task without providing feedback about the status of the process or allowing users to cancel. Instead, perform the operation asynchronously from the Web page, and report on the progress.
In addition to setting Keep-Alive, this allows you to use the Response.Flush and Response.Clear methods in ASP. Flush will send all currently buffered content to the client, and Clear will remove any currently buffered content from the response buffer. This is handy if, during the page's script processing, you determine that the information you've already queued up to be sent is inappropriate. This can be easier than trying to maintain a string array with the entire outgoing HTML that you want to send.
Robert Hess is an engineer in the Microsoft Developer Relations group. He provides ISVs with information to help them develop apps for Microsoft systems software. Send e-mail to firstname.lastname@example.org.
From the April 2000 issue of MSDN Magazine.