Centering in Word causes 194: Execution terminated by user request

Started by ON.GBarker, October 24, 2013, 10:51:50 AM

Previous topic - Next topic

ON.GBarker

I'm using a SendKeysTo function to center text in Microsoft Word 2010.  The specific line reads:

SendKeysTo ( "~Microsoft Word", "{END}{ENTER}^e")

Every time my script executes this line of code the Control e is interpreted as a break by the script and I get a 194: Execution terminated by user request.

Can anyone tell me how to send a Control e to Microsoft Word without terminating the Winbatch Script?  I would like to avoid using mouse movements, but I would be grateful for any other options.

Deana

Not sure why WinBatch would be interpreting that keystroke sequence as a Ctrl+Break . A Ctrl+Break abruptly cancels the script, and therefore no further processing can occur. What happens if you split up the line like this:

Code (winbatch) Select
SendKeysTo ( "~Microsoft Word", "{END}{ENTER}")
TimeDelay(0.2)
SendKeysTo ( "~Microsoft Word", "^e")


Does that have any effect?

Please answer the following:

  • Windows platform.
  • WinBatch version.
  • keyboard and keyboard driver, including version info.
  • Any keyboard modifying tools installed on your system?
  • How exactly are you launching the script? Double clicking on the .wbt file in the explorer? Running in debug mode in studio? Running in Run mode in studio?
Deana F.
Technical Support
Wilson WindowWare Inc.

Deana

I created a test script using Windows 7, Word 2010 and WinBatch 2013C. I am unable to reproduce the behavior you are seeing:

Code (winbatch) Select
doc = 'C:\TEMP\test.docx'
partialwinname = "~Microsoft Word"
If !WinExist( partialwinname )
   ;Pause('','Window not found. Please launch Word and open doc file!')
   Shellexecute(doc, '', '', @NORMAL, '')
   WinWaitExist(partialwinname, 5)
Endif
TimeDelay(1)
WinActivate( partialwinname )
For x = 1 to 100
   SendKeysTo ( partialwinname, "{END}{ENTER}^e")
   ;TimeDelay(0.2)
Next


I wonder if it somehow hardware related. Please provide information about the keyboard and keyboard driver, including version info.
Deana F.
Technical Support
Wilson WindowWare Inc.

snowsnowsnow

This looks like the age-old "keyboard driver" issue.

Where, under certain totally unexplained (and unexplainable) circumstances, the system gets into a state where anytime you hit the control key (or a script does the equivalent of hitting that script), the script is aborter (with that message, implying that the script thinks it has been killed by a Ctrl/Break).

The fix (workaround) is to put:

IntControl(12,5,0,0,0)

at the start of your script.  The downside of this fix, of course, is that you can no longer terminate your script via Ctrl/Break.

Deana

Quote from: snowsnowsnow on October 25, 2013, 03:06:44 AM
This looks like the age-old "keyboard driver" issue.

Where, under certain totally unexplained (and unexplainable) circumstances, the system gets into a state where anytime you hit the control key (or a script does the equivalent of hitting that script), the script is aborter (with that message, implying that the script thinks it has been killed by a Ctrl/Break).

The fix (workaround) is to put:

IntControl(12,5,0,0,0)

at the start of your script.  The downside of this fix, of course, is that you can no longer terminate your script via Ctrl/Break.

Snowsnowsnow, thanks for sharing the workaround.  However I would like to get more information from the user so we can have a better idea what is causing the this issue.
Deana F.
Technical Support
Wilson WindowWare Inc.

snowsnowsnow

No problem (as, as our friends south of the border say, de nada), but every time this has come up in the past, you (WB Tech Support) have always said that it was caused by a bad keyboard driver - and have implied that it was possible to download and install a better keyboard driver and that the problem would then go away.

I was never able to follow up on this suggestion, so I just did the workaround.

P.S.  BTW, I did mean it when I said "anytime the control key is hit" - you don't have to hit Control-anything to trigger it; you just have to hit the Control key itself... (either alone or in a combination)

Deana

Quote from: snowsnowsnow on October 25, 2013, 09:46:29 AM
No problem (as, as our friends south of the border say, de nada), but every time this has come up in the past, you (WB Tech Support) have always said that it was caused by a bad keyboard driver - and have implied that it was possible to download and install a better keyboard driver and that the problem would then go away.

I was never able to follow up on this suggestion, so I just did the workaround.

P.S.  BTW, I did mean it when I said "anytime the control key is hit" - you don't have to hit Control-anything to trigger it; you just have to hit the Control key itself... (either alone or in a combination)

Snowsnowsnow...
So apparently you are able to easily reproduce this issue on your system? Could you maybe provide the requested information?

Please answer the following:

  • Windows platform
  • WinBatch version
  • Keyboard and keyboard driver, including version info.
  • Any keyboard realted tools installed on your system?
  • How exactly are you launching the script? Double clicking on the .wbt file in the explorer? Running in debug mode in studio? Running in Run mode in studio?

maybe it will lead to a clue of the actual problem.
Deana F.
Technical Support
Wilson WindowWare Inc.