Lỗi AutoIT , các bác giúp e vs nó khong chay code

Discussion in 'Computer Skills' started by lutuhu, Sep 10, 2017.

Moderators: thaikhanghn
  1. lutuhu
    Chat with me

    lutuhu Member

    Joined:
    Oct 19, 2013
    Messages:
    2,801
    Likes Received:
    738
    Skype:
    Chat with me via Skype
    Google Plus:
    Follow me on Google Plus
    Lỗi AutoIT , các bác giúp e vs nó khong chay code
    1. chả là e dang thử auto click trên web , nhưng không hiểu sao nó ko hoạt động , nếu mà tìm ảnh trên màn hình máy tính thi vẫn chay ok

    2. còn 1 cái nữa là , em có 2 câu lệnh , Câu a chay ok . e tắt, mở câu lệnh khác là B,chay B xong , e chậy lại con A thi nó ko hoật đọng , vây
    có phải do e chỉnh thiếu gi ko a ( cây lệnh ở dưới lun)



    Local $x=0,$y=0

    $search=_imageSearch(@ScriptDir&'\vang.bmp',1,$x,$y,0)
    If $search=1 Then MouseMove($x,$y)
    MouseClick ("left")

    $search1=_imageSearch(@ScriptDir&'\xanhbien.bmp',1,$x,$y,0)
    If $search1=1 Then MouseMove($x,$y)
    MouseClick ("left")

    $search2=_imageSearch(@ScriptDir&'\xanhla.bmp',1,$x,$y,0)
    If $search2=1 Then MouseMove($x,$y)
    MouseClick ("left")

    $search3=_imageSearch(@ScriptDir&'\xanh.bmp',1,$x,$y,0)
    If $search3=1 Then MouseMove($x,$y)
    MouseClick ("left")


    Mong các bác giúp đỡ !
     
  2. lutuhu
    Chat with me

    lutuhu Member

    Joined:
    Oct 19, 2013
    Messages:
    2,801
    Likes Received:
    738
    Skype:
    Chat with me via Skype
    Google Plus:
    Follow me on Google Plus
  3. emyeusss7
    Chat with me

    emyeusss7 Trial Mod Staff Member Trader Verified Kindness Member

    Joined:
    Dec 26, 2010
    Messages:
    1,847
    Likes Received:
    1,167
    Insuree Balance:
    500
    Service Details:
    1|emyeusss7|Software, Tools
    Phone Number:
    Call me!
    Facebook:
    Follow me on Facebook
    Skype:
    Chat with me via Skype
    đổi thành If $search > 0
    tạo 2 function bỏ 2 cái A và B vào
    tạo 1 hàm while true, bỏ 2 cái function vào trong đó cho nó lập, vậy là đc
     
    lutuhu likes this.
  4. lutuhu
    Chat with me

    lutuhu Member

    Joined:
    Oct 19, 2013
    Messages:
    2,801
    Likes Received:
    738
    Skype:
    Chat with me via Skype
    Google Plus:
    Follow me on Google Plus
    function la gi vay bac , e ms hoc dc 3 hom @@
     
  5. emyeusss7
    Chat with me

    emyeusss7 Trial Mod Staff Member Trader Verified Kindness Member

    Joined:
    Dec 26, 2010
    Messages:
    1,847
    Likes Received:
    1,167
    Insuree Balance:
    500
    Service Details:
    1|emyeusss7|Software, Tools
    Phone Number:
    Call me!
    Facebook:
    Follow me on Facebook
    Skype:
    Chat with me via Skype
    While 1
    _Function_A()
    _Function_B()
    Sleep(10)
    WEnd
    Func _Function_A()
    if......
    EndFunc
    Func _Function_B()
    if......
    EndFunc
     
    lutuhu likes this.
  6. lutuhu
    Chat with me

    lutuhu Member

    Joined:
    Oct 19, 2013
    Messages:
    2,801
    Likes Received:
    738
    Skype:
    Chat with me via Skype
    Google Plus:
    Follow me on Google Plus
    em cảm ơn bác :D
     
  7. tuan6956
    Chat with me

    tuan6956 Member

    Joined:
    Nov 15, 2013
    Messages:
    1,234
    Likes Received:
    601
    function là hàm @@
     
  8. lutuhu
    Chat with me

    lutuhu Member

    Joined:
    Oct 19, 2013
    Messages:
    2,801
    Likes Received:
    738
    Skype:
    Chat with me via Skype
    Google Plus:
    Follow me on Google Plus
    Local $x=0 , $y=0
    $a=_ImageSearch(@ScriptDir&'\test.bmp',1,$x,$y,0)
    $a0=_ImageSearch(@ScriptDir&'\test1.bmp',1,$x,$y,0)
    $a1=_ImageSearch(@ScriptDir&'\test2.bmp',1,$x,$y,0)
    While 1
    _Function_A($a0)
    Sleep(10000)
    _Function_B($a1)
    Sleep(10000)
    _FUnction_C($a)
    Sleep(10)
    WEnd
    Func _Function_A($a0)
    if $a0 = 1 then MouseMove($x,$y)
    Sleep(5000)
    EndFunc
    Func _Function_B($a1)
    if $a1 = 1 Then MouseMove($x,$y)
    EndFunc
    Func _Function_C($a)
    if $a = 1 Then MouseMove($x,$y)
    EndFunc
    bác giúp e với ạ
    tại sao thang search ảnh của e nó chỉ chạy lệnh cuối cùng vậy a
     
  9. rongbay
    Chat with me

    rongbay Member

    Joined:
    May 17, 2011
    Messages:
    1,009
    Likes Received:
    467
    inbox full code mình xem thử cho
     
  10. lutuhu
    Chat with me

    lutuhu Member

    Joined:
    Oct 19, 2013
    Messages:
    2,801
    Likes Received:
    738
    Skype:
    Chat with me via Skype
    Google Plus:
    Follow me on Google Plus
    Local $x=0 , $y=0
    $a=_ImageSearch(@ScriptDir&'\test.bmp',1,$x,$y,0)
    $a0=_ImageSearch(@ScriptDir&'\test1.bmp',1,$x,$y,0)
    $a1=_ImageSearch(@ScriptDir&'\test2.bmp',1,$x,$y,0)
    While 1
    _Function_A($a0)
    Sleep(10000)
    _Function_B($a1)
    Sleep(10000)
    _FUnction_C($a)
    Sleep(10)
    WEnd
    Func _Function_A($a0)
    if $a0 = 1 then MouseMove($x,$y)
    Sleep(5000)
    EndFunc
    Func _Function_B($a1)
    if $a1 = 1 Then MouseMove($x,$y)
    EndFunc
    Func _Function_C($a)
    if $a = 1 Then MouseMove($x,$y)
    EndFunc
    code day bac oi @@
     
  11. rongbay
    Chat with me

    rongbay Member

    Joined:
    May 17, 2011
    Messages:
    1,009
    Likes Received:
    467
    $a=_ImageSearch(@ScriptDir&'\test.bmp',1,$x,$y,0)
    $a0=_ImageSearch(@ScriptDir&'\test1.bmp',1,$x,$y,0)
    $a1=_ImageSearch(@ScriptDir&'\test2.bmp',1,$x,$y,0)
    chỗ ở tren bạn thử khai báo $x0,$y0 cho hình $a0
    và $x1,$y1 cho hình $a1 thử xem sao
    và thay luôn trong 2 func cuối
     
    Last edited: Oct 11, 2017
  12. emyeusss7
    Chat with me

    emyeusss7 Trial Mod Staff Member Trader Verified Kindness Member

    Joined:
    Dec 26, 2010
    Messages:
    1,847
    Likes Received:
    1,167
    Insuree Balance:
    500
    Service Details:
    1|emyeusss7|Software, Tools
    Phone Number:
    Call me!
    Facebook:
    Follow me on Facebook
    Skype:
    Chat with me via Skype

    While 1
    $x=0
    $y=0
    $a=_ImageSearch(@ScriptDir&'\test.bmp',1,$x,$y,0)
    If($x <> 0 Or $y <> 0)Then
    MouseMove($x,$y)
    $x=0
    $y=0
    EndIf
    $a0=_ImageSearch(@ScriptDir&'\test1.bmp',1,$x,$y,0)
    If($x <> 0 Or $y <> 0)Then
    MouseMove($x,$y)
    $x=0
    $y=0
    EndIf
    $a1=_ImageSearch(@ScriptDir&'\test2.bmp',1,$x,$y,0)
    If($x <> 0 Or $y <> 0)Then
    MouseMove($x,$y)
    $x=0
    $y=0
    EndIf
    Sleep(1000)
    WEnd


    Trong lập trình, thì có phân biệt chữ Hoa và chữ Thường
    khi code thì nhớ chú ý thật kỹ từng ký tự
    khi khai báo biến thì nên viết full chữ thường khi code chưa quen
    vì chỉ cần sai 1 ký tự Hoa hay Thường thì cũng dẫn đến việc bị lỗi code mà đi tìm thì loài coan mắt ko có ra @@
     
    lutuhu likes this.
  13. lutuhu
    Chat with me

    lutuhu Member

    Joined:
    Oct 19, 2013
    Messages:
    2,801
    Likes Received:
    738
    Skype:
    Chat with me via Skype
    Google Plus:
    Follow me on Google Plus
    hehehe em cảm ơn bác
     

Share This Page