Sign in to follow this  
Followers 0
trancexx

Making new threads

12 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

I can give you dword value. It's around 2147483647.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

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

Edited by monoceres

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

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!

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

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

Share this post


Link to post
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.


[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

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  
Followers 0