Sign in to follow this  
Followers 0
pezo89

Helprequest

5 posts in this topic

Hey guys, anyone able to help me? the script stops doing anything, and i cant really understand why really =/

it stops before / After / on this line

PixelSearch ( GUICtrlRead($xpos2), GUICtrlRead($ypos2),GUICtrlRead($xpos2)+50, GUICtrlRead($ypos2)+50, 0xF8A845)

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.0.0
 Author:         Andreas N W

 Script Function: Sletting av brev på nettby, innboks og utboks
    Template AutoIt script.

#ce ----------------------------------------------------------------------------
Global $Paused
$counter=0
HotKeySet("{Pause}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
#include <GUIConstants.au3>
#include <EditConstants.au3>
Dim $xpos1=0,$xpos2=0,$ypos1=0,$ypos2=0
$Form1 = GUICreate("Form1", 217, 276, 193, 115)
$Group1 = GUICtrlCreateGroup("Button 1", 0, 8, 209, 105)
$Label1 = GUICtrlCreateLabel("X Co-ordinate", 16, 56, 68, 17)
$Label2 = GUICtrlCreateLabel("Y Co-ordinate", 16, 80, 68, 17)
$xpos1=GUICtrlCreateInput("", 120, 56, 50, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
$ypos1=GUICtrlCreateInput("", 120, 80, 50, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
$Label3 = GUICtrlCreateLabel("Enter Co-ordinates for mouse click", 8, 32, 165, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Button 2", 2, 121, 209, 105)
$Label4 = GUICtrlCreateLabel("X Co-ordinate", 18, 169, 68, 17)
$Label5 = GUICtrlCreateLabel("Y Co-ordinate", 18, 193, 68, 17)
$xpos2=GUICtrlCreateInput("", 122, 169, 50, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
$ypos2=GUICtrlCreateInput("", 122, 193, 50, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
$Label6 = GUICtrlCreateLabel("Enter Co-ordinates for mouse click", 10, 145, 165, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("OK", 40, 232, 113, 33, 0)
GUISetState(@SW_SHOW)

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
    check()

EndSwitch
WEnd


Func check()
    if GUICtrlRead($xpos1)="" Or GUICtrlRead($ypos1)="" or GUICtrlRead($xpos1)>@DesktopWidth or GUICtrlRead($xpos2)>@DesktopWidth or GUICtrlRead($ypos1)>@DesktopHeight Or GUICtrlRead($ypos2)>@DesktopHeight Then
        MsgBox(4096,"ERROR", "Blank inputs are not allowed Or The coordinates exceed maximum value.")
        Return
    Else
        ;MsgBox(4096, "Success", "Co-ordinates entered are: " & @crlf & "Button1" & @crlf & "X Co-ordinate:" & GUICtrlRead($xpos1) & @crlf & " Y Co-ordinate:" & GUICtrlRead($ypos1) & @CRLF & "Button-2" & @CRLF & "X-Co-ordinate:" & GUICtrlRead($xpos2) & @CRLF & "Y Co-ordinate:" & GUICtrlRead($ypos2))
        click()
    EndIf
EndFunc

 Func click()
     toolTip('Scriptet kjører, trykk ESC for å avslutte""',0, 40)
        sleep (3000)
    mouseclick ("left", 45, 1, 1, 1)
    sleep (1400)
    Send("^0")
    Send("^{NUMPADSUB}")
sleep (200)
Send("^{NUMPADSUB}")
sleep (200)

Send("^{NUMPADSUB}")
sleep (200)
Send("^{NUMPADSUB}")
sleep (200)
Send("^{NUMPADSUB}")
sleep (200)
Send("^{NUMPADSUB}")
sleep (200)

while 1




    sleep (2000)
        MouseMove (GUICtrlRead($xpos2), GUICtrlRead($ypos2) )
        sleep (1500)
        PixelSearch ( GUICtrlRead($xpos2), GUICtrlRead($ypos2),GUICtrlRead($xpos2)+50, GUICtrlRead($ypos2)+50, 0xF8A845)   
         sleep ("500")
WEnd
if @error then
Exit
ProcessClose ("Firefox.exe")

EndIf

If Not @error Then


sleep (3000)

   mouseclick ("Left",GUICtrlRead($xpos1), GUICtrlRead($ypos1), 1, 15 ) ;<- button 1
   sleep (1000)
   mouseclick ("Left",GUICtrlRead($xpos1)+40, GUICtrlRead($ypos1), 1, 15) ;<- button 1
        sleep (500)


    send ("{Tab 91}")
        sleep (1000)
        send ("{Enter}")
        sleep (1000)
         send ("{Enter}")
         sleep (1000)


EndIf
EndFunc

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)

    WEnd
    ToolTip("")
EndFunc


Func Terminate()

    Exit 0
EndFunc

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Global $Paused
$counter=0
HotKeySet("{Pause}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
#include <GUIConstants.au3>
#include <EditConstants.au3>
Dim $xpos1=0,$xpos2=0,$ypos1=0,$ypos2=0
$Form1 = GUICreate("Form1", 217, 276, 193, 115)
$Group1 = GUICtrlCreateGroup("Button 1", 0, 8, 209, 105)
$Label1 = GUICtrlCreateLabel("X Co-ordinate", 16, 56, 68, 17)
$Label2 = GUICtrlCreateLabel("Y Co-ordinate", 16, 80, 68, 17)
$xpos1=GUICtrlCreateInput("", 120, 56, 50, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
$ypos1=GUICtrlCreateInput("", 120, 80, 50, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
$Label3 = GUICtrlCreateLabel("Enter Co-ordinates for mouse click", 8, 32, 165, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Button 2", 2, 121, 209, 105)
$Label4 = GUICtrlCreateLabel("X Co-ordinate", 18, 169, 68, 17)
$Label5 = GUICtrlCreateLabel("Y Co-ordinate", 18, 193, 68, 17)
$xpos2=GUICtrlCreateInput("", 122, 169, 50, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
$ypos2=GUICtrlCreateInput("", 122, 193, 50, 21, BitOR($ES_AUTOHSCROLL,$ES_NUMBER))
$Label6 = GUICtrlCreateLabel("Enter Co-ordinates for mouse click", 10, 145, 165, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("OK", 40, 232, 113, 33, 0)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            check()
    EndSwitch
WEnd


Func check()
    if GUICtrlRead($xpos1)="" Or GUICtrlRead($ypos1)="" or GUICtrlRead($xpos1)>@DesktopWidth or GUICtrlRead($xpos2)>@DesktopWidth or GUICtrlRead($ypos1)>@DesktopHeight Or GUICtrlRead($ypos2)>@DesktopHeight Then
        MsgBox(4096,"ERROR", "Blank inputs are not allowed Or The coordinates exceed maximum value.")
        Return
    Else
        click()
    EndIf
EndFunc

Func click()
    toolTip('Scriptet kjører, trykk ESC for å avslutte""',0, 40)
    sleep (3000)
    mouseclick ("left", 45, 1, 1, 1)
    sleep (1400)
    Send("^0")
    Send("^{NUMPADSUB}")
    sleep (200)
    Send("^{NUMPADSUB}")
    sleep (200)
    Send("^{NUMPADSUB}")
    sleep (200)
    Send("^{NUMPADSUB}")
    sleep (200)
    Send("^{NUMPADSUB}")
    sleep (200)
    Send("^{NUMPADSUB}")
    sleep (200)
    while 1
        sleep (2000)
        MouseMove (GUICtrlRead($xpos2), GUICtrlRead($ypos2) )
        sleep (1500)
        PixelSearch ( GUICtrlRead($xpos2), GUICtrlRead($ypos2),GUICtrlRead($xpos2)+50, GUICtrlRead($ypos2)+50, 0xF8A845)   
        sleep ("500")
    WEnd
    if @error then
        ProcessClose ("Firefox.exe")
        Exit
    Else
        sleep (3000)
        mouseclick ("Left",GUICtrlRead($xpos1), GUICtrlRead($ypos1), 1, 15 ) ;<- button 1
        sleep (1000)
        mouseclick ("Left",GUICtrlRead($xpos1)+40, GUICtrlRead($ypos1), 1, 15) ;<- button 1
        sleep (500)
        send ("{Tab 91}")
        sleep (1000)
        send ("{Enter}")
        sleep (1000)
        send ("{Enter}")
        sleep (1000)
    EndIf
EndFunc

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
    WEnd
    ToolTip("")
EndFunc


Func Terminate()
    Exit 0
EndFunc

well that is in the while 1 loop, so i dont understand what r you trying to do. And what is 'if @error then' and 'if not @error then' for?

i reedit your script litle so that its easyer to finde what you need but we need more info on what r you trying to do?

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

well that is in the while 1 loop, so i dont understand what r you trying to do. And what is 'if @error then' and 'if not @error then' for?

i reedit your script litle so that its easyer to finde what you need but we need more info on what r you trying to do?

ok il try to explain,

it is for a website, with one checkbox, and then 30 tabs and enter to start a action on action box,

however, i need the script to mouseover that button first to see if it is there or not (when it is nothin to delete, it is not there)

and it changes color when mouseoverd, so and it is the only place with that exact color.

added a img so u can see what im talking about :)

post-44830-12484619195251_thumb.jpg

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

then that loop need to look something like this

while 1
        sleep (2000)
        MouseMove (GUICtrlRead($xpos2), GUICtrlRead($ypos2) )
        sleep (1500)
        PixelSearch ( GUICtrlRead($xpos2), GUICtrlRead($ypos2),GUICtrlRead($xpos2)+50, GUICtrlRead($ypos2)+50, 0xF8A845)   
        if @error then
            ProcessClose ("Firefox.exe")
            Exit
        Else
            sleep (3000)
            mouseclick ("Left",GUICtrlRead($xpos1), GUICtrlRead($ypos1), 1, 15 ) ;<- button 1
            sleep (1000)
            mouseclick ("Left",GUICtrlRead($xpos1)+40, GUICtrlRead($ypos1), 1, 15) ;<- button 1
            sleep (500)
            send ("{Tab 91}")
            sleep (1000)
            send ("{Enter}")
            sleep (1000)
            send ("{Enter}")
            sleep (1000)
        EndIf
    WEnd

did you try to do all that with _IE* funcs from the help file? Mouseclick() and send() on webpage isnt something that is easy to do and to work with 100% on it.

edit: well i realy dont understand why you have that loop in the first place i think that its messing things up.

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

then that loop need to look something like this

while 1
        sleep (2000)
        MouseMove (GUICtrlRead($xpos2), GUICtrlRead($ypos2) )
        sleep (1500)
        PixelSearch ( GUICtrlRead($xpos2), GUICtrlRead($ypos2),GUICtrlRead($xpos2)+50, GUICtrlRead($ypos2)+50, 0xF8A845)   
        if @error then
            ProcessClose ("Firefox.exe")
            Exit
        Else
            sleep (3000)
            mouseclick ("Left",GUICtrlRead($xpos1), GUICtrlRead($ypos1), 1, 15 ) ;<- button 1
            sleep (1000)
            mouseclick ("Left",GUICtrlRead($xpos1)+40, GUICtrlRead($ypos1), 1, 15) ;<- button 1
            sleep (500)
            send ("{Tab 91}")
            sleep (1000)
            send ("{Enter}")
            sleep (1000)
            send ("{Enter}")
            sleep (1000)
        EndIf
    WEnd

did you try to do all that with _IE* funcs from the help file? Mouseclick() and send() on webpage isnt something that is easy to do and to work with 100% on it.

edit: well i realy dont understand why you have that loop in the first place i think that its messing things up.

yea iv checked it but dont really understand much about it,

well the loop is there becouse i need it to run that script until the button can't be located endlessly..

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0