Solved In Need a batch file command

WinJake

New member
Local time
8:07 AM
Messages
21
In Need of a batch file command

So, I need a command for batch files, or other things that a batch file can link to, that selects another window, say a text window(notepad) and then can be typed into.
I've used the vbs scripting with
Set oShell = CreateObject("WScript.Shell")

oShell.AppActivate "Window name"

oShell.SendKeys "text~"
but it will get screwy if you are using the computer, it activates, and you activate a window other than in the vbs, and it sselecs everything, or does something. I need something that links to it, not "select it" like with a mouse click. I thank anyone who can help, even if the vbs is the only way.
 
Last edited:

My Computer My Computer

Computer Manufacturer/Model Number
Toshiba Satellite L755
OS
Windows 7 Home Premium 64bit
Memory
500 GB
Tell us a bit more and maybe we can help you.

Where does the text being sent to notepad come from? Clipboard?

What do you do with the notepad window once the text has been sent to it?
 

My Computer My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Employer provided Dell Latitude
OS
W7 Pro SP1 64bit
CPU
i7
Memory
8GB
Graphics Card(s)
Intel HD Graphics
Hard Drives
crappy SSD
Antivirus
Employer mandated Symantec Endpoint Protection
Browser
Pale Moon 64bit, IE11 64bit & Chrome 64bit
well, actually, im not using it to type into notepad, its for a different thing, much more complicated and wierd, nut Im using notepad as an example for an input location.
The text comes from the script that selects notepad. Whatever it is, it has to input text that is located in the script.
When the text is sent, nothing happens. a vbs script kills itself after completing its task, and the script I use does its job and ends. but its unstable, so I need a replacement. the notepad would keep running.
Say for example, I need the words "hello, I need help," sent to notepad, I could put a script thats like

*terms and numbers and words and stuff to select the notepad window""Notepad window's name"
*more words and stuff "hello, I need help"

and put in a vbs,batch, or other file. the script I ahve posted can cause problems when it activates, you're in a window that's not the one the script wants, and then erverything goes nuts. in chrome/iexplorer, it scrolls and highlights things. in windowsexplorer, in selects and opens folders. It is too unreliable.
 

My Computer My Computer

Computer Manufacturer/Model Number
Toshiba Satellite L755
OS
Windows 7 Home Premium 64bit
Memory
500 GB
If AutoIt can "see" the edit field, then AutoIt can probably send text to the field without bringing the app into focus.

See this documentation.
 

My Computer My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Employer provided Dell Latitude
OS
W7 Pro SP1 64bit
CPU
i7
Memory
8GB
Graphics Card(s)
Intel HD Graphics
Hard Drives
crappy SSD
Antivirus
Employer mandated Symantec Endpoint Protection
Browser
Pale Moon 64bit, IE11 64bit & Chrome 64bit
I cant use an external program or anything that needs to be downloaded. or at least I really dont want to. I really want something that can be downloaded with the rest of what I have. This is actually what I'm trying to use this for- how to make a server auto-save+restart *vanilla* - Minecraft Forum
It's to help people with their servers, but it needs a few remodeling and TLC things done to it to make it better. If I have to, I can make the autoIt work for waht I need, but ,again, I really dont want to.
 

My Computer My Computer

Computer Manufacturer/Model Number
Toshiba Satellite L755
OS
Windows 7 Home Premium 64bit
Memory
500 GB
Both AutoIt and VBS call Windows APIs. I don't know if VBS can call the equivalent of a controlsend. Perhaps other forums members can help you with that.
 

My Computer My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Employer provided Dell Latitude
OS
W7 Pro SP1 64bit
CPU
i7
Memory
8GB
Graphics Card(s)
Intel HD Graphics
Hard Drives
crappy SSD
Antivirus
Employer mandated Symantec Endpoint Protection
Browser
Pale Moon 64bit, IE11 64bit & Chrome 64bit
What script from autoit will actually do what I need it to? like everything that's go into a vbs/batch/etc. I can test it with a vbs and batch
 

My Computer My Computer

Computer Manufacturer/Model Number
Toshiba Satellite L755
OS
Windows 7 Home Premium 64bit
Memory
500 GB
Sorry, I don't understand your question.

If you want to use AutoIt, you would start by making sure that the ControlSend function (linked to above) can send text to the window of insterest without having to bring it into focus. If that works for you, then you will need to learn how to do each task that you want done using AutoIt.

I do not know if VBS can send text to a window that is not in focus.
 

My Computer My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Employer provided Dell Latitude
OS
W7 Pro SP1 64bit
CPU
i7
Memory
8GB
Graphics Card(s)
Intel HD Graphics
Hard Drives
crappy SSD
Antivirus
Employer mandated Symantec Endpoint Protection
Browser
Pale Moon 64bit, IE11 64bit & Chrome 64bit
I mean what is the script that would be copy pasted or written into a vbs or other file to do the autoit functions.
 

My Computer My Computer

Computer Manufacturer/Model Number
Toshiba Satellite L755
OS
Windows 7 Home Premium 64bit
Memory
500 GB
I don't know. We will have to see if other forum members know.

I stopped using VBS more than a decade ago since AutoIt does more. I still use batch files, but I don't think those commands can help you.
 

My Computer My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Employer provided Dell Latitude
OS
W7 Pro SP1 64bit
CPU
i7
Memory
8GB
Graphics Card(s)
Intel HD Graphics
Hard Drives
crappy SSD
Antivirus
Employer mandated Symantec Endpoint Protection
Browser
Pale Moon 64bit, IE11 64bit & Chrome 64bit
yeah, just tested the script that'd do what I need for autoit, but in a vbs, batch file, and .au3/autoit format that notepad++ offers to save in even if you dont have autoit, but nothing worked. I could use autoit, but hopefully I dont have to. Thanks for the help with it. I might use autoit. it seems like a usefuls thing.
 

My Computer My Computer

Computer Manufacturer/Model Number
Toshiba Satellite L755
OS
Windows 7 Home Premium 64bit
Memory
500 GB
Back
Top