Jump to content

BlockInputEx UDF!


MrCreatoR
 Share

Recommended Posts

I am writing a little program with a "Quit" routine and don't really want the users to know what it is so I made it a little difficult:

HotKeySet("^!+{ESC}", "Quit") ;crtl-alt-shift-esc

The problem I am having is getting _BlockInputEx to allow that combibation:

_BlockInputEx(1, "^!+{ESC}")

The quit routine works great until I invoke the InputEX(). Any idea what I am missing?

Edited by Melba23
Removed formatting rubbish from beginning of lost
Link to comment
Share on other sites

Still experiencing some wierd issues with the BlockInputEx. In addition to the issue mentioned above I have another oddity. This little program I am working on makes extensive use of BlockInputEx. Users testing it do so by simplely "banging" on the keyboard. Just typing every key rapidly and randomly. There have been several occassions where it gets to a point where the arrow keys start rotating the screen.

In searching I have found that the Intel Graphics Media Acceleration is running and present down by the clock. In looking at it the arrow keys do rotate the screen but have to be preceed by a ctrl-alt. Something the users are hitting is essentially setting the ctrl-alt keys as being in effect (held down) at which point the arrow keys rotate the screen because the ctrl-alt keys are "stuck" in the down position. Any ideas what the users could be hitting to allow the ctrl-alt keys to be stuck in the pressed position?

Link to comment
Share on other sites

  • 1 month later...

I am going to beg, plead and offer my first born for some help. I love what this BlockInputEx is supposed to do but I am dying. In addition to the problems with the Quit sequence two posts above I have encountered yet another issue asked here on two occassions but never answered. I need to do a MouseClick() with the primary mouse button but can't seem to get the click through BlockInputEx(). Here is what I Have:

Global $BlockExempt = "{F5}|^{F5}|{LEFT}|{RIGHT}|{UP}|{DOWN}|{PGUP}|{PGDN}|{ENTER}|{MPDOWN}|{MPUP}"

_BlockInputEx(1, $BlockExempt)

The MouseClick() will will not work. _BlockInputEx blocks it. I have read the docs on BlockInputEx until I am blue in the face. I am missing something simple I just can't figure out what.

SOS! HELP! PLEASE I AM BEGGING!

Link to comment
Share on other sites

  • 1 month later...

@ZiggyStardust What you are trying to do may not be possible. The ability for your script to use send() and mousemove() or mouseclick() is not in the UDF. as for the key combo for your Quit you can exclude the keys you need and then use the combo, but each key can also be pressed individually though. I am going to look into things and see if i can try to come up with code to Fix the mouseclick issue as well as key combos, although i wouldn't get too excited as i am no pro with programming.

Edited by SHOAnimal
Link to comment
Share on other sites

  • 4 months later...

Hello, love this addon, but had an issue with it. I have a script that I use that forces the caps lock on while in a particular app. However the users have found that they can bypass this by using the shift key. I wanted to use your add on to fix this but found some issues.

1st, when i added the code, to turn it on and then off when out of the window, after a little while it would produce an application crash. It would work until then.

2nd, I only need to prevent the shifting of letters, not numbers or symbols.

here is the app without the changes (had to undo and didnt save what I had added sorry.)

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=allcaps.ico
#AutoIt3Wrapper_Outfile=lockcaps.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#App by Frank Glover

#include

HotKeySet("^!Q", "_Quit")
HotKeySet("^!q", "_Quit")

Global $VK_CAPITAL = 0x14
Break(0)
Dim $version = "1.3a"
Local $hDLL = DllOpen("user32.dll")

Opt("SendCapslockMode", 0)

TraySetToolTip("LockCaps "&$version)

Global $PreviousCAPSOFF;CAPSLOCK OFF
While 1
WinWaitActive("[Class:ThunderRT6FormDC]")
$PreviousCAPSOFF = _GetCapslock() = 0
If $PreviousCAPSOFF Then Send("{CAPSLOCK on}")

While WinActive("[Class:ThunderRT6FormDC]")
Send("{CAPSLOCK on}")
Sleep(10)
WEnd
If $PreviousCAPSOFF Then Send("{CAPSLOCK off}")
WEnd

Func _GetCapslock()
Local $aRet = DllCall("user32.dll", "int", "GetKeyState", "int", $VK_CAPITAL)
Return $aRet[0]
EndFunc ;==>_GetCapslock

Func _Quit()
Exit
EndFunc ;==>_Quit

any help will be apreciated.

 

Spoiler

WinSizer 2.1 (01/04/2017) - Download - [ Windows Layout Manager ]
Folder+Program (12/23/2016) - Download - [ USB Shortcut Creator ]

 

Link to comment
Share on other sites

  • 5 months later...

Update...

 

[v1.8 - 12.05.2013, 12:16]

* Fixed issue when some numeric keyboard keys was not blocked.
* Fixed issue when ALT+Tab was not blocked.

 

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

I've seen similar questions to this one asked "regarding windows" but as yet unanswered.

I'm wondering if it possible with your UDF's to accomplish the following...

Block UP DOWN LEFT RIGHT to all but autoit window.

The goal is to give these keys mouse functionality, but without interacting with any active windows such as scrolling a webpage or any other application specific tasks.

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

  • 2 months later...

Hello!

Very useful script, thank you very much for your effort.

I think I have found a serious bug:

I can set exclusions for BlockInputEx like this:

BlockInputEx(1,"{F1}|{F2}")

This works fine.

However when I press CTRL+ALT+DEL (on Windows 7) - Windows Security window opens, then I press "Cancel" to close this window. And after this Input does not work as specified in this UDF description.

The problem is that after "CTRL+ALT+DEL" BlockInputEx exclusions (F1 and F2) also do not work!

Could this be somehow solved ? I've tried digging into code but did not understand where exclusions might be lost after CTRL+ALT+DEL.

P.S: I thought it was problem in my code, but after checking on UDF example - "Example - Exclude usage.au3" behavior was the same.

Thank you in advance for help!

Edited by AcidUser
Link to comment
Share on other sites

This example works for me (even after pressing Ctrl+Alt+Del) :

#include <BlockInputEx.au3>

;================== Exclude usage Example ==================

HotKeySet("{F1}", "_Quit")
HotKeySet("{F2}", "_Quit")

;All keyboard keys and mouse clicks are blocked except these keys: 0x1B = {ESC}, 0x70 = "{F1}", 0x71 = "{F2}", 0x72 = "{F3}"
;~ _BlockInputEx(1, "0x1B|0x70|0x71|0x72")
_BlockInputEx(1, "{F1}|{F2}")

;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
Link to comment
Share on other sites

Hi, Firefox, thanks for responding.

I test scripts on a VmWare Virtual Machine "Windows 7". Physical PC is Windows 8.

So maybe that bug is on VmWare only, I'll check that and report back.

One significant difference between Physical PC and Virtual Machine is that VMware works with "CTRL + ALT + INSERT" key mapping instead of traditional "CTRL + ALT + DEL".

Link to comment
Share on other sites

Hello,

I can confirm that this problem happens on virtual machines.

I used "Windows 7 x64" on VMware and after CTRL+ALT+DEL pressed "BlockInputEx" exclusion keys do not work anymore.

Posting this, due to more skilled Autoit guru might consider to fix this.

Thanks.

Link to comment
Share on other sites

  • 4 weeks later...
  • 2 months later...
  • Moderators

Jorin,

The UDF is just an include file - so make sure you have saved the BlockInputEx.au3 file in the same folder as your script, add

#include <BlockInputEx.au3>
at the top of your script and you can use the various fuctions within it without problem. :)

If you think that you might want to use the UDF in several scripts, you might want to read the Adding UDFs to AutoIt and SciTE tutorial in the Wiki to see how you can best do this. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

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

 

Link to comment
Share on other sites

So I want to block all input for the ninite.exe window. Yesterday I have been struggeling with this a while, but I dont seem to get close to the solution. Could anyone help me out with this? The way it is now, no input is blocked.

#include <BlockInputEx.au3>

If Not $CMDLINE[0] Then
    RunAs('***', '****', '****', 5, '"' & @AutoItExe & '" /AutoIt3ExecuteScript "' & @ScriptFullPath & '" /restart')
    If @error Then MsgBox(0x30, @ScriptName, 'Failed RunAs')
ElseIf $CMDLINE[1] = '/restart' Then
    ShellExecute('"' & @ScriptDir & '\Ninite.exe"')
    If @error Then
        MsgBox(0x30, @ScriptName, 'Failed to execute "' & @ScriptDir & '\Ninite.exe"')
        Exit 1
    EndIf
    ;
    While 1
        If Not ProcessExists('Ninite.exe') Then Exit 1
        WinSetTrans ( "Preparing", "", 0 )
WinWait("[REGEXPCLASS:Ninite.*]")
   $hNinite_Wnd = WinGetHandle("[REGEXPCLASS:Ninite.*]")
_BlockInputEx(1, "", "", $hNinite_Wnd)
        $text = WinGetText("Ninite", "")
        If StringInStr($text, "Finished.",1) Then
            ExitLoop
_BlockInputEx(0, "", "", $hNinite_Wnd)
        EndIf
        Sleep(500)
    WEnd
    Sleep(1000)
    ControlClick("Ninite", "", "[ID:2]")
Else
    MsgBox(0x30, @ScriptName, 'Only /restart parameter is accepted')
EndIf
Edited by Jorin
Link to comment
Share on other sites

I just copied   Example #1 (hWindows usage):   from the first post.

When I change _BlockInputEx(3, "", "", $hNotepad_Wnd) to _BlockInputEx(1, "", "", $hNotepad_Wnd) I noticed that it is not only blocking the notepad input. But is blocking all input for everything.

I removed AdlibRegister("_Quit", 10000) and I ended up resetting the VM because mouse and keyboard where blocked :)

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