Jump to content

Help With Block Input with Toggle Pause


Recommended Posts

Hey Guys Curious if your able to help me, i'm trying to use a block Input script along with a toggle pause,

atm i'm just testing trying to toggle the block/unblock along with the pause script toggle.

i've included the UDF files i'm using with block input function. but can;t rly make head or tales as to the edits i need to make to the UDF.

the script current has two functions in it atm while i'm testing.

the end result should be as follows....

{PAUSE} = TogglePause and also Toggle Input block

^{PAUSE} = Terminate

my test script so far, excuse the mess, had to keep functions from both scripts to keep my computer from freaking out.

#include <BlockInputEx.au3>

;================== Exclude usage Example ==================
Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("^{PAUSE}", "Terminate")


HotKeySet("{PAUSE}", "_Quit")

;All keyboard keys and mouse clicks are blocked except these keys: 0x13 = {PAUSE}
_BlockInputEx(1, "0x13")

;This is only for testing, so if anything go wrong, the script will exit after 10 seconds.
AdlibRegister("_Quit", 10000)

While 1
Sleep(100)
WEnd

Func _Quit()
Exit
EndFunc





Func TogglePause()
$Paused = NOT $Paused
While $Paused
sleep(100)
ToolTip('Script is Paused',1047,0," Warning",0,4)
WEnd
ToolTip("")
EndFunc

Func Terminate()
Exit 0
EndFunc

BlockInputEx_UDF_1.6.zip

Edited by IIIRAZORIII
Link to comment
Share on other sites

I couldn't test because I'm currently on a laptop without {PAUSE} key

but it should work

#include <BlockInputEx.au3>

;================== Exclude usage Example ==================
Global $Paused = False
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("^{PAUSE}", "_Quit")


;~ HotKeySet("{PAUSE}", "_Quit") ;<<<<<<<<<<<<<<<<<<<<<<<<<< you cannot register two functions simultaneously for the same key.

;All keyboard keys and mouse clicks are blocked except these keys: 0x13 = {PAUSE}
_BlockInputEx(1, "0x13")

;This is only for testing, so if anything go wrong, the script will exit after 10 seconds.
AdlibRegister("_Quit", 10000)

While 1
If $Paused Then
While $Paused
Sleep(100)
ToolTip('Script is Paused', 1047, 0, " Warning", 0, 4)
WEnd
Else
ToolTip('')
EndIf
WEnd

Func _Quit()
Exit
EndFunc   ;==>_Quit

Func TogglePause()
$Paused = Not $Paused
EndFunc   ;==>TogglePause

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.

Link to comment
Share on other sites

Strange. I tested in my computer and it perfectly works

The mouse and keyboard are blocked except the PAUSE key

pressing the pause key shows a tooltip that the Script it paused, again pressing it removes the tooltip

The script remains in state for 10secs...

Which version of Autoit are you using and what is your environment ?

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.

Link to comment
Share on other sites

Strange. I tested in my computer and it perfectly works

The mouse and keyboard are blocked except the PAUSE key

pressing the pause key shows a tooltip that the Script it paused, again pressing it removes the tooltip

The script remains in state for 10secs...

Which version of Autoit are you using and what is your environment ?

did you make any edits to the BlockInputEx.au3 file ?

for me the toggle pause works but input remains blocked.

and the "control pause" no longer Quits, need to wait out the timer

Edited by IIIRAZORIII
Link to comment
Share on other sites

Nowhere we are freeing the input

Hence input would remain blocked

Where do you want to unblock the user input

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.

Link to comment
Share on other sites

Maybe this would do how you are preferring

BTW: I have removed the Quit after 10secs

#include <BlockInputEx.au3>

;================== Exclude usage Example ==================
Global $Paused = False, $iBlocked = False
HotKeySet("{PAUSE}", "TogglePause")

;All keyboard keys and mouse clicks are blocked except these keys: 0x13 = {PAUSE}
_BlockInputEx(1, "0x13")


While 1
If $Paused Then
While $Paused
Sleep(10)
If $iBlocked Then
_BlockInputEx(0)
$iBlocked = False
ToolTip('Script is Paused', 1047, 0, " Warning", 0, 4)
AdlibRegister("Tip", 4000)
EndIf
WEnd
ElseIf Not $iBlocked Then
_BlockInputEx(1, "0x13")
$iBlocked = True
EndIf
WEnd

Func TogglePause()
$Paused = Not $Paused
EndFunc   ;==>TogglePause

Func Tip()
ToolTip('')
AdlibUnRegister("Tip")
EndFunc   ;==>Tip

Thumbs up if it helped ;)

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.

Link to comment
Share on other sites

#include <BlockInputEx.au3>

;================== Exclude usage Example ==================
Global $Paused = False, $iBlocked = False, $iExit_Timeout = 11000 ;11secs
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("^{PAUSE}", "Quit")

;All keyboard keys and mouse clicks are blocked except these keys: 0x13 = {PAUSE}
_BlockInputEx(1, "0x13")
AdlibRegister("Quit", $iExit_Timeout )

While 1
If $Paused Then
While $Paused
Sleep(10)
If $iBlocked Then
_BlockInputEx(0)
$iBlocked = False
ToolTip('Script is Paused', 1047, 0, " Warning", 0, 4)
AdlibRegister("Tip", 4000)
EndIf
WEnd
ElseIf Not $iBlocked Then
_BlockInputEx(1, "0x13")
$iBlocked = True
EndIf
WEnd

Func TogglePause()
$Paused = Not $Paused
EndFunc ;==>TogglePause

Func Tip()
ToolTip('')
AdlibUnRegister("Tip")
EndFunc ;==>Tip

Func Quit()
_BlockInputEx(0)
Exit
EndFunc

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.

Link to comment
Share on other sites

Not Sure why but this didn't work even after editing to

_BlockInputEx(1, "0x13|0x11") which i thought would have been the issue since control key is blocked.

atm though with the following, i can quit while in pause, but i am requiered to pause first before quit.

Global $Paused = False, $iBlocked = False, $iExit_Timeout = 11000 ;11secs
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("^{PAUSE}", "Quit")

;All keyboard keys and mouse clicks are blocked except these keys: 0x13 = {PAUSE}
_BlockInputEx(1, "0x13|0x11")
AdlibRegister("Quit", $iExit_Timeout )

While 1
If $Paused Then
While $Paused
Sleep(10)
If $iBlocked Then
_BlockInputEx(0)
$iBlocked = False
ToolTip('Script is Paused', 1047, 0, " Warning", 0, 4)
AdlibRegister("Tip", 4000)
EndIf
WEnd
ElseIf Not $iBlocked Then
_BlockInputEx(1, "0x13|0x11")
$iBlocked = True
EndIf
WEnd

Func TogglePause()
$Paused = Not $Paused
EndFunc ;==>TogglePause

Func Tip()
ToolTip('')
AdlibUnRegister("Tip")
EndFunc ;==>Tip

Func Quit()
_BlockInputEx(0)
Exit
EndFunc
Edited by IIIRAZORIII
Link to comment
Share on other sites

Try this

Alt + Pause - Quit the script

#include <BlockInputEx.au3>

Global $Paused = False, $iBlocked = True, $iExit_Timeout = 11000 ;11secs
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("!{PAUSE}", "Quit")

;All keyboard keys and mouse clicks are blocked except these keys: 0x13 = {PAUSE}
_BlockInputEx(1, "0xA4|0x13")
AdlibRegister("Quit", $iExit_Timeout)

;~ MsgBox(64 , '', $ah_MouseKeyboard_WinHooks[5], 5 )

While 1
If $Paused Then
While $Paused
Sleep(10)
If $iBlocked Then
_BlockInputEx(0)
$iBlocked = False
ToolTip('Script is Paused', 1047, 0, " Warning", 0, 4)
AdlibRegister("Tip", 4000)
EndIf
WEnd
ElseIf Not $iBlocked Then
_BlockInputEx(1, "0xA4|0x13")
Tip()
$iBlocked = True
EndIf
WEnd

Func TogglePause()
$Paused = Not $Paused
EndFunc   ;==>TogglePause

Func Tip()
ToolTip('')
AdlibUnRegister("Tip")
EndFunc   ;==>Tip

Func Quit()
_BlockInputEx(0)
Exit
EndFunc   ;==>Quit

You forgot one thing, when we press Ctrl+Pause ETX is posted not pause neither ctrl.

the hex code for ETX is 0x03 but when you add it to the exclude list, the combination would be posted but the hotkey would not be triggered.

Simultaneously Scite even uses Ctrl+Break to exit the script

I therefore used Alt+Pause

and the hex code for Alt is 0xA4

Hope this helps

Regards :)

Phoenix XL

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.

Link to comment
Share on other sites

glad to be of service

regards :)

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.

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