Jump to content
Macro Express Forums

Temporarily Disable Mouse and Not Keyboard


Recommended Posts

Does anyone know of a way to temporarily disable the mouse while still allowing the user to use keyboard?

 

My goal is to not allow the user to derail the macro by accidentally bumping the mouse while it is running, however I want them to be able to stop the entire macro with the ‘Scroll Lock + Pause Break’ hot-key.

 

 

Any suggestions would be much appreciated.

Link to comment
Share on other sites

I don't know how but this subject has come up before. Please try to search the forum first before asking. A quick search revealed this message and many others that looked promising. Make sure to check the ME3 forum too. But if none of those work then come back to this thread and I'll look into it more for you.

Link to comment
Share on other sites

Thank you Cory for your input.

I have searched the forums and had found the link you mentioned, however it is in regards to the mouse pad on laptops.

 

After talking to some IT experts and Stan Jones, it appears that Windows considers both the mouse and the keyboard as one entity and thus you can not disable one without the other. Furthermore, my macros will not be run under an administrator user profile, so I am very limited in what I can do.

 

Ultimately, it appears that my only option is to use the Macro Express "Lock/Unlock Keyboard and Mouse" command and create a persistent text box which explains how to over-ride the lock for the duration of the macro.

 

 

Caution: This is a Windows function that completely locks the keyboard and mouse. Use with caution. The keyboard and mouse remain locked even if the macro gets stuck during playback.
In this situation close Macro Express using Windows Task Manager (Ctrl + Alt + Delete). This key sequence is not locked by Windows. In the Task Manager, scroll to highlight macexp.exe. Then press Alt + E to End Task. The keys are not locked in the Task Manager window. When Macro Express is closed, the mouse and keyboard will again be accessible.

 

 

The above quote is an excerpt from Insight Software Solutions' Macro Express Pro Instruction Manual

http://www.macros.com/download/macroexpressprohelp.pdf

 

 

Hopefully this thread will be a better point of reference for developers in a similar predicament.

 

 

Link to comment
Share on other sites

OK, you could do as follows.

 

Create macro M1, which contains a single line comprising an AutoIt function which:

- creates a temporary hotkey (in this case Ctrl-Alt-X) which, when pressed, aborts the AutoIt function

- continuously moves the mouse to a fixed point on your monitor (in this example it's 600, 512 which is the middle of my centre monitor)

<EXTERNAL SCRIPT Language="AutoIt" Dest="%tOutput%" Script="HotKeySet(\"^!x\", \"MyExit\")\r\nWhile 1 <> 2\r\n    MouseMove(600, 512, 0)\r\nWEnd\r\n\r\nFunc MyExit()\r\n    Exit\r\nEndFunc" Encoding="0"/>

Create macro M2 which calls M1 without waiting for it to complete, then gets on with its business (in this case, it simply displays a message advising the user to press Ctrl-Alt-X to unlock the mouse)

<MACRO RUN Use_ID="FALSE" Name="M1" ID="-1" Wait="FALSE"/>
<TEXT BOX DISPLAY Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang3081{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 Press Ctrl-Alt-X to unlock the mouse.\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="2" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>

If this approach works for you, then you could also pass as parameters to the AutoIt function the hotkey to use, and the location to move the mouse to. I can help you further with this if you're interested.

Although you could write the mouse-moving code in MEP instead of AutoIt, in MEP you can't abort a specific macro, and you can't define a temporary hotkey.

Link to comment
Share on other sites

I was just thinking about WMI because ostensibly you should be able to manage anything about Windows with it. I poked around and found a few who had used the code below to enable or disable either the mouse or keyboard. And I'm pretty sure you can do anything WMI form VBScript which you can run from the External Script command. I've not tested it but if I were you I'd start looking here.

Shell "rundll32 mouse,enable"
Shell "rundll32 keyboard,enable"
Link to comment
Share on other sites

Moving the mouse is a great idea. Couldn't you just do that with MEP?

Didn't I answer that point already in this sentence?

"Although you could write the mouse-moving code in MEP instead of AutoIt, in MEP you can't abort a specific macro, and you can't define a temporary hotkey."

Link to comment
Share on other sites

I think the Macro Express Pro "Lock/Unlock Keyboard and Mouse" command only works if Macro Express Pro is running as an administrator. Wouldn't these Shell examples also need to run as an administrator in order to work?

Good point. You're probably correct.

Link to comment
Share on other sites

Didn't I answer that point already in this sentence?

"Although you could write the mouse-moving code in MEP instead of AutoIt, in MEP you can't abort a specific macro, and you can't define a temporary hotkey."

Sorry, I didn't read your port carefully. You're right of course. However I've always been able to effectively do this even though it's technically not possible. Often these are in loops and I simply have the macro I want to be able to abort check for a control trigger like an entry in the registry at which point it self terminates. And I don't see the need of a temporary hotkey. But there are ways to effectively do that too. Like en/disable a macro with said hotkey. But I dislike things like this as it's all getting a bit inelegant.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...