# Program to write in a terminal every certain period of time

#### Titanpick

Joined Sep 9, 2017
16
Hi,

I need to program the computer for him to write some words every 10 seconds in tera term terminal.
For exemple, I need him to write for exemple
Abc+enter key, def+enter key, ghi+enter key, klmn+enter key. etc....(in loop)

IN the terminal, I would like it to be written this way
Abc+enter key
wait 10 seconds
def+enter key
wait 10 seconds
ghi+enter key
wait 10 seconds
klmn+enter key
wait 1minute
Abc+enter key
wait 10 seconds
def+enter key
wait 10 seconds
ghi+enter key
wait 10 seconds
etc.....(in loop)

Is it possible to do ? If yes, can you please tell me how?

Thank you

#### wayneh

Joined Sep 9, 2010
16,258
Are we to guess the computer and operating system?

#### Titanpick

Joined Sep 9, 2017
16
Are we to guess the computer and operating system?
I am using HP with windows 10 (64 bit).

#### wayneh

Joined Sep 9, 2010
16,258
I am using HP with windows 10.
And you want the typing to occur while you are running "Tera Term"? Have you looked into its built-in macro scripting language?

You can likely accomplish this with other scripting techniques (I'm a Mac user, so can't help you) but using the app's own macro language is likely simpler if it will do it.

#### Titanpick

Joined Sep 9, 2017
16
And you want the typing to occur while you are running "Tera Term"? Have you looked into its built-in macro scripting language?

You can likely accomplish this with other scripting techniques (I'm a Mac user, so can't help you) but using the app's own macro language is likely simpler if it will do it.
Yes. The automate typing typing has to be on Tera Term. I want to only program it once to type some instructions by itself in loop on tera term for an indefinite amount of time . I don't know about how to use it's macro scripting language. Can anyone can help me how to program that with it's macro language or with any other way?

#### wayneh

Joined Sep 9, 2010
16,258
Can anyone can help me how to program that with it's macro language?
I think it's a little unlikely to find someone on a circuits forum that has experience with this. I could be wrong. I'd look for a Tera Term user forum and ask the open source community for help. I wouldn't do that until I had read the documentation.

xox

#### be80be

Joined Jul 5, 2008
2,006

#### spinnaker

Joined Oct 29, 2009
7,837

#### spinnaker

Joined Oct 29, 2009
7,837

#### be80be

Joined Jul 5, 2008
2,006
The OP said
Program to write in a terminal every certain period of time
I took it he wants it to show up there not send it
.

Joined Jan 15, 2015
5,132
Something you can try is writing a script. I don't have Tera Term but can give you an example of using a VB Script (.vbs file extension) and the Send Keys method. Copy and paste the following code sample into Microsoft Notepad.
Code:
Set WshShell = WScript.CreateObject("WScript.Shell")
WScript.Sleep 1000
WScript.Sleep 1000
WshShell.SendKeys "ABC"
WshShell.SendKeys "{ENTER}"
WScript.Sleep 1000
WshShell.SendKeys "DEF"
WshShell.SendKeys "{ENTER}"
WScript.Sleep 1000
WshShell.SendKeys "GHI"
WshShell.SendKeys "{ENTER}"
WScript.Sleep 1000
WshShell.SendKeys "JKL"
WshShell.SendKeys "{ENTER}"
WScript.Sleep 1000
WshShell.SendKeys "MNO"
WshShell.SendKeys "{ENTER}"
WScript.Sleep 1000
WshShell.SendKeys "PQR"
WshShell.SendKeys "{ENTER}"
WScript.Sleep 1000
WshShell.SendKeys "STU"
WshShell.SendKeys "{ENTER}"
WScript.Sleep 1000
WshShell.SendKeys "VWX"
WshShell.SendKeys "{ENTER}"
WScript.Sleep 1000
WshShell.SendKeys "YZ"
With Notepad open File/SaveAs/ and name the file SendKeysExample.vbs or whatever you want. In the save dialog box choose All Files do not save as a Text file. Make sure you save the file with a .vbs extension. Save the file to your desktop. You should see a new little icon on the desktop SendKeysExample.vbs now double click the file. It should run, open notepad and start typing ABC..... The code pretty much shows what we did.

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "%windir%\notepad.exe" This line would be \teraterm or similar
WScript.Sleep 1000
WshShell.AppActivate "TeraTerm" Again TeraTerm

I used one second delays but rather than:
WScript.Sleep 1000
Change 1000 to 10000 and see if that works.

You can also, as suggested, try a macro. All we did was open and start MS Notepad and using the send keys method in Visual Basic Scripting send text. The code is pretty easy to figure out what is going on. Just remember you paste the code in notepad and Save As File Name: SendKeysExample.vbs and Save As Type: All Files (*.*). This may or may not work out for you.

You can add a loop function to loop however you wish, just Google VBS Loop Functions for some looping code examples in VBS.

Ron