婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 知識庫 > vbs,hta中選擇文件夾對話框實現代碼

vbs,hta中選擇文件夾對話框實現代碼

熱門標簽:海外美發店地圖標注 辦理膠州400電話財稅 前鋒辦理400電話申請 打電話的外呼系統貴不貴 陜西高頻外呼回撥系統哪家好 外呼營銷下單系統 百度地圖標注怎么卸載 新密防封卡外呼系統違法嗎 加盟電銷機器人好的品牌
復制代碼 代碼如下:

on error resume next
SelectFolder
function SelectFolder()
Const MY_COMPUTER = H11
Const WINDOW_HANDLE = 0
Const OPTIONS = 0
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(MY_COMPUTER)
Set objFolderItem = objFolder.Self
strPath = objFolderItem.Path
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.BrowseForFolder(WINDOW_HANDLE, "選擇文加夾:", OPTIONS, strPath)
If objFolder Is Nothing Then
msgbox "您沒有選擇任何有效目錄!"
End If
Set objFolderItem = objFolder.Self
objPath = objFolderItem.Path
msgbox "您選擇的文件夾是:" objPath
end function


但是這個代碼不能在hta里用,原因是權限不夠,不知道其它機子上能不能。
于是寫了個用vbs自帶函數和fso結合的文件夾選擇代碼,僅供參考
復制代碼 代碼如下:

script language=vbscript>
dim spath
spath="Root"

function SFolder()
on error resume next
Dim fso, drv, f, fc, nf, s, i, p, r, d
i=3
if spath="Root" then
Set fso =CreateObject("Scripting.FileSystemObject")
Set drv =fso.Drives
s="輸入序號為進入,序號+#為選中(c為取消)"+chr(13)+chr(10)
s=s+"1.根目錄"+chr(13)+chr(10)
s=s+"2.上層"+chr(13)+chr(10)
For Each a In drv
s=s+cstr(i)+"."+ a.Path+chr(13)+chr(10)
i=i+1
Next
GetD s
else
Set fso =CreateObject("Scripting.FileSystemObject")
if right(spath,1)>"\" then
spath=spath+"\"
end if
Set fc =fso.GetFolder(spath).SubFolders
s="輸入序號為進入,序號+#為選中(c為取消)"+chr(13)+chr(10)
s=s+"1.根目錄"+chr(13)+chr(10)
s=s+"2.上層"+chr(13)+chr(10)
for each nf in fc
s=s+cstr(i)+"."+nf+chr(13)+chr(10)
i=i+1
next
GetF s
end if
end function

function GetD(s)
on error resume next
p=inputbox(s,"","")
if p="c" then
exit function
end if
r=split(s,chr(13)+chr(10))
if right(p,1)="#" then
if left(p,len(p)-1)=1 then
msgbox "這是根目錄,不能選擇根目錄!"
GetD s
elseif left(p,len(p)-1)=2 then
msgbox "這是根目錄,不能選擇根目錄!"
GetD s
else
d=split(r(left(p,len(p)-1)),".")
msgbox "選擇:" d(1)
Document.forms("ValidForm").FPath.Value=d(1)
spath="Root"
end if
else
if p=1 then
msgbox "已經是根目錄!"
GetD s
elseif p=2 then
msgbox "已經是最上層!"
GetD s
else
d=split(r(p),".")
spath=d(1)
'msgbox "進入:" d(1)
SFolder
end if
end if
end function

function GetF(s)
on error resume next
p=inputbox(s,"","")
if p="c" then
exit function
end if
r=split(s,chr(13)+chr(10))
if right(p,1)="#" then
if left(p,len(p)-1)=1 then
msgbox "這是根目錄,不能選擇根目錄!"
GetD s
elseif left(p,len(p)-1)=2 then
GetTheParent =CreateObject("Scripting.FileSystemObject").GetParentFolderName(spath)
msgbox "選擇:" GetTheParent
Document.forms("ValidForm").FPath.Value=GetTheParent
else
d=split(r(left(p,len(p)-1)),".")
msgbox "選擇:" d(1)
Document.forms("ValidForm").FPath.Value=d(1)
spath="Root"
end if
else
if p=1 then
spath="Root"
SFolder
elseif p=2 then
GetTheParent =CreateObject("Scripting.FileSystemObject").GetParentFolderName(spath)
if GetTheParent="" then
spath="Root"
'msgbox "進入:根目錄"
else
spath=GetTheParent
'msgbox "進入:" GetTheParent
end if
SFolder
else
d=split(r(p),".")
spath=d(1)
'msgbox "進入:" d(1)
SFolder
end if
end if
end function
/script>
form id="ValidForm" method="POST" action="--WEBBOT-SELF--">
p>input type="text" name="FPath" size="50" onclick="PastePath">input type="button" value="選擇文件夾" name="SelFolder" onclick="SFolder">/p>
/form>

標簽:阜陽 武威 梅州 牡丹江 伊春 河南 四平 咸陽

巨人網絡通訊聲明:本文標題《vbs,hta中選擇文件夾對話框實現代碼》,本文關鍵詞  vbs,hta,中,選擇,文件夾,對話框,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《vbs,hta中選擇文件夾對話框實現代碼》相關的同類信息!
  • 本頁收集關于vbs,hta中選擇文件夾對話框實現代碼的相關信息資訊供網民參考!
  • 推薦文章
    主站蜘蛛池模板: 庆安县| 黄梅县| 云梦县| 襄城县| 高平市| 旬阳县| 元朗区| 汝城县| 平邑县| 航空| 鄂州市| 乌拉特后旗| 邻水| 海门市| 宜昌市| 广宗县| 鄂托克旗| 资溪县| 丹棱县| 仁寿县| 上林县| 城口县| 南丹县| 都匀市| 宁都县| 临湘市| 英吉沙县| 巴塘县| 漳浦县| 惠来县| 锡林郭勒盟| 微博| 慈溪市| 绵阳市| 日喀则市| 陇南市| 桃园市| 古浪县| 武鸣县| 嘉兴市| 乌审旗|