Sending Keystrokes stalls and won't insert text in Windows 11 Notepad

Discuss RoboTask here
Post Reply
Russman34
Posts: 4
Joined: Tue Jul 16, 2024 7:14 pm

Sending Keystrokes stalls and won't insert text in Windows 11 Notepad

Post by Russman34 »

I am re-posting this as the moderator seems to have overlooked approving it under a different Subject from July 22nd.

Oleg,
I have spent several hours trying to get a simple task to work properly, but have not been successful. The task was to use Open Document in Notepad and Send Keystrokes to insert the words "Hello World!". Notepad opens a file but then stalls showing a blinking cursor without inserting the specified text. Strangely, the log file reports that the task has been executed successfully. I tried your suggestions of inserting a longer pause between keypresses and using the clipboard as the source for text insertion, but that did not make any difference.

Any additional ideas or suggestions you may have that would allow for the proper execution of my simple task would be much appreciated. Thank you.

Russell Cowgill
Oleg
Site Admin
Posts: 3201
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Sending Keystrokes stalls and won't insert text in Windows 11 Notepad

Post by Oleg »

Look at my small example below
It works on Windows11 notepad. I have tested it

The important moments:
- Put pause after "Run notepad"
- Use "insert pause between keypresses" not less than 80ms. Otherwise you can get incorrect text

Save the text of the task to a file and use menu Task->Import to import the task into RoboTask.
Also you can simply copy task text and paste it into the task list.
Then you can see it in task editor

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|444033236
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task1104"
Hide=INTEGER|0
ID=INTEGER|1521866326
LogOnAsUser=INTEGER|1
Name=STRING|"Run ""notepad.exe "" and send Hello World!"
OnErrorTaskID=INTEGER|0
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
StepPause=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER

[Actions\Action1]
ActionID=STRING|"A_GENERAL_RUN_PROG"
Enabled=INTEGER|-1
Name=STRING|"Run ""notepad.exe """
Params=FOLDER

[Actions\Action1\Params]
ifnonzero=STRING|"0"
program=STRING|"notepad.exe"
runas=STRING|"0"
wait=STRING|"0"

[Actions\Action2]
ActionID=STRING|"A_GENERAL_PAUSE"
Enabled=INTEGER|-1
Name=STRING|"Delay 1 sec"
Params=FOLDER

[Actions\Action2\Params]
delay=STRING|"1"
dimension=STRING|"1"

[Actions\Action3]
ActionID=STRING|"A_GENERAL_SENDKEYS"
Enabled=INTEGER|-1
Name=STRING|"Send keys to active window"
Params=FOLDER

[Actions\Action3\Params]
currentwindow=STRING|"1"
fixedwindow=STRING|"0"
keylayout=STRING|"0"
keys=STRING|"""Hello World!!!"""
pause=STRING|"80"
release=STRING|"1"
sendkind=STRING|"0"
wincaption=STRING|"Notepad"
Oleg Yershov
Russman34
Posts: 4
Joined: Tue Jul 16, 2024 7:14 pm

Re: Sending Keystrokes stalls and won't insert text in Windows 11 Notepad

Post by Russman34 »

Thanks for your response. I was able to use your example to generate the string "Hello World!!!" in Notepad. I don't, however, have even a basic understanding of the many code lines used to to create the RoboTask task that made this happen.

The good news is that by examining the task that your many lines of code generated, I was able to revise the steps from my previous task that worked under Windows 10, to again perform flawlessly under Windows 11.

Thank you again for taking the time to assist me.

Russell Cowgill
Post Reply