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 | ||||
Robert Hess | ||||
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.
Of course, a well-crafted solution would also incorporate appropriate error handling to deal with the case in which the source file doesn't exist, or the destination file already exists. 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 (https://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.
These lines indicate where you can find some additional JavaScript code that's being used on this page. To view it, simply type in the URL (https://www.microsoft.com/library/toolbar/toolbar.js) in your browser. 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.
If you save this file as msft.vbs and execute it, it will open up a view to the Microsoft Web site without displaying a toolbar. From this script code, you have full access to Internet Explorer as a programmable object, and can control other features and capabilities of the browser. 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.
This automatically sets the Keep-Alive header. You should set this before any content is sent back from the server. I do it as the first line of my ASP file. |
||||
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 webqa@microsoft.com. |
From the April 2000 issue of MSDN Magazine.