Jump to content

run functions as new process ?


Recommended Posts

  • Moderators

hi !

Is it able and usefull to run a function as a new (hidden) process that could be watched by the main script ?

Then the main script can kill it if it hangs.

What do you mean by hidden process?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

I have a GUI with Buttons that call functions. *wow* :geek:

If one of these functions hang up, the whole scrict hangs.

I want the main script watch these functions if they are working or hanging.

like timeout or so.

but how to check a hanging script it self ? :o

Link to comment
Share on other sites

  • Moderators

I have a GUI with Buttons that call functions. *wow* :geek:

If one of these functions hang up, the whole scrict hangs.

I want the main script watch these functions if they are working or hanging.

like timeout or so.

but how to check a hanging script it self ? :o

You create the script with error debugging within the funtions... "If said statement true Then Do something" "Else Return Error Number"... take a look at the macor @error, and the function SetError() in the help file.

As far as MultiThreading, the closest thing we have is AdlibEnable() unless you want to learn to use StderrRead /StdOutRead/StdWrite in the help file.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

I hate guessing... SHOW US SOME SCRIPT

8)

Ha!!, I read that.. and my mind is totally in the gutter... I imagined myself at the Nudy Bar... Getting impatient... and saying.... FOR THE LOVE OF GOD... SHOW US SOME SCRIPT!!! That's going to be my new saying in life.... It will totally throw people off! :o

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Ha!!, I read that.. and my mind is totally in the gutter... I imagined myself at the Nudy Bar... Getting impatient... and saying.... FOR THE LOVE OF GOD... SHOW US SOME SCRIPT!!! That's going to be my new saying in life.... It will totally throw people off! :o

lol... Ron

EDIT

your not going to believe this ... nudy bar ana all... this was my "69" post for the day

8)

EDIT

the counter went to 68... this is a test

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

  • 2 weeks later...

I've now created a UDF library which supports multithreading, so in this way, you could "watch" a script from the main script. Example: You know a script shouldn't take more than, say, 10 seconds to complete. If it does, then it is a hung script.

#include "Coroutine.au3"

$thread = _CoCreate('Func ChildScript()|MsgBox(0,"","Hope this doesn''t hang!")|While 1|Sleep(100)|WEnd|EndFunc', "|")

$timer = TimerInit()
$instance1 = _CoStart($thread)

While _CoStatus($instance1) <> "dead"
    If TimerDiff($timer) >= 10000 Then
        MsgBox(0,"Error","Child script has hung.")
        ExitLoop
    EndIf
    Sleep(100)
WEnd

_CoCleanup()

Coroutine.zip

[u]My UDFs[/u]Coroutine Multithreading UDF LibraryStringRegExp GuideRandom EncryptorArrayToDisplayString"The Brain, expecting disaster, fails to find the obvious solution." -- neogia

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