ก็คือตอนนี้ผมเพิ่มรูปไม่เป็นเลยเอาคำว่า Folder ไปวางไว้ข้างหน้าก่อน แก้ขัด*-*
ถ้าท่านผู้รู้รู้วิธีเอารูปfolderไปวางไว้ข้างหน้าบอกด้วยนะครับ
Codeๆๆๆ
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <File.au3>
Opt('MustDeclareVars', 1)
Global $data,$ret,$file,$Folders,$btchk,$retx,$Foldersx,$fileold[200],$dataview,$uvx=0,$hListBox,$aItems,$iI,$ctopen=0,$ctopenstr="",$dirwrite="<---Folder---> ",$dirwritelen=StringLen($dirwrite),$filelen,$Label_1,$Combo_2,$Buttonback
Global $backword=">--กลับไปก่อนหน้า--<"
_Main()
Func _Main()
Local $Label_1, $Combo_2, $button1, $msg,$Button2
#Region ### START Koda GUI section ### Form=
$ret =""
if $CmdLine[0]=0 Then
MsgBox(4,"คำเตือน","ไม่พบการส่งค่าต้องการเลือกโฟลเดอร์เองหรือไม่")
if $btchk<>7 Then
FileSelectFolder("กรุณาเลือกfolderที่จะทำการดู","","","")
Else
Exit
EndIf
Else
$file=$CmdLine[1]
EndIf
$Folders =_FileListToArray($file,"*.")
for $i =1 to $Folders[0]
$ret &=$Folders[$i] &"|"
Next
GUICreate("Explorer[Safe Mode]::Flash Drive Safe Check", 403, 470, -1, -1)
$Label_1 = GUICtrlCreateLabel("Please select folder", -2, 0, 403, 21, $SS_SUNKEN)
$Combo_2 = GUICtrlCreateCombo("", 0, 20, 402, 25)
GUICtrlSetData($Combo_2, $ret)
$hListBox = GUICtrlCreateList("", 0, 42, 404, 396, BitOR($LBS_SORT,$LBS_STANDARD,$LBS_EXTENDEDSEL,$WS_VSCROLL,$WS_BORDER))
$Button2 = GUICtrlCreateButton("เปิดไฟล์", 72, 442, 122, 20, $WS_GROUP)
$Buttonback = GUICtrlCreateButton("Back", 200, 442, 122, 20, $WS_GROUP)
_readfileall()
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
Exit
Case $msg = $Combo_2
$data = GUICtrlRead($Combo_2)
$dataview=$data
if $data = $backword And $uvx>0 then
$file = ""
$uvx=$uvx-1
$data =$fileold[$uvx]
$dataview=$fileold
endif
_readfileindir()
GUICtrlSetData($Combo_2, "")
GUICtrlSetData($Combo_2, $retx)
GUICtrlSetData($Label_1, $dataview)
Case $msg=$hListBox
$aItems = _GUICtrlListBox_GetSelItemsText($hListBox)
Local $stockaItems=""
if $aItems[0]<>0 Then
$filelen=StringLen($aItems[1])
If StringMid($aItems[1],1,1)=StringMid($dirwrite,1,1) And StringMid($aItems[1],1,2)=StringMid($dirwrite,1,2) And StringMid($aItems[1],1,3)=StringMid($dirwrite,1,3) Then
for $i=$dirwritelen+1 to $filelen
$stockaItems&=StringMid($aItems[1],$i,1)
Next
$data=$stockaItems
EndIf
if $ctopenstr<>$aItems[1] Then
$ctopen=0
Endif
$dataview=$data
if $aItems[1] = $backword And $uvx>0 then
$file = ""
$uvx=$uvx-1
$data =$fileold[$uvx]
$dataview=$fileold
_readfileindir()
GUICtrlSetData($Label_1, $dataview)
GUICtrlSetData($Combo_2, "")
GUICtrlSetData($Combo_2, $retx)
endif
if $aItems[0]=1 And $ctopenstr=$aItems[1] And $ctopen=1 And StringMid($aItems[1],1,1)=StringMid($dirwrite,1,1) And StringMid($aItems[1],1,2)=StringMid($dirwrite,1,2) And StringMid($aItems[1],1,3)=StringMid($dirwrite,1,3)Then
_readfileindir()
GUICtrlSetData($Label_1, $dataview)
GUICtrlSetData($Combo_2, "")
GUICtrlSetData($Combo_2, $retx)
ElseIf $aItems[0]=1 And $ctopenstr=$aItems[1] And $ctopen=1 And $aItems[1]=$backword Then
$ctopenstr=""
elseif $aItems[0]=1 And $ctopenstr=$aItems[1] And $ctopen=1 Then
ShellExecute($file&"\"&$aItems[1])
$ctopenstr=""
EndIf
if $aItems[0]=1 And $ctopenstr<>$aItems[1] And $ctopen=0 Then
$ctopenstr=$aItems[1]
$ctopen=1
EndIf
EndIf
Case $msg=$Buttonback
If $uvx>0 Then
$file = ""
$uvx=$uvx-1
$data =$fileold[$uvx]
$dataview=$fileold
_readfileindir()
GUICtrlSetData($Combo_2, "")
GUICtrlSetData($Combo_2, $retx)
GUICtrlSetData($Label_1, $dataview)
Else
MsgBox(64,"คำเตือน","ไม่สามารถกลับไปไกลได้มากกว่านี้อีกแล้ว")
EndIf
Case $msg=$Button2
if $aItems[0]=0 Then
MsgBox(64,"คำเตือน","คุณยังไม่ได้เลือกอะไรเลย")
ElseIf (StringMid($aItems[1],1,1)=StringMid($dirwrite,1,1) And StringMid($aItems[1],1,2)=StringMid($dirwrite,1,2) And StringMid($aItems[1],1,3)=StringMid($dirwrite,1,3)) Then
MsgBox(64,"คำเตือน","เพื่อความปลอดภัยจึงไม่สามารถเปิดfolderได้")
Else
For $iI = 1 To $aItems[0]
ShellExecute($file&"\"&$aItems[$iI])
Next
EndIf
EndSelect
WEnd
EndFunc
Func _readfile()
_GUICtrlListbox_BeginUpdate($hListBox)
_GUICtrlListBox_ResetContent($hListBox)
_GUICtrlListBox_InitStorage($hListBox, 100, 4096)
_GUICtrlListBox_Dir($hListBox, $file&"\*.*")
_GUICtrlListBox_EndUpdate($hListBox)
_GUICtrlListBox_Sort($hListBox)
EndFunc
Func _readfileall()
$ret =""
$Folders =_FileListToArray($file,"*.*")
$Foldersx =_FileListToArray($file,"*.")
if $Foldersx="" Or $Folders="" Then
Else
For $i=1 To $Foldersx[0]
$Foldersx[$i]=$dirwrite&$Foldersx[$i]
Next
EndIf
_GUICtrlListBox_BeginUpdate($hListBox)
_GUICtrlListBox_ResetContent($hListBox)
_GUICtrlListBox_InitStorage($hListBox, 100, 4096)
if $Foldersx="" Then
_GUICtrlListBox_Dir($hListBox, $file&"\*.*")
Else
for $i =1 to $Foldersx[0]
_GUICtrlListBox_InsertString($hListBox,$Foldersx[$i])
Next
_GUICtrlListBox_Dir($hListBox, $file&"\*.*")
EndIf
if $uvx>0 Then
_GUICtrlListBox_InsertString($hListBox,$backword)
EndIf
_GUICtrlListBox_EndUpdate($hListBox)
_GUICtrlListBox_Sort($hListBox)
EndFunc
Func _readfileindir()
$retx=""
if $file ="" Then
$file =$data
$fileold[$uvx]=$data
else
$fileold[$uvx]=$file
$uvx=$uvx+1
$file &="/"&$data
EndIf
$dataview=$file
GUICtrlSetData($Label_1, $dataview)
$Foldersx=""
$Foldersx =_FileListToArray($file,"*.")
if $Foldersx="" Then
else
for $i =1 to $Foldersx[0]
$retx &=$Foldersx[$i] &"|"
Next
endif
$retx&=$backword
$retx &="|"
GUICtrlSetData($Combo_2, "")
GUICtrlSetData($Combo_2, $retx)
_readfileall()
EndFunc
ถ้าท่านผู้รู้รู้วิธีเอารูปfolderไปวางไว้ข้างหน้าบอกด้วยนะครับ
Codeๆๆๆ
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <File.au3>
Opt('MustDeclareVars', 1)
Global $data,$ret,$file,$Folders,$btchk,$retx,$Foldersx,$fileold[200],$dataview,$uvx=0,$hListBox,$aItems,$iI,$ctopen=0,$ctopenstr="",$dirwrite="<---Folder---> ",$dirwritelen=StringLen($dirwrite),$filelen,$Label_1,$Combo_2,$Buttonback
Global $backword=">--กลับไปก่อนหน้า--<"
_Main()
Func _Main()
Local $Label_1, $Combo_2, $button1, $msg,$Button2
#Region ### START Koda GUI section ### Form=
$ret =""
if $CmdLine[0]=0 Then
MsgBox(4,"คำเตือน","ไม่พบการส่งค่าต้องการเลือกโฟลเดอร์เองหรือไม่")
if $btchk<>7 Then
FileSelectFolder("กรุณาเลือกfolderที่จะทำการดู","","","")
Else
Exit
EndIf
Else
$file=$CmdLine[1]
EndIf
$Folders =_FileListToArray($file,"*.")
for $i =1 to $Folders[0]
$ret &=$Folders[$i] &"|"
Next
GUICreate("Explorer[Safe Mode]::Flash Drive Safe Check", 403, 470, -1, -1)
$Label_1 = GUICtrlCreateLabel("Please select folder", -2, 0, 403, 21, $SS_SUNKEN)
$Combo_2 = GUICtrlCreateCombo("", 0, 20, 402, 25)
GUICtrlSetData($Combo_2, $ret)
$hListBox = GUICtrlCreateList("", 0, 42, 404, 396, BitOR($LBS_SORT,$LBS_STANDARD,$LBS_EXTENDEDSEL,$WS_VSCROLL,$WS_BORDER))
$Button2 = GUICtrlCreateButton("เปิดไฟล์", 72, 442, 122, 20, $WS_GROUP)
$Buttonback = GUICtrlCreateButton("Back", 200, 442, 122, 20, $WS_GROUP)
_readfileall()
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
Exit
Case $msg = $Combo_2
$data = GUICtrlRead($Combo_2)
$dataview=$data
if $data = $backword And $uvx>0 then
$file = ""
$uvx=$uvx-1
$data =$fileold[$uvx]
$dataview=$fileold
endif
_readfileindir()
GUICtrlSetData($Combo_2, "")
GUICtrlSetData($Combo_2, $retx)
GUICtrlSetData($Label_1, $dataview)
Case $msg=$hListBox
$aItems = _GUICtrlListBox_GetSelItemsText($hListBox)
Local $stockaItems=""
if $aItems[0]<>0 Then
$filelen=StringLen($aItems[1])
If StringMid($aItems[1],1,1)=StringMid($dirwrite,1,1) And StringMid($aItems[1],1,2)=StringMid($dirwrite,1,2) And StringMid($aItems[1],1,3)=StringMid($dirwrite,1,3) Then
for $i=$dirwritelen+1 to $filelen
$stockaItems&=StringMid($aItems[1],$i,1)
Next
$data=$stockaItems
EndIf
if $ctopenstr<>$aItems[1] Then
$ctopen=0
Endif
$dataview=$data
if $aItems[1] = $backword And $uvx>0 then
$file = ""
$uvx=$uvx-1
$data =$fileold[$uvx]
$dataview=$fileold
_readfileindir()
GUICtrlSetData($Label_1, $dataview)
GUICtrlSetData($Combo_2, "")
GUICtrlSetData($Combo_2, $retx)
endif
if $aItems[0]=1 And $ctopenstr=$aItems[1] And $ctopen=1 And StringMid($aItems[1],1,1)=StringMid($dirwrite,1,1) And StringMid($aItems[1],1,2)=StringMid($dirwrite,1,2) And StringMid($aItems[1],1,3)=StringMid($dirwrite,1,3)Then
_readfileindir()
GUICtrlSetData($Label_1, $dataview)
GUICtrlSetData($Combo_2, "")
GUICtrlSetData($Combo_2, $retx)
ElseIf $aItems[0]=1 And $ctopenstr=$aItems[1] And $ctopen=1 And $aItems[1]=$backword Then
$ctopenstr=""
elseif $aItems[0]=1 And $ctopenstr=$aItems[1] And $ctopen=1 Then
ShellExecute($file&"\"&$aItems[1])
$ctopenstr=""
EndIf
if $aItems[0]=1 And $ctopenstr<>$aItems[1] And $ctopen=0 Then
$ctopenstr=$aItems[1]
$ctopen=1
EndIf
EndIf
Case $msg=$Buttonback
If $uvx>0 Then
$file = ""
$uvx=$uvx-1
$data =$fileold[$uvx]
$dataview=$fileold
_readfileindir()
GUICtrlSetData($Combo_2, "")
GUICtrlSetData($Combo_2, $retx)
GUICtrlSetData($Label_1, $dataview)
Else
MsgBox(64,"คำเตือน","ไม่สามารถกลับไปไกลได้มากกว่านี้อีกแล้ว")
EndIf
Case $msg=$Button2
if $aItems[0]=0 Then
MsgBox(64,"คำเตือน","คุณยังไม่ได้เลือกอะไรเลย")
ElseIf (StringMid($aItems[1],1,1)=StringMid($dirwrite,1,1) And StringMid($aItems[1],1,2)=StringMid($dirwrite,1,2) And StringMid($aItems[1],1,3)=StringMid($dirwrite,1,3)) Then
MsgBox(64,"คำเตือน","เพื่อความปลอดภัยจึงไม่สามารถเปิดfolderได้")
Else
For $iI = 1 To $aItems[0]
ShellExecute($file&"\"&$aItems[$iI])
Next
EndIf
EndSelect
WEnd
EndFunc
Func _readfile()
_GUICtrlListbox_BeginUpdate($hListBox)
_GUICtrlListBox_ResetContent($hListBox)
_GUICtrlListBox_InitStorage($hListBox, 100, 4096)
_GUICtrlListBox_Dir($hListBox, $file&"\*.*")
_GUICtrlListBox_EndUpdate($hListBox)
_GUICtrlListBox_Sort($hListBox)
EndFunc
Func _readfileall()
$ret =""
$Folders =_FileListToArray($file,"*.*")
$Foldersx =_FileListToArray($file,"*.")
if $Foldersx="" Or $Folders="" Then
Else
For $i=1 To $Foldersx[0]
$Foldersx[$i]=$dirwrite&$Foldersx[$i]
Next
EndIf
_GUICtrlListBox_BeginUpdate($hListBox)
_GUICtrlListBox_ResetContent($hListBox)
_GUICtrlListBox_InitStorage($hListBox, 100, 4096)
if $Foldersx="" Then
_GUICtrlListBox_Dir($hListBox, $file&"\*.*")
Else
for $i =1 to $Foldersx[0]
_GUICtrlListBox_InsertString($hListBox,$Foldersx[$i])
Next
_GUICtrlListBox_Dir($hListBox, $file&"\*.*")
EndIf
if $uvx>0 Then
_GUICtrlListBox_InsertString($hListBox,$backword)
EndIf
_GUICtrlListBox_EndUpdate($hListBox)
_GUICtrlListBox_Sort($hListBox)
EndFunc
Func _readfileindir()
$retx=""
if $file ="" Then
$file =$data
$fileold[$uvx]=$data
else
$fileold[$uvx]=$file
$uvx=$uvx+1
$file &="/"&$data
EndIf
$dataview=$file
GUICtrlSetData($Label_1, $dataview)
$Foldersx=""
$Foldersx =_FileListToArray($file,"*.")
if $Foldersx="" Then
else
for $i =1 to $Foldersx[0]
$retx &=$Foldersx[$i] &"|"
Next
endif
$retx&=$backword
$retx &="|"
GUICtrlSetData($Combo_2, "")
GUICtrlSetData($Combo_2, $retx)
_readfileall()
EndFunc