Jump to content

critical sections - (Moved)

Recommended Posts

hi Folks..

i began writing AutoIt scripts about 5 years ago.. for gaming purposes mainly.

then i realised just how powerful this platform is..

a couple of points maybe ppl can help clarify for me :-

  • i was unsure whether Beep is synchronous or asych.. seems to be synchronous yeh?
  • is there any way to make a block atomic? (critical section)
  • i use hotkeys but i need some way to pass on keyboard events ie. not consume

any suggestions?



Share this post

Link to post
Share on other sites

That should answer your questions :

#include "..\BlockInput\BlockInputEX.au3"

ConsoleWrite ("Question 1" & @CRLF)
$hTimer = TimerInit ()
Beep (800, 2000)
ConsoleWrite (TimerDiff ($hTimer) & @CRLF)

ConsoleWrite ("Question 2" & @CRLF)
_BlockInput ($BI_DISABLE)     ; block
;do your stuff here
ConsoleWrite ("you are blocked : critical section" & @CRLF)
Sleep (10000)
;nothing much you can do to interupt
_BlockInput ($BI_ENABLE)     ; unblock

ConsoleWrite ("Question 3 - press a" & @CRLF)
HotKeySet ("a", _F)
While True
  Sleep (100)

Func _F ()
  HotKeySet ("a") ; temp remove hot key
  Send ("a")
  ConsoleWrite ("Sent a" & @CRLF)
  HotKeySet ("a", _F)  ; reset hot key


Share this post

Link to post
Share on other sites

Moved to the appropriate forum, as the Developer General Discussion forum very clearly states:


General development and scripting discussions. If it's super geeky and you don't know where to put it - it's probably here.

Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums.

Moderation Team

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
Live for the present,
Dream of the future,
Learn from the past.

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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...