ฟอรั่ม 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

    Error if ^ ERROR

    max30012540
    max30012540
    PSsix Member High Class
    PSsix Member High Class


    Error if ^ ERROR Empty PSsix Program Coder
    จำนวนข้อความ : 98
    ความนิยม : 10
    เข้าร่วมเมื่อ : 10/10/2011
    อายุ : 26

    Error if ^ ERROR Empty Error if ^ ERROR

    ตั้งหัวข้อ by max30012540 13/11/11, 12:05 am

    ผมทำโปรแกรมล็อกโฟสเดอร์ พอทำเสร็จแล้วมี Error ครับ แก้ไปแก้มา งง ครับ em228

    Code:
    #include <GUIConstants.au3>

    $Form1 = GUICreate("โปรแกรมล็อกโฟสเดอร์", 336, 122, 566, 201)
    $Button1 = GUICtrlCreateButton("ล็อก-ปลดล๊อกโฟสเดอร์", 160, 72, 121, 41, 0)
    $Radio1 = GUICtrlCreateRadio("ล็อกโฟสเดอร์", 48, 72, 81, 17)
    $Radio2 = GUICtrlCreateRadio("ปลดล็อกโฟสเดอร์", 48, 96, 105, 17)
    $Input1 = GUICtrlCreateInput("", 24, 16, 209, 21)
    $Button2 = GUICtrlCreateButton("เลือกโฟสเดอร์", 240, 16, 73, 25, 0)
    $Label1 = GUICtrlCreateLabel("จัดทำโปรแกรมโดย Max", 88, 48, 117, 17)
    GUISetState(@SW_SHOW)

    While 1
       $Dir = GUICtrlRead($Input1)
       $nMsg = GUIGetMsg()
       Switch $nMsg
          Case $GUI_EVENT_CLOSE
             Exit
          Case $Radio1
             if $Radio1 = True Then
                $Radioo1 = 1
             Else
                $Radioo1 = 0
             EndIf
          Case $Radio2
             if $Radio2 = True Then
                $Radioo2 = 1
             Else
                $Radioo2 = 0
             EndIf
          Case $Button1
             if $Radioo1 = 1 Then
                DirMove($Dir,$Dir&".{20D04FE0-3AEA-1069-A2D8-08002B30309D}")
                MsgBox(0,"","ล็อกโฟสเดอร์เรียบร้อยแล้ว")
             EndIf
             if $Radioo2 = 1 Then
                $Re = StringReplace($Dir,"" ,".{20D04FE0-3AEA-1069-A2D8-08002B30309D}")
                DirMove($Dir,$Re)
                MsgBox(0,"","ปลดล็อกโฟสเดอร์เรียบร้อยแล้ว")
             EndIf
          Case $Button2
             $Dirr = FileSelectFolder("เลือกโฟสเดอร์ที่ต้องการล็อก","/")
             GUICtrlSetData($Input1,$Dirr)
       EndSwitch
    WEnd
    POS
    POS
    PSsix
    PSsix


    Error if ^ ERROR Empty Error if ^ ERROR Empty Error if ^ ERROR Empty
    จำนวนข้อความ : 1152
    ความนิยม : 326
    เข้าร่วมเมื่อ : 19/07/2010

    Error if ^ ERROR Empty Re: Error if ^ ERROR

    ตั้งหัวข้อ by POS 13/11/11, 06:52 am

    หากไม่ศึกษาจากสคริปต์ตัวอย่างจนเข้าใจว่าคำสั่งทำงานอย่างไร ก็อย่าพยายามตัดแปะโค้ด หรือเอามาใช้บางส่วน ให้แก้โค้ดจากสคริปต์ต้นฉบับไปเลยจะได้รู้ว่าแบบไหนเปลี่ยนได้ แบบไหนเปลี่ยนไม่ได้

    ดังนั้นคุณต้องกลับไปศึกษาให้เข้าใจเสียก่อนว่าสคริปต์นี้ทำงานอย่างไร แนวคิดคืออะไร เมื่อเข้าใจแล้วค่อยเริ่มสร้างโปรแกรมขึ้นมาใหม่จากความเข้าใจ


      เวลาขณะนี้ 02/05/24, 02:41 pm