Jump to content

critical sections - (Moved)


pkil_k
 Share

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?

ty...

 

Link to comment
Share on other sites

That should answer your questions :

;https://www.autoitscript.com/forum/topic/199762-udf-blockinputex/
#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)
WEnd

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

 

Link to comment
Share on other sites

  • Developers

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

Quote

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

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