christian11

prioritize sending a key in timer interval x seconds without interfering other?

14 posts in this topic

#1 ·  Posted (edited)

i want autoit to send the key to my browser refresh button F5 every 3 minutes, but i dont want it to interfere with the script.. something like a timer.. click F5 every 3 minutes without interfering with the original script in the loop?

HotKeySet ("{HOME}", "Start")

While 1
Sleep(200)
WEnd


Func Start()
While 1
          Send("{F3}")
          sleep (180000) ;---- press f3 every 3mins timer without interfering other
          ;and prioritizing it at the same time??
 Else
  
     $pink = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, 0x8a0859)
If isArray($pink) then
MouseMove($pink[0],$pink[1], 0)
sleep(100)
MouseClick("Left")

Else
            $pink2 = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, 0x8c085a)
If isArray($pink2) then
MouseMove($pink2[0],$pink2[1], 0)
sleep(100)
MouseClick("Left")

    Else

$pink3 = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, 0x880852)
If isArray($pink3) then
MouseMove($pink3[0],$pink3[1], 0)
sleep(100)
MouseClick("Left")

Endif
Endif
Endif
WEnd
EndFunc

 

Edited by christian11

Share this post


Link to post
Share on other sites



christian11,

Look at AdlibRegister in the Help file.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

Share this post


Link to post
Share on other sites

thanks for fast reply

is it okay?

HotKeySet ("{HOME}", "Start")
AdlibRegister("refresh",180000);3minutes?



While 1
Sleep(200)
WEnd
Func Start()
While 1
         "refresh" ;--- how can i add the adlibregister"refresh" here?? is it correct?
 Else
  
     $pink = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, 0x8a0859)
If isArray($pink) then
MouseMove($pink[0],$pink[1], 0)
sleep(100)
MouseClick("Left")

Else
            $pink2 = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, 0x8c085a)
If isArray($pink2) then
MouseMove($pink2[0],$pink2[1], 0)
sleep(100)
MouseClick("Left")

    Else

$pink3 = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, 0x880852)
If isArray($pink3) then
MouseMove($pink3[0],$pink3[1], 0)
sleep(100)
MouseClick("Left")

Endif
Endif
Endif
WEnd
EndFunc

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I must admit I'm a but curious. Which application are you trying to automate?
As it seems to be a browser app, wouldn't it be more reliable to use the IE UDF (I assume you are running Internet Explorer) that comes with AutoIt?

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-02-03 - Version 1.4.7.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-03 - Version 1.2.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

christian11,
you really need to read the help file. What you are asking for can be found there ;)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-02-03 - Version 1.4.7.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-03 - Version 1.2.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

like what i said in my previous thread im trying to automate google chrome browser from a webpage.. a spammer thing lol

im really new to this..the helpfile didnt seem give me more info for my problem.. i would really appreciate can someone give me example for this thank you!

Edited by christian11

Share this post


Link to post
Share on other sites

christian11,

a spammer thing lol

Would you care to expand on that a bit?  Just what/who are you spamming?

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

Share this post


Link to post
Share on other sites

what? r u guys are from cyber police or something? kidding. i am not doing illegal cybercrime lol 

i just want to open webpages from emails sended from my boss from client.. and spam click the pink pixel on it and resend it like a automate email 

so how about this? i hope this will work

HotKeySet ("{HOME}", "Start")
AdlibRegister("refresh",180000);3minutes?



While 1
Sleep(200)
WEnd

Func refresh()
    Send("{F5}")
EndFunc


Func Start()
While 1
        call "refresh"
 Else
  
     $pink = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, 0x8a0859)
If isArray($pink) then
MouseMove($pink[0],$pink[1], 0)
sleep(100)
MouseClick("Left")

Else
            $pink2 = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, 0x8c085a)
If isArray($pink2) then
MouseMove($pink2[0],$pink2[1], 0)
sleep(100)
MouseClick("Left")

    Else

$pink3 = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, 0x880852)
If isArray($pink3) then
MouseMove($pink3[0],$pink3[1], 0)
sleep(100)
MouseClick("Left")

Endif
Endif
Endif
WEnd
EndFunc

 

 

Share this post


Link to post
Share on other sites

christian11,

r u guys are from cyber police or something?

No, just trying to protect AutoIt's reputation.

What email client do you use? Perhaps there is a better way to automate it than PixelSearch.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

ahh oh i see. i understand. 

im not using email apps just simple google chrome yahoomail  @_@ i customized my email into pink theme so pixelsearch can see through it..

so whats up my script is bad or okay? 

Edited by christian11

Share this post


Link to post
Share on other sites

christian11,

my script is bad or okay? 

Did you check it before posting? I think not because it is full of syntax errors. 

Perhaps this might do what you want (I have not tested because I do not have the "pink" page to test):

HotKeySet("{HOME}", "_Start")
HotKeySet("{END}", "_Stop")

; Create Run flag
Global $bRun = False

; Run your refresh function automatically
AdlibRegister("refresh", 180000) ; 3 minutes

While 1
    Sleep(200)
    ; Check if we should run the main function
    If $bRun Then
        ; Just run it the once on each pass - that way we can check if we stil need to do so
        _Main()
    EndIf

WEnd



; This will run independently as you require
Func refresh()
    Send("{F5}")
EndFunc   ;==>refresh

; These 2 functions set/clear the Run flag
Func _Start()
    $bRun = True
EndFunc   ;==>_Start

Func _Stop()
    $bRun = False
EndFunc   ;==>_Stop

; This function does all the work
Func _Main()

    $pink = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, 0x8a0859)
    If IsArray($pink) Then
        MouseMove($pink[0], $pink[1], 0)
        Sleep(100)
        MouseClick("Left")
        Return
    Else
        $pink2 = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, 0x8c085a)
        If IsArray($pink2) Then
            MouseMove($pink2[0], $pink2[1], 0)
            Sleep(100)
            MouseClick("Left")
            Return
        Else
            $pink3 = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, 0x880852)
            If IsArray($pink3) Then
                MouseMove($pink3[0], $pink3[1], 0)
                Sleep(100)
                MouseClick("Left")
                Return
            EndIf

        EndIf

    EndIf



EndFunc   ;==>_Main

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

christian11,

Did you check it before posting? I think not because it is full of syntax errors. 

Perhaps this might do what you want (I have not tested because I do not have the "pink" page to test):

HotKeySet("{HOME}", "_Start")
HotKeySet("{END}", "_Stop")

; Create Run flag
Global $bRun = False

; Run your refresh function automatically
AdlibRegister("refresh", 180000) ; 3 minutes

While 1
    Sleep(200)
    ; Check if we should run the main function
    If $bRun Then
        ; Just run it the once on each pass - that way we can check if we stil need to do so
        _Main()
    EndIf

WEnd



; This will run independently as you require
Func refresh()
    Send("{F5}")
EndFunc   ;==>refresh

; These 2 functions set/clear the Run flag
Func _Start()
    $bRun = True
EndFunc   ;==>_Start

Func _Stop()
    $bRun = False
EndFunc   ;==>_Stop

; This function does all the work
Func _Main()

    $pink = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, 0x8a0859)
    If IsArray($pink) Then
        MouseMove($pink[0], $pink[1], 0)
        Sleep(100)
        MouseClick("Left")
        Return
    Else
        $pink2 = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, 0x8c085a)
        If IsArray($pink2) Then
            MouseMove($pink2[0], $pink2[1], 0)
            Sleep(100)
            MouseClick("Left")
            Return
        Else
            $pink3 = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, 0x880852)
            If IsArray($pink3) Then
                MouseMove($pink3[0], $pink3[1], 0)
                Sleep(100)
                MouseClick("Left")
                Return
            EndIf

        EndIf

    EndIf



EndFunc   ;==>_Main

M23

omg thank you so much it works..i actually lost my hope.. until i recently saw your reply  :))

 although i have wait for 3mins after i pressed the start button. but its okay its perfectly working as intended.

one more question... how can i add another adlibregister? with another different function let say every 2mins it will mouseclick in coordinates 592,173

 

; Create Run flag
Global $bRun = False

; Run your refresh function automatically
AdlibRegister("refresh", 180000) ; 3 minutes
AdlibRegister("click2mins", 120000) ; 2 minutes

While 1
    Sleep(200)
    ; Check if we should run the main function
    If $bRun Then
        ; Just run it the once on each pass - that way we can check if we stil need to do so
        _Main()
    EndIf

WEnd



; This will run independently as you require
Func refresh()
    Send("{F5}")
EndFunc   ;==>refresh

Func click2mins()
       MouseClick("left",592,173)
EndFunc  ;==>click2mins

; These 2 functions set/clear the Run flag
Func _Start()
    $bRun = True
EndFunc   ;==>_Start

Func _Stop()
    $bRun = False
EndFunc   ;==>_Stop

 

 

 

Edited by christian11

Share this post


Link to post
Share on other sites

Have you tested it? It looks good to me.


Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post


Link to post
Share on other sites

Have you tested it? It looks good to me.

only function refresh works.. but click2mins not working any idea why?

; Create Run flag
Global $bRun = False

; Run your refresh function automatically
AdlibRegister("refresh", 180000) ; 3 minutes
AdlibRegister("click2mins", 120000) ; 2 minutes

While 1
    Sleep(200)
    ; Check if we should run the main function
    If $bRun Then
        ; Just run it the once on each pass - that way we can check if we stil need to do so
        _Main()
    EndIf

WEnd



; This will run independently as you require
Func refresh()
    Send("{F5}")
EndFunc   ;==>refresh

Func click2mins()
       MouseClick("left",592,173)
EndFunc  ;==>click2mins

; These 2 functions set/clear the Run flag
Func _Start()
    $bRun = True
EndFunc   ;==>_Start

Func _Stop()
    $bRun = False
EndFunc   ;==>_Stop

 

 

 

 

 

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