Jump to content

Constant Function ?


Tum
 Share

Recommended Posts

Hi,

Is there a command so that i can have a function(s) constantly running whilst the main script is running ?

Like the HotKeySet commands that constantly run looking for a key to be presses ?

Link to comment
Share on other sites

  • Moderators

Tum,

Take a look at Adlib - it allows you to run a function at regular intervals regardless of what the rest of the script is up to. :)

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

Hi,

I got the AdLib statement running, and it seems to work fine, until it actually calls a function, then the AdLib seems to stop functioning anymore. Is there anyway to stop this please ?

ie

My AdLib calls a function every 60 seconds, the function it calls +1 to a variable, then does a IF statement. If the variable >= a number then it activates another function, otherwise the AdLib function ends, my script continues until the next 60 seconds is up, and the AdLib function is once again called.

All is good, until the IF statement is true, the new function is called, but for some reason, the AdLib statement stops working from then on !

Edited by Tum
Link to comment
Share on other sites

Hi,

At the start of my code i have the adlib function call

Global $errorcheck=0

AdlibRegister("ErrorCheck",60000)

and the routine i call every minute is a basic one

Func ErrorCheck()

$errorcount=$errorcount+1

If $errorcount>=15 Then

ToolTip("Errors Found, Restarting in 10 seconds",400,300,"",0,1)

Sleep(10000)

StartLoop()

EndIf

EndFunc

Then in startloop function it has a reset of $errorcount back to 0

Basically, my loop should last anything from 5 to 12 minutes, depending on what it has to do, and this adds a error check, so that if the loop gets stuck somewhere and is running for more than 15 minutes, it gets restarted.

Now this all works fine, The error checks happen, The loop gets restarted, I reset the errorcount back to 0, But for some reason the Function doesnt call then every 60 seconds (after its called the StartLoop from the first 15 minutes been reached). Even if i unregister and reregister the function it still doesnt rework the 60 second call.

Whats going on with it please ?

Edited by Tum
Link to comment
Share on other sites

  • Moderators

Tum,

At a first glance I am not at all happy with the StartLoop function being called within an Adlib call - it screams recursion. :(

We need a bit more than that to help - can you please post the whole script (or a short reproducer). ;)

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

The startloop script is basically the script that calls all the other functions within my script. Its the whole script, All the adlib function is doing is restarting the script, Is there a way to restart the script without calling a function like startloop ?

Link to comment
Share on other sites

  • Moderators

Tum

Is there a way to restart the script without calling a function like startloop

There are many ways to restart loops within scripts - but not all of them are right! :D

Which is why I keep asking you to post the script so we can see what is going wrong in your particular case. I could write examples of how you might do it all day - but I have other ways to spend my time more productively. So (for the last time of asking if you want any help from me ;)) please post your whole script so we can see what is happening when you call your function. :)

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

Tum,

As you admitted in the post you have quickly deleted that the reason you are not showing the whole script is because it breaks the Forum Rules, you can hardly expect any help with it, can you? :naughty:

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...