WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: ON.GBarker on October 24, 2013, 10:51:50 AM

Title: Centering in Word causes 194: Execution terminated by user request
Post by: ON.GBarker on October 24, 2013, 10:51:50 AM
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.
Title: Re: Centering in Word causes 194: Execution terminated by user request
Post by: Deana on October 24, 2013, 11:09:28 AM
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:
Title: Re: Centering in Word causes 194: Execution terminated by user request
Post by: Deana on October 24, 2013, 11:31:30 AM
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.
Title: Re: Centering in Word causes 194: Execution terminated by user request
Post by: 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.
Title: Re: Centering in Word causes 194: Execution terminated by user request
Post by: Deana on October 25, 2013, 08:44:55 AM
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.
Title: Re: Centering in Word causes 194: Execution terminated by user request
Post by: 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)
Title: Re: Centering in Word causes 194: Execution terminated by user request
Post by: Deana on October 25, 2013, 10:25:15 AM
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:

maybe it will lead to a clue of the actual problem.