ฟอรั่ม 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
    tambad123
    มือใหม่เพิ่งสมัคร
    มือใหม่เพิ่งสมัคร


    แนะนำหน่อยครับ Empty แนะนำหน่อยครับ Empty
    จำนวนข้อความ : 6
    ความนิยม : 0
    เข้าร่วมเมื่อ : 31/01/2013

    แนะนำหน่อยครับ Empty แนะนำหน่อยครับ

    ตั้งหัวข้อ by tambad123 02/03/13, 11:19 pm

    ช่วยแนะนำหน่อยนะครับ ปัญหาของผมคือ มันไม่ยอมออกจาก Func Chips() ครับ บางทีก็ออกบางทีก็ไม่ออกช่วยแนะนำการเขียนที่ถูกต้องด้วยนะครับ




    HotKeySet("{ESC}","_Exit")

    While -1
    Sleep(50)
    $coord = PixelSearch(0,0,@DesktopWidth,@DesktopHeight,0xFF00FF)
    If Not @error Then
    $coord = PixelSearch(0,0,@DesktopWidth,@DesktopHeight,0x0080FF)
    If Not @error Then
    $coord = PixelSearch(0,0,@DesktopWidth,@DesktopHeight,0xFFFF00)
    If Not @error Then
    $coord = PixelSearch(0,0,@DesktopWidth,@DesktopHeight,0x00FF00)
    If Not @error Then
    $coord = PixelSearch(0,0,@DesktopWidth,@DesktopHeight,0x004040)
    If Not @error Then
    MouseClick("left",$coord[0]+27,$coord[1]+28,1,0)
    Sleep(2000)
    $coord1 = PixelSearch(0,0,@DesktopWidth,@DesktopHeight,0x008000)
    If Not @error Then
    Chips()
    Sleep(1000)
    MouseClickDrag("left",$coord1[0], $coord1[1], $coord1[0]+335, $coord1[1])
    Sleep(1000)
    Chips()
    Sleep(1000)
    MouseClick("right",$coord1[0]+27,$coord1[1]+28,1,0)
    EndIf



    EndIf

    EndIf
    EndIf
    EndIf
    EndIf
    WEnd

    Func Chips()
    While -1
    Sleep(100)
    $coord = PixelSearch(0,0,@DesktopWidth,@DesktopHeight,0xFFFF00)
    If @error Then
    Return
    EndIf
    $coord = PixelSearch(0,0,@DesktopWidth,@DesktopHeight,0x8080FF)
    If Not @error Then
    $coord = PixelSearch(0,0,@DesktopWidth,@DesktopHeight,0xFF0000)
    If Not @error Then
    $coord = PixelSearch(0,0,@DesktopWidth,@DesktopHeight,0x008000)
    If @error Then
    Return

    EndIf
    Sleep(500)
    MouseClick("left",$coord[0]+20,$coord[1]+28,1,0)
    EndIf

    EndIf



    WEnd
    EndFunc
    Func _Exit()
    Exit
    EndFunc
    POS
    POS
    PSsix
    PSsix


    แนะนำหน่อยครับ Empty แนะนำหน่อยครับ Empty แนะนำหน่อยครับ Empty
    จำนวนข้อความ : 1152
    ความนิยม : 326
    เข้าร่วมเมื่อ : 19/07/2010

    แนะนำหน่อยครับ Empty Re: แนะนำหน่อยครับ

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

    1. อย่าใช้ตัวแปรซ้ำซ้อนกันทั้งนอกและในฟังก์ชัน ในตัวอย่างนี้คือตัวแปร $coord
    2. คำสั่ง Return อย่าใช้ ถ้าใช้ในฟังก์ชัน เมื่อทำคำสั่งนี้ทำงานจะทำให้วิ่งออกจากฟังก์ชันทันที ให้คำสั่งลักษณะ

    If XXXX Then

    Else

    EndIf


    avatar
    tambad123
    มือใหม่เพิ่งสมัคร
    มือใหม่เพิ่งสมัคร


    แนะนำหน่อยครับ Empty แนะนำหน่อยครับ Empty
    จำนวนข้อความ : 6
    ความนิยม : 0
    เข้าร่วมเมื่อ : 31/01/2013

    แนะนำหน่อยครับ Empty Re: แนะนำหน่อยครับ

    ตั้งหัวข้อ by tambad123 03/03/13, 06:36 pm

    ขอบคุณครับ

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