Hi,
"Tony" <***@discussions.microsoft.com> wrote in message news:07a301c3c18b$13b6ae20$***@phx.gbl...
| Thanks for your reply.
| But it does not work in my PC (win2k) :( . I just copy
| your script belows to a vbs file, and run it by double
| click it.
Unfortunately, the solution that Rob posted is WinXp-only. I don't know the
ASP implications, but the Common-Dialog file browsing common dialogs require
a bit of consideration in WSH-hosted vbs. Pick your poison:
The MS Common Dialog Object (MSComDlg.CommonDialog)
The MSComDlg object is the best alternative, is present on all installations
and is exposed through the comdlg32.ocx file. While this file is supplied
with all versions of Windows, it requires a license for scripting use, which
is typically derived from the installation of an MS development or
programming application, such as VB or VideoStudio. Fortunately, VBCCE,
which MS provides as a free download, also installs a license (credit Tom
Lavedas). Most installations, however, will not have VBCCE or another
development tool installed, and so will not have access to the MSComDlg
object dialogs.
The Java File Objects (java:com.ms.wfc.ui.OpenFileDialog and
java:com.ms.wfc.ui.SaveFileDialog)
Prior to the MS settlement with Sun, versions of the MS CommonDialog class
file dialogs were available on all Windows installations with IE, through
the Java file objects, which were exposed through the msjava.dll file, and
which could be called from VBS through the MS Java VM. Beginning in
February 2003, new installations of Win2k (essentially new SP4
installations) and WinXp (essentially new SP1a installations) no longer
implement the MS Java VM. Prior versions of Windows, and all versions of
Win2k and WinXp installed prior to these SP versions, regardless of whether
they have been updated to current versions, can still access these object
dialogs through the MS Java VM. (Credit Alessandro Angeli MVP for the
access method).
The WinXp File Objects (UserAccounts.CommonDialog and SAFRCFileDlg.FileSave)
These objects are available only on WinXp, and are exposed through the
nusrmgr.cpl control panel applet and safrcdlg.dll. They are somewhat more
limited versions of the CommonDialog, but adequate. The Open dialog is
almost complete, except for no retitling, no flag return and an archaic
multi-select function. (Credit Alex Angelopoulos MVP for first posting
their existence.)
The Choose File HTML File Control Object
This is a Tom Lavedas-Walter Zachery workaround. It runs a zero-sized IeApp
window with a file control, uses AppActivate and SendKeys to feed a default
value to the control, then clicks the control to open the HTML Choose File
box to select a single existing file. Only selects existing files, has few
options, requires AppActivate and SendKeys, and has set file filtering for
HTML-type files (though it pops up to *.* All Files). The least
controlable, but operates across all OS's and may be the only solution for
newer Win2k OS's.
BrowseForFolder
Prior to Win2k, the Shell BrowseForFolder object could be used to select
files. That ability became problematic in Win2k and impossible in WinXp.
MS recommends that it not be used for file selection, though it's still
available for older OS's.
Many months ago, I posted a file dialog function that would test for all
four of the file dialog objects in order, to see what was available on a
particular computer, using a single set of options. Fairly complex, though.
Since then, I've improved it and limited to the three true Common-Dialog
pairs of objects, but I've also incorporated all my standard scripts into a
WSC file, with properties and methods and CHM file instructions, and they
are not be thoroughly error-tested since the conversion.
If you find one of the above that works on your system, I'll post back some
sample code and the MSDN references (if any).
Again, however, I have no idea how this translates into ASP availability.
Joe Earnest
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.521 / Virus Database: 319 - Release Date: 09-23-03