473,398 Members | 2,113 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Automation, disabling keystrokes/mouse

TR
Hi,
We have some code that uses automation to create/manipulate word
documents. This runs in a batch mode, generating dozens of documents in
sequence. The code works great, but while the automation code is working
in word, care must be taken not to "interrupt" it with a keystroke or
mouse-click, otherwise the current selection gets put somewhere its not
supposed to be, and subsequent code will fail. This means that while it
is running, the PC it is running on is effectively out of service.

Is there a way to disable the word application from receiving any input,
such that the PC can continue to be used without risking someone
clicking into the automated instance?
Thanks,
Tom

Nov 12 '05 #1
3 2500
TR wrote:
Hi,
We have some code that uses automation to create/manipulate word
documents. This runs in a batch mode, generating dozens of documents in
sequence. The code works great, but while the automation code is working
in word, care must be taken not to "interrupt" it with a keystroke or
mouse-click, otherwise the current selection gets put somewhere its not
supposed to be, and subsequent code will fail. This means that while it
is running, the PC it is running on is effectively out of service.

Is there a way to disable the word application from receiving any input,
such that the PC can continue to be used without risking someone
clicking into the automated instance?
Thanks,
Tom


If I were you, I'd write Word Macros to manipulate the document without
resorting to keystroke poking. Google "SendKeys" for hundreds of
warnings about the dangers of this unreliable method of automatation.

Sorry if it's not the answer you want to hear but anyone who helps you
down that particular route is not helping you at all (apart from helping
you dig a hole for yourself). I've seen keystrokes destined for a
partcular app get directed into Windows Explorer, with cut and pastes
going on it was a hair raising time.

Nov 12 '05 #2
On Wed, 25 Feb 2004 19:32:32 +0000, Trevor Best <nospam@localhost> wrote:
TR wrote:
Hi,
We have some code that uses automation to create/manipulate word
documents. This runs in a batch mode, generating dozens of documents in
sequence. The code works great, but while the automation code is working
in word, care must be taken not to "interrupt" it with a keystroke or
mouse-click, otherwise the current selection gets put somewhere its not
supposed to be, and subsequent code will fail. This means that while it
is running, the PC it is running on is effectively out of service.

Is there a way to disable the word application from receiving any input,
such that the PC can continue to be used without risking someone
clicking into the automated instance?
Thanks,
Tom


If I were you, I'd write Word Macros to manipulate the document without
resorting to keystroke poking. Google "SendKeys" for hundreds of
warnings about the dangers of this unreliable method of automatation.

Sorry if it's not the answer you want to hear but anyone who helps you
down that particular route is not helping you at all (apart from helping
you dig a hole for yourself). I've seen keystrokes destined for a
partcular app get directed into Windows Explorer, with cut and pastes
going on it was a hair raising time.


TR didn't say anything about using SendKeys, the quesiotn was how to prevent
the user from typing/clicking so as to alter the state of MS Word in a way the
code doesn't expect while the code is in progress. Personally, I just don't
make the MS Word application visible while doing automation, but I don't know
if that's an option here.
Nov 12 '05 #3
TR
Hi Steve,
Your assessment is correct.
My first inclination was to hide it as well. I have tried hiding the window, but
the process failed. This is code I have inherited, so I am still becoming familiar
with it. I'll try some more debugging to see if I can find what portion of the
code requires/expects the window to be visible, then maybe I can alter it to work
while hidden.
Thanks,
Tom

Steve Jorgensen wrote:
On Wed, 25 Feb 2004 19:32:32 +0000, Trevor Best <nospam@localhost> wrote:
TR wrote:
Hi,
We have some code that uses automation to create/manipulate word
documents. This runs in a batch mode, generating dozens of documents in
sequence. The code works great, but while the automation code is working
in word, care must be taken not to "interrupt" it with a keystroke or
mouse-click, otherwise the current selection gets put somewhere its not
supposed to be, and subsequent code will fail. This means that while it
is running, the PC it is running on is effectively out of service.

Is there a way to disable the word application from receiving any input,
such that the PC can continue to be used without risking someone
clicking into the automated instance?
Thanks,
Tom


If I were you, I'd write Word Macros to manipulate the document without
resorting to keystroke poking. Google "SendKeys" for hundreds of
warnings about the dangers of this unreliable method of automatation.

Sorry if it's not the answer you want to hear but anyone who helps you
down that particular route is not helping you at all (apart from helping
you dig a hole for yourself). I've seen keystrokes destined for a
partcular app get directed into Windows Explorer, with cut and pastes
going on it was a hair raising time.


TR didn't say anything about using SendKeys, the quesiotn was how to prevent
the user from typing/clicking so as to alter the state of MS Word in a way the
code doesn't expect while the code is in progress. Personally, I just don't
make the MS Word application visible while doing automation, but I don't know
if that's an option here.


Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Olli Piepponen | last post by:
Hi, I'm having a little problem catching keystrokes under Windows. I did a little research and found that with mscvrt.getch() one can cath a single key that is pressed. However this doesn't work...
1
by: Zaidan | last post by:
I am running Excel2000 under WIN98 2nd edition, and I am writing a VBA code (I will consider using javascript if I have to) that does the following, at the user command: 1- Start MS Explorer and...
15
by: qwweeeit | last post by:
Hi all, Elliot Temple on the 1 June wrote: > How do I make Python press a button on a webpage? I looked at > urllib, but I only see how to open a URL with that. I searched > google but no...
2
by: Marc R. Bertrand | last post by:
Hello, In Excel VBA, using SendKeys in a Sub procedure with a shortcut running the Sub/macro, I can replace a users's fingers and press keys for him. How can I do this in Access? I would like...
16
by: cgreen | last post by:
Hi Folks, Need help AUTOMATING the process of importing a text document into Access in which the data has been uploaded from a hand held scanner. Any thoughs/comments, E-me Thanks in...
6
by: Roger Uribe | last post by:
There are references to using the wndproc form sub to trap and swallow the mousewheeel events - but they don't get there when a combobox (or many other controls) has the focus.. Yet the MSDN does...
3
by: Gunnar Syren | last post by:
I'm trying to implement a macro feature in my application by recording and playing back keystrokes. At first I thought it would be enough to catch KeyDown in my main form, but I soon realized that...
0
by: robert.waters | last post by:
Hello, When executing DoCmd.TransferSpreadsheet to an .xls file that's being used as a datasource for a Word mail merge document, if that Word document is currently open, the TransferSpreadsheet...
14
by: effendi | last post by:
Is it possible for me to disable the wheel scroll in a mouse when user click on a drop-down list? Thanks
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.