Jump to content

Making new threads


trancexx
 Share

Recommended Posts

I don't know how to explain this in eng. Will try though.

You can exit process and you can exit thread. (You can exit other things too but that's another story)

I will demonstrate exiting thread AutoIt uses to run scripts. That would be the only* thread that we could run with AutoIt.

What would happen then? Normally nothing. After the internal AutoIt's handler chew what happened our process would exit.

But(!), what if I manipulate everything and make a new thread that would start at the same place the original did, at the entry point of @AutoItExe. Then I kill current thread and continue executing in a new thread. Only all over again.

That would be mighty bitchen. Here's the script that demonstrates that:

ThreadMatic.au3

It's heavily commented for people that would be interested.

There are two very important 'moments'. ExitProcess function and WaitForSingleObject functions.

Two more:

- Purposes of this are yet to be discovered.

- Dropping some aspects of internal AutoIt's handler with this.

* take that conditionally

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

Nice work trancexx :)

You have a lot of time to code excellent examples... ;)

Btw, maybe you can help me:

You know the internal Zip function. How can I check whether the ZIP thread has ended when I add files to a Zip archive?

...
$obj_ZIP = ObjCreate("Shell.Application") 
 $obj_Folder = $obj_ZIP.NameSpace($folder) 
$obj_ZIP_Folder = $obj_ZIP.NameSpace($zip_filename) 
$obj_Copy = $obj_ZIP.NameSpace($zip_filename).CopyHere($obj_Folder.Items, $flag) ;add files to ZIP archive
While 1
 Sleep(100)
 ;if thread which was created above ($obj_Copy) has ended then exitloop -> an idea?
Wend

Thanks,

UEZ

PS: no hidden joke!?!

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Nice work trancexx :)

You have a lot of time to code excellent examples... ;)

Btw, maybe you can help me:

You know the internal Zip function. How can I check whether the ZIP thread has ended when I add files to a Zip archive?

...
$obj_ZIP = ObjCreate("Shell.Application") 
 $obj_Folder = $obj_ZIP.NameSpace($folder) 
$obj_ZIP_Folder = $obj_ZIP.NameSpace($zip_filename) 
$obj_Copy = $obj_ZIP.NameSpace($zip_filename).CopyHere($obj_Folder.Items, $flag) ;add files to ZIP archive
While 1
 Sleep(100)
 ;if thread which was created above ($obj_Copy) has ended then exitloop -> an idea?
Wend

Thanks,

UEZ

Thank you UEZ.

About zip. You could enumerate threads of this process in order to find specific one and use WaitForSingleObject to determine the end of it. You can find script I wrote for enumerating threads up in 'general help and support'. It uses Manko's dll to determine the module from which the thread is. That said, I'm defeating it myself already, right? But what's in dll can be in AutoIt code too so if you are interested you know where to look.

I would go with counting items while waiting, for sure. That's easier.

PS: no hidden joke!?!

Here's one that's not hidden B)

This guy drives the freeway. The radio is on ...news time: "Attention to all drivers on highway 10; Crazy person drives the wrong way. Be extremely carefull!"

He says: "Dammit!!! It's not just one, there are hundreds of them!"

Yes I know, I suck in telling jokes.

Btw, there is a hidden joke but again you fail to see it B)

But at least I know you use Vista (or win7) and that's why you are forgiven B)

Edited by trancexx

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

Thank you UEZ.

About zip. You could enumerate threads of this process in order to find specific one and use WaitForSingleObject to determine the end of it. You can find script I wrote for enumerating threads up in 'general help and support'. It uses Manko's dll to determine the module from which the thread is. That said, I'm defeating it myself already, right? But what's in dll can be in AutoIt code too so if you are interested you know where to look.

I would go with counting items while waiting, for sure. That's easier.

Here's one that's not hidden ;)

This guy drives the freeway. The radio is on ...news time: "Attention to all drivers on highway 10; Crazy person drives the wrong way. Be extremely carefull!"

He says: "Dammit!!! It's not just one, there are hundreds of them!"

Yes I know, I suck in telling jokes.

Btw, there is a hidden joke but again you fail to see it B)

But at least I know you use Vista (or win7) and that's why you are forgiven :)

Now I remember again (I'm too old for that shit) - I already asked that kind of question some time ago and monoceres wrote someting and my idea was also to count the threads but testing on serveral systems (e.g. window server 2003, etc.) it was not accurate enough because amount of threads vary during zip operation!

My idea was to get the TID's from SHLWAPI.DLL that were created to add files to zip and check that but I give it up some time ago. Now I remebered that issue when I saw you thread code example.

Might be the wrong place here to ask that stuff.

Yes, I'm using most times Vista x32... B)

THANKS,

UEZ

PS: you meant that thread or?

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

  • 1 month later...

OK here's a possible use.

I've successfully done this by modifying the public autoit source, I'm not sure if it's possible to do without source modification, but I'm leaving that to you (how nice of me, heh?).

If the interpreter gets restarted in the middle of execution it's possible that data may live on. That is, a user function declared in one script could be executed from another.

Changing the command line before restart and doing some other funky, hacky things it may or may not work.

If this could be done a live interpreter like the one Python has could be made and that would be totally fucking amazing.

Oh and btw, while I have your attention, here's a thought I've had in my mind for a while.

What is the boolean value of the following expression?

AutoIt3 + Regular Expressions + C++ + AutoItX + GCC

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

Any specific reason or thought? I believe that around 90 % of the functionality could be duplicated.

It's not really how many.

There are bridges that must not be broken down in process.

You need a consensus of some sort first, a team second and more than a brilliance here and there.

What do you have of that?

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

It's not really how many.

There are bridges that must not be broken down in process.

I'm not following.

You need a consensus of some sort first, a team second and more than a brilliance here and there.

What do you have of that?

Sure it's overwhelming work. However I don't think it will be done so well it will be truly useful either.

Converting syntax is almost too easy, data storage is not very hard either (tricky to match functionality precisely but robust scripts would not suffer) and functionality would primary be fetched from AutoiItX (keeping it an autoit driven program and automatic compatibility with newer version of the product).

Final touches are very specific features such as FileInstall, but that can wait.

As I said, gigantic project but I have no doubt people would chip in if a prototype came flying through the window. Just saying.

Edited by monoceres

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

What's the weakest link in the current AutoIt?

Whether someone likes it or not or be aware of that or not, and no matter how advanced, it's still the interpreter part.

But somehow this is taboo theme.

Last time I asked about that it eventually lead to me being banned. Things should be allowed to be discussed, otherwise ideas are lost. There are people with ideas regardless of their coding abilities.

Coding is often the easy part, idea is what's tough. And for ideas you need inspiration. What better way to get inspiration but to listen to someone else - and their ideas?

There are switches that must be turned on. It will happen eventually, I'm sure of it.

Joke with switches...

Where did the darkness go when you turned the switch in the room on?

- Nowhere. Darkness is still there only the color of it changed.

edit: "Wheader"

Edited by trancexx

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

I agree with Trancexx. Personally, I don't think discussing these topics is harmful at all, but helpful. These ideas are the beginnings of some of the best programs and can be helpful to everyone. I can't count how many ideas I have got off this forum and how many more ideas I got off forums that have nothing to do with coding. I think talking about anything that pops into your mind should be allowed as there isn't any coding involved. But then again, Valik's thoughts are the ones that matter, not mine.

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