Jump to content

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


 Share

Recommended Posts

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
Link to comment
Share on other sites

  • Moderators

christian11,

Look at AdlibRegister in the Help file.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
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

 

Link to comment
Share on other sites

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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • Moderators

christian11,

a spammer thing lol

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

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
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

 

 

Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

  • 3 weeks later...

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
Link to comment
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

 

 

 

 

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...