Jump to content

Running a function while performing a check at the same time


Recommended Posts

Please see function AdlibRegister. This lets you register a function that is called every x milliseconds. In this function you can check the status of the client and do whatever you want. When you end the function the script keeps on processing where it left.

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

Just saying thank you is enough :)

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

It depends on your application. What happens if the client exits? How fast have you to detect this change?

But I think to set a value of 250 or 500 (means 4 or 2 checks per second) will be fine.

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

  • Moderators

iRAWRRichard,

You will probably find that for water (and for me) it is already tomorrow! :)

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

iRAWRRichard,

It is obvious that the error is on Line 23487 - you have spurgled the exobrox at that point. ;)

.....

Seriously, how are we supposed to help you with so few clues? Please post the code you have - but please use Code tags. Put [autoit] before and [/autoit] after your posted code. :D

Once we see what is going on we can offfer more sensible advice. :)

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

Ahh sorry haha. Well here's my full script :]

HotKeySet("{F1}", "Start")
HotKeySet("{F2}", "Stop")
Opt("MouseCoordMode", 2)
Opt("PixelCoordMode", 2)
AdlibRegister("CheckClient", 5000)
$RUNCOUNTER = 0
$TIMEOUT = 165000
$TIMEEXIT = 150000
Const $ID = ""
Const $PASSWORD = ""
Const $CHANNEL = 6 ; will change into array
Const $CHARACTER = 2 ; will change into array
While 1
DisplayToolTip(0)
WinWaitActive("Client", "")
WEnd
Func CheckClient()
If Not ProcessExists("Client.exe") Then
  StartClient()
  Login()
  Start()
EndIf
EndFunc
Func StartClient()
ShellExecute("C:Client.exe")
EndFunc
Func Login()
Do
  PixelSearch(482, 414, 482, 414, 0xFFFFFF, 1)
Until Not @error
WinSetOnTop("Client", "", 1)
WinActivate("Client")
MouseClick("left", 400, 300)
Do
  PixelSearch(61, 94, 61, 94, 0xDDEE88, 1)
Until Not @error
MouseClick("left", 398, 291, 2)
ControlSend("Client", "", "", $ID)
ControlSend("Client", "", "", "{TAB}")
ControlSend("Client", "", "", $PASSWORD)
ControlSend("Client", "", "", "{ENTER}")
Do
  PixelSearch(135, 57, 135, 57, 0xFFCC00, 1)
Until Not @error
MouseClick("left", 162, 59)
Do
  PixelSearch(251, 249, 251, 249, 0xFFDD00, 1)
Until Not @error
MouseClick("left", 260, 327, 2)
Do
  PixelSearch(117, 153, 117, 153, 0xFF7700, 1)
Until Not @error
ControlSend("Client", "", "", "{ENTER}")
Do
  PixelSearch(371, 245, 371, 245, 0xFFBB00, 1)
Until Not @error
ControlSend("Client", "", "", "{ENTER}")
EndFunc
Func Start()
WinActivate("Client")
WinSetOnTop("Client", "", 1)
WinMove("Client", "", 0, 0)
Do
  PixelSearch(482, 414, 482, 414, 0xCCEEEE, 2)
Until Not @error
MouseClick("left", 564, 555)
Do
  PixelSearch(431, 353, 431, 353, 0xFF0000, 2)
Until Not @error
ControlSend("Client", "", "", "{DOWN}")
ControlSend("Client", "", "", "{ENTER}")
Do
  PixelSearch(431, 392, 431, 392, 0xFF0000, 2)
Until Not @error
ControlSend("Client", "", "", "{ENTER}")
Call("StageOne")
EndFunc
Func StageOne()
WinActivate("Client")
$RUNCOUNTER = $RUNCOUNTER + 1
Do
  PixelSearch(445, 237, 445, 237, 0xDDDDDD, 1)
Until Not @error
DisplayToolTip(1)
$TIMER = TimerInit()
Send("{RIGHT down}")
Sleep(700)
Send("{RIGHT up}")
While TimerDiff($TIMER) <= $TIMEOUT
  Do
   Do
    PixelSearch(660, 450, 885, 546, 0x309C29, 20)
   Until Not @error
   Send("{S down}")
   PixelSearch(660, 450, 885, 546, 0x309C29, 20)
  Until @error
  Send("{S up}")
WEnd
Call("StageTwo")
EndFunc
Func StageTwo()
Do
  PixelSearch(444, 238, 444, 238, 0xDDDDDD, 1)
Until Not @error
DisplayToolTip(2)
$TIMER = TimerInit()
Send("{RIGHT down}")
Sleep(700)
Send("{RIGHT up}")
While TimerDiff($TIMER) <= $TIMEOUT
  Do
   Do
    PixelSearch(660, 450, 885, 546, 0xCC0000, 10)
   Until Not @error
   Send("{S down}")
   PixelSearch(660, 450, 885, 546, 0xCC0000, 10)
  Until @error
  Send("{S up}")
WEnd
Do
  PixelSearch(386, 275, 286, 275, 0xFFEEEE, 1)
Until Not @error
Call("StageThree")
EndFunc
Func StageThree()
Do
  PixelSearch(445, 236, 445, 236, 0xDDDDDD, 1)
Until Not @error
DisplayToolTip(3)
$TIMER = TimerInit()
Send("{RIGHT down}")
Sleep(700)
Send("{RIGHT up}")
While TimerDiff($TIMER) <= $TIMEEXIT
  Do
   Do
    PixelSearch(660, 450, 885, 546, 0x557799, 10)
   Until Not @error
   Send("{S down}")
   PixelSearch(660, 450, 885, 546, 0x557799, 10)
  Until @error
  Send("{S up}")
WEnd
MouseClick("left", 190, 214)
Do
  PixelSearch(431, 393, 431, 393, 0xFF0000, 2)
Until Not @error
ControlSend("Client", "", "", "{ENTER}")
Call("Start")
EndFunc
Func DisplayToolTip($STAGE)
ToolTip("Number of runs: " & $RUNCOUNTER & @CRLF & "Stage: " & $STAGE & @CRLF & "Press F1 to start" & @CRLF & "Press F2 to quit", @DesktopWidth, 0, "Bot", 0, 4)
EndFunc
Func Stop()
WinSetOnTop("Client", "", 0)
Exit
EndFunc

I just ran another test just now and the check ran fine, however around an hour ago the check didn't work. Just take a look at it and tell me what could be wrong. Also I realize my script is poorly coded, any tips on improving it? :]

Edited by iRAWRRichard
Link to comment
Share on other sites

  • Moderators

iRAWRRichard,

Subway PQ Bot

<Sigh>

Unfortunately you appear not to have read the Forum Rules. Please read them now and then you will understand why you will get no more help and this thread will shortly be locked. :)

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

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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