Locate a File Using a File Open Dialog Box
时间:2021-10-29 08:32:03|栏目:JavaScript代码|点击: 次
Demonstration script that displays a File Open dialog box (open to the folder C:\Scripts), and then echoes back the name of the selected file. Supported Platforms
Windows Server 2003
No
Windows XP
Yes
Windows 2000
No
Windows NT 4.0
No
Windows 98
No
Script Code
Set objDialog = CreateObject("UserAccounts.CommonDialog")
objDialog.Filter = "VBScript Scripts|*.vbs|All Files|*.*"
objDialog.FilterIndex = 1
objDialog.InitialDir = "C:\Scripts"
intResult = objDialog.ShowOpen
If intResult = 0 Then
Wscript.Quit
Else
Wscript.Echo objDialog.FileName
End If
Windows Server 2003
No
Windows XP
Yes
Windows 2000
No
Windows NT 4.0
No
Windows 98
No
Script Code
复制代码 代码如下:
Set objDialog = CreateObject("UserAccounts.CommonDialog")
objDialog.Filter = "VBScript Scripts|*.vbs|All Files|*.*"
objDialog.FilterIndex = 1
objDialog.InitialDir = "C:\Scripts"
intResult = objDialog.ShowOpen
If intResult = 0 Then
Wscript.Quit
Else
Wscript.Echo objDialog.FileName
End If
上一篇:Prototype框架详解
栏 目:JavaScript代码
下一篇:JavaScript中ES6 Babel正确安装过程
本文标题:Locate a File Using a File Open Dialog Box
本文地址:http://www.codeinn.net/misctech/181666.html