ฟอรั่ม PSsix

Would you like to react to this message? Create an account in a few clicks or log in to continue.

ฟอรั่มของบล็อก http://pssix.blogspot.com


2 posters

    ขอบคุณที่ช่วยเหลือครับ เสร็จไปอีกหนึ่งส่วน(ยังเหลืออีกเยอะ^^)

    avatar
    pureexe
    PSsix Member High Class
    PSsix Member High Class


    ขอบคุณที่ช่วยเหลือครับ เสร็จไปอีกหนึ่งส่วน(ยังเหลืออีกเยอะ^^) Empty
    จำนวนข้อความ : 73
    ความนิยม : 8
    เข้าร่วมเมื่อ : 27/04/2011

    ขอบคุณที่ช่วยเหลือครับ เสร็จไปอีกหนึ่งส่วน(ยังเหลืออีกเยอะ^^) Empty ขอบคุณที่ช่วยเหลือครับ เสร็จไปอีกหนึ่งส่วน(ยังเหลืออีกเยอะ^^)

    ตั้งหัวข้อ by pureexe 22/11/11, 05:20 pm

    Icon น้อยไปหน่อยนะครับ พอให้ผู้ใช้แยก folder กับไฟล์ได้พอ หรือใครจะใจดีเพิ่มcodeส่วน icon ให้ก็ดีนะครับ
    นี่ครับที่ทำเสร็จ^^
    Code:

    #include <ButtonConstants.au3>
    #include <ComboConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <GUIListBox.au3>
    #include <StaticConstants.au3>
    #include <GuiImageList.au3>
    #include <WindowsConstants.au3>
    #include <GuiConstantsEx.au3>
    #include <GuiListView.au3>
    #include <GuiImageList.au3>
    #include <File.au3>

    Opt('MustDeclareVars', 1)
    Global $data,$ret,$file,$Folders,$retx,$Foldersx,$btchkx,$fileold[200],$dataview,$uvx=1,$hListBox,$aItems,$hImage,$iI,$ctopen=0,$ctopenstr="",$dirwrite="<---Folder--->  ",$dirwritelen=StringLen($dirwrite),$filelen,$Label_1,$Combo_2,$Buttonback
    Global $backword=">--กลับไปก่อนหน้า--<"
    _Main()

    Func _Main()
       Local  $button1, $msg,$Button2,$s1,$s2
    #Region ### START Koda GUI section ### Form=
    $ret  =""
    if $CmdLine[0]=0 Then
    $btchkx=MsgBox(4,"คำเตือน","ไม่พบการส่งค่าต้องการเลือกโฟลเดอร์เองหรือไม่")
    if $btchkx<>7 Then
    $file=FileSelectFolder("กรุณาเลือกfolderที่จะทำการดู","","","")
    Else
    Exit
    EndIf
    Else
    $file=$CmdLine[1]
    EndIf
    $fileold[$uvx]=$file
    $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 = GUICtrlCreateListView("", 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", 140, 442, 122, 20, $WS_GROUP)
    #cs
    ส่วนicon
    index
    0=folder
    1=otherfile
    2=.exe
    3=.dll
    4.=all document
    #ce
    $hImage = _GUIImageList_Create(16, 16, 5, 3)
    _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 4)
    _GUICtrlListView_SetImageList($hListBox, $hImage, 1)
    _GUICtrlListView_AddColumn($hListBox, "รายชื่อไฟล์", 350)
    _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 0)
    _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 2)
    _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 72)
    _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 70)
    _readfileandfolderviewlist($file)

    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    While 1
          $msg = GUIGetMsg()
          Select

             Case $msg = $GUI_EVENT_CLOSE
                Exit
             Case $msg = $Combo_2

                $aItems = GUICtrlRead($Combo_2)
                   $uvx=$uvx+1
                      $fileold[$uvx]=$file&"\"&$aItems
                   _readfileandfolderviewlist($file&"\"&$aItems)
                   _readfileindir()
                   Case  $msg=$hListBox

                Case $msg=$Buttonback
                      $uvx=$uvx-1
                      _readfileandfolderviewlist($fileold[$uvx])
          EndSelect
       $s1 = _GUICtrlListView_GetSelectedIndices($hListBox)
       If $s1 <> "" And $s1 <> $s2 Then

                   $aItems =  _GUICtrlListView_GetItemText(GUICtrlGetHandle($hListBox), _GUICtrlListView_GetSelectedIndices($hListBox))

                   if stringInStr(FileGetAttrib($file&"\"&$aItems), "D") And ($file <> "." Or $file <> "..")  Then
                      $uvx=$uvx+1
                      $fileold[$uvx]=$file&"\"&$aItems
                   _readfileandfolderviewlist($file&"\"&$aItems)
                   Else
                      ShellExecute($file&"\"&$aItems)
                   EndIf

             $s2 = $s1
          EndIf
          WEnd
    EndFunc


       Func _readfileindir()
          $ret=""
       $Folders =_FileListToArray($file,"*.")
       if $Folders<>"" Then
       for $i =1 to $Folders[0]
          $ret &=$Folders[$i] &"|"
          Next
          $dataview=$file
          EndIf
          GUICtrlSetData($Label_1, $dataview)
          GUICtrlSetData($Combo_2, "")
          GUICtrlSetData($Combo_2, $ret)

          EndFunc
      ;==>SrFolder
    Func _readfileandfolderviewlist($listF)


       $file=$listF

    Local $search = FileFindFirstFile($listF & "\*.*"),$filea,$extchk
    _readfileindir()
    _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($hListBox))
    GUICtrlSetData($Label_1,$file)
    While 1
          $filea = FileFindNextFile($search)
    ;~       MsgBox(64,"",_FileGetExt($filea))
          If @error Or StringLen($filea) < 1 Then ExitLoop
          If StringInStr(FileGetAttrib($listF & "\" & $filea), "D") And ($filea <> "." Or $filea <> "..") Then

                   _GUICtrlListView_AddItem($hListBox, $filea, 0)
                ElseIf StringInStr(FileGetAttrib($listF & "\" & $filea), "A") And ($filea <> "." Or $filea <> "..") Then
                   If  _FileGetExt($filea)=".exe" Then
                         _GUICtrlListView_AddItem($hListBox, $filea, 2)
                         Elseif _FileGetExt($filea)=".dll" Then
                         _GUICtrlListView_AddItem($hListBox, $filea, 3)
                         Elseif _FileGetExt($filea)=".doc" Or _FileGetExt($filea)=".xls" Or _FileGetExt($filea)=".ppt" Or _FileGetExt($filea)=".pptx" Or _FileGetExt($filea)=".xlsx" or _FileGetExt($filea)=".pptm" Then
                         _GUICtrlListView_AddItem($hListBox, $filea, 4)
                         Else
                         _GUICtrlListView_AddItem($hListBox, $filea, 1)
                         EndIf
    EndIf
       WEnd
    EndFunc;====>

    Func _FileGetExt($sPath)
        Local $NULL, $sExt
        _PathSplit($sPath, $NULL, $NULL, $NULL, $sExt)
        Return $sExt
    EndFunc
    aut
    aut
    PSsix Powerful Scripting Class
    PSsix Powerful Scripting Class


    PSsix Game Coder
    จำนวนข้อความ : 472
    ความนิยม : 126
    เข้าร่วมเมื่อ : 24/07/2010

    ขอบคุณที่ช่วยเหลือครับ เสร็จไปอีกหนึ่งส่วน(ยังเหลืออีกเยอะ^^) Empty Re: ขอบคุณที่ช่วยเหลือครับ เสร็จไปอีกหนึ่งส่วน(ยังเหลืออีกเยอะ^^)

    ตั้งหัวข้อ by aut 22/11/11, 08:13 pm

    ขอบคุณที่ช่วยเหลือครับ เสร็จไปอีกหนึ่งส่วน(ยังเหลืออีกเยอะ^^) 2397317216_1bfc20dd37_z

      เวลาขณะนี้ 29/03/24, 09:14 am