1976年贪婪的嘴唇,韩国少妇激三级做爰2023电影,久久久久久精品国产三级涨奶,妖精漫画在线观看免费漫画下拉式

vbs,hta中選擇文件夾對話框實現代碼
來源:易賢網 閱讀:1863 次 日期:2016-07-18 15:16:43
溫馨提示:易賢網小編為您整理了“vbs,hta中選擇文件夾對話框實現代碼”,方便廣大網友查閱!

在vbs中選擇文件夾可以直接調用系統的文件夾對話框

代碼如下:

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>

更多信息請查看腳本欄目
由于各方面情況的不斷調整與變化,易賢網提供的所有考試信息和咨詢回復僅供參考,敬請考生以權威部門公布的正式信息和咨詢為準!

2026國考·省考課程試聽報名

  • 報班類型
  • 姓名
  • 手機號
  • 驗證碼
關于我們 | 聯系我們 | 人才招聘 | 網站聲明 | 網站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 新媒體/短視頻平臺 | 手機站點 | 投訴建議
工業和信息化部備案號:滇ICP備2023014141號-1 云南省教育廳備案號:云教ICP備0901021 滇公網安備53010202001879號 人力資源服務許可證:(云)人服證字(2023)第0102001523號
云南網警備案專用圖標
聯系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關注公眾號:hfpxwx
咨詢QQ:1093837350(9:00—18:00)版權所有:易賢網
云南網警報警專用圖標
主站蜘蛛池模板: 台北县| 乳源| 康平县| 桑植县| 行唐县| 东方市| 英吉沙县| 湛江市| 宝清县| 荣成市| 贵南县| 关岭| 天气| 广汉市| 桐庐县| 德庆县| 田东县| 五指山市| 德化县| 东阳市| 安图县| 万荣县| 宣化县| 山东| 壤塘县| 上思县| 新余市| 繁昌县| 合川市| 唐河县| 平度市| 漠河县| 理塘县| 临漳县| 普兰县| 绥宁县| 南安市| 景东| 思茅市| 厦门市| 龙胜|