Jump to content
Sign in to follow this  
new2this

Simultaneous Function calls

Recommended Posts

new2this

I have a script that compares the md5 hash value of the same file but in two different locations. I would like to be able to call the functions at the same time rather than waiting on one to finish prior to executing the other. I make the calls like this:

$sumsource = md5file($sourcefile)

$sumdest = md5file($destfile)

If $sumsource = $sumdest Then

MsgBox(0,"","Match")

Endif

I would like to do something like (doesn't work):

$sumsource = md5file($sourcefile) And $sumdest = md5file($destfile)

If $sumsource = $sumdest Then

MsgBox(0,"","Match)

Endif

Some of these files for matching can be 2GB, which takes quite a while to obtain the md5 hash value, and if I can run then concurrently, this would save a lot of time.

Thanks ahead of time for any suggestions.

Share this post


Link to post
Share on other sites
smashly

One way maybe..

Make a main script that pipes the md5 function into 2 other separate scripts then use autoit command line to run the new scripts.

Even though the 2 new scripts won't be run at the exact millisecond they won't be far apart from each other.

Each of the scripts can set the text in a label or edit on the main scripts gui when they are done hashing.

Then all that's left to do is have the main script monitoring the labels/edits for changes.

Once both fields are filled in you use the main script to do a string compare from the data that has been put in it's fields.

Cheers

Share this post


Link to post
Share on other sites
Nutster

I have a script that compares the md5 hash value of the same file but in two different locations. I would like to be able to call the functions at the same time rather than waiting on one to finish prior to executing the other. I make the calls like this:

$sumsource = md5file($sourcefile)

$sumdest = md5file($destfile)

If $sumsource = $sumdest Then

MsgBox(0,"","Match")

Endif

I would like to do something like (doesn't work):

$sumsource = md5file($sourcefile) And $sumdest = md5file($destfile)

If $sumsource = $sumdest Then

MsgBox(0,"","Match)

Endif

Some of these files for matching can be 2GB, which takes quite a while to obtain the md5 hash value, and if I can run then concurrently, this would save a lot of time.

Thanks ahead of time for any suggestions.

This is one of the things that multi-threading would handle, but that is not part of AutoIt 3. Only one function can be executed at a time. It does not make a difference to the final result.

David Nuttall
Nuttall Computer Consulting

An Aquarius born during the Age of Aquarius

AutoIt allows me to re-invent the wheel so much faster.

I'm off to write a wizard, a wonderful wizard of odd...

Share this post


Link to post
Share on other sites
new2this

Thanks, I think that I'll make the md5file() a separate script and call each with a Run(). Great suggestion. I'll let you know.

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
Sign in to follow this  

×