mavor Posted December 16, 2009 Share Posted December 16, 2009 Hello all, I apologize if this question has already been answered and could have been found by using the search engine. I did not turn anything up when I searched. I would like to know if it is possible to create multiple parallel script execution branches using AutoIT. Eg. sending a 400 ms keypress to one application, and at the same time, send a 700 ms keypress to another application. In more detail, I wish to create a script capable of branching itself out based on how many applications are open at the same time. If i were to open application A, then the script would begin running on it, and if i happened to open application B, the script would detect the new application being opened and then begin initiating a new branch of itself on that application (sending keystrokes and the like). Thank you very much for your time and again I apologize if this has already been answered before. Link to comment Share on other sites More sharing options...
funkey Posted December 16, 2009 Share Posted December 16, 2009 For something like that you could use _Timer_SetTimer. Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Link to comment Share on other sites More sharing options...
JohnOne Posted December 16, 2009 Share Posted December 16, 2009 You might want to reinstall your browser as the search function on it seems to be broken, or on auto ignore. My search for threading turned up tons of results on multi threading. General opnion seems to be no, but you might want to look at some og trancex posts in the example scripts forum. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
dantay9 Posted December 16, 2009 Share Posted December 16, 2009 True multithreading is not currently available in AutoIt at the current time. There are several UDFs and workarounds that will allow you to get similar results, but no true multithreading. Trancxx has made a few great examples somewhere on here. AdlibRegister in the new beta version is an easy alternative to multithreading. There is also an adlib udf that uses adlib functions in an intuitive way to create the effect of multithreading. If you searched the forum for multithreading and didn't come up with anything, something is wrong. This topic has been discussed and developed many times before. Link to comment Share on other sites More sharing options...
mavor Posted December 19, 2009 Author Share Posted December 19, 2009 Would it be possible to just start up an instance of AutoIT3 for each application I want to run it on? Is it possible for the same key to be "pressed" in two or more applications at the same time? Link to comment Share on other sites More sharing options...
martin Posted December 19, 2009 Share Posted December 19, 2009 (edited) Would it be possible to just start up an instance of AutoIT3 for each application I want to run it on? Yes, you can run as many scripts at once as you like, or you can compile them and run the exes. Is it possible for the same key to be "pressed" in two or more applications at the same time? Only one proces can have the keyboard focus, but you could set a hotkey the same in each application. Then you would have to resend that key sequence while the hotkey was temporarily turned off. Something like this.(not tested) HotKeySet("{F10}","dostuff") while 1 sleep(90) wend Func dostuff() HotKeySet("{F10}");so that we can send this hotkey and not respond to it Send("{F10}");send the hotkey so other applications will see it $T = timerinit() ;stuff to be done while TimerDiff($T) < 2000;allow time for other processes to deal with the hotkey sleep(50) wend HotKeySey("{F10}");turn it back on again EndFunc Edited December 19, 2009 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
mavor Posted December 20, 2009 Author Share Posted December 20, 2009 So if i had two scripts open one in each application and they both wanted to press a key for 500 ms... only one of them would actually be able to do so and the other one would be out of luck? The problem with hotkeys is that in one program you might want a 500 ms keypress whereas in the other you might want a 1500 ms keypress ;D Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now