Jump to content
Sign in to follow this  

do 2 things at same time

Recommended Posts


Hi. I can\t make my script do 2 things at same time:

<p>#include &lt;ScreenCapture.au3&gt;;</p><p><br></p><p><div>Local $hWnd = "test1&gt;"</div><div>For $i = 1 To 10</div><div>_ScreenCapture_SetJPGQuality(30)</div><div>&nbsp; &nbsp;_ScreenCapture_CaptureWnd($i &amp; ".jpg", $hWnd)</div><div>&nbsp; &nbsp;Sleep(500)</div><div>Next</div><div><br></div><div><div>Local $hWnd = "test2&gt;"</div><div>For $i = 1 To 10</div><div>_ScreenCapture_SetJPGQuality(30)</div><div>&nbsp; &nbsp;_ScreenCapture_CaptureWnd($i &amp; ".gif", $hWnd)</div><div>&nbsp; &nbsp;Sleep(500)</div><div>Next</div></div></p>

It wil start taking 10 screenshots : .jpg and then it will takes 10 screenshots : .gif

I need it to be setup this way, I don\t want the 2 codes to be together in one, how is it possible to make it take the screenshot at same time

Share this post

Link to post
Share on other sites

make 2 different scripts and have both of them run when you press a hot key

Share this post

Link to post
Share on other sites

try registering two Functions using Adlibregister


While 1

Func _Write()
ConsoleWrite('Func 1'&@CRLF)

Func _WriteAgain()
ConsoleWrite('Func 2'&@CRLF)

Therewill be ofcourse a bit of difference in execution with respect to time

but overall it wont affect

Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post

Link to post
Share on other sites


Just put the 2 captures in the same loop:

#include <screencapture.au3>


For $i = 1 To 10
    _ScreenCapture_CaptureWnd($i & ".jpg", "test1&gt;")
    _ScreenCapture_CaptureWnd($i & ".gif", "test2&gt;")

As AutoIt cannot do 2 things at once, this is probably as close as you can get to simultaneous. Running 2 scripts as suggested above is, in my experience, likely to be even more unsynchronised - and Adlib is not the answer here. ;)


Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:


ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area


Share this post

Link to post
Share on other sites

hi melba ;) thanks you solution, anorther one would be to have:



and then shellexecute 1.au3 and 2.au3, but i guess thats a kinda slutty solution if i did that :)?

Share this post

Link to post
Share on other sites

and then shellexecute 1.au3 and 2.au3

You still can't be sure that that two scripts will be snagging screenshots at the same time. The OS will start one script then the other script and then depending on interrupts and dll calls and wait states and disk access and all sorts of other background things, script 1 could actually finish before script 2 even fires off its first capture or the other way around. The suggestions from Melba23 and forumer100 would be your best choices.

Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.