Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: In Need a batch file command

06 Mar 2014   #1
WinJake

Windows 7 Home Premium 64bit
 
 
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.


My System SpecsSystem Spec
.
07 Mar 2014   #2
UsernameIssues

W7 Pro SP1 64bit
 
 

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 System SpecsSystem Spec
07 Mar 2014   #3
WinJake

Windows 7 Home Premium 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 System SpecsSystem Spec
.

08 Mar 2014   #4
UsernameIssues

W7 Pro SP1 64bit
 
 

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 System SpecsSystem Spec
08 Mar 2014   #5
WinJake

Windows 7 Home Premium 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 System SpecsSystem Spec
08 Mar 2014   #6
UsernameIssues

W7 Pro SP1 64bit
 
 

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 System SpecsSystem Spec
09 Mar 2014   #7
WinJake

Windows 7 Home Premium 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 System SpecsSystem Spec
09 Mar 2014   #8
UsernameIssues

W7 Pro SP1 64bit
 
 

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 System SpecsSystem Spec
09 Mar 2014   #9
WinJake

Windows 7 Home Premium 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 System SpecsSystem Spec
09 Mar 2014   #10
UsernameIssues

W7 Pro SP1 64bit
 
 

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 System SpecsSystem Spec
Reply

 In Need a batch file command




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
Problem with batch file command to edit registry
reg add HTLM\Software\Microsoft\Windows\CurrentVersion\Policies\System /v DontDisplayLastUserName /t REG_DWORD 00000001 /f I am trying to hide all users at logon and I know this is where you change it but for some odd reason the syntax is wrong and I can not figure it out. Can someone please...
Customization
How to run a batch file at logoff & some batch scripting help please
Hiya, I'd just like to run a simple batch file at logoff to backup some settings. I plan to use Robocopy, which is what i use to more thorough backups. Two questions: 1. How make it run by clicking Start > Shutdown? (i realise i could make a shutdown batch file and run it instead, but i'd...
Backup and Restore
Batch file not waiting for command to finish before moving on
Hiya, i wasn't really sure where to put this, and i have Googled it but i can't find a reason why my batch file no longer does what it used to do. According to everything i've read, my batch should stop at IE, until i close IE, whereupon it should continue. This is how it used to behave. Here it...
Software
Elevated command via batch file?
I've set up a Virtual Router as in this page, but what it doesn't tell you is that you need to re-run the elevated command netsh wlan start hostednetwork every time the computer boots or comes out of standby. Is there a way to run an elevated command via a batch file? Later ... I've just...
Network & Sharing
Batch File that grabs file names from folder to insert into batch file
Ok I'm totally at a loss on how to word this so I'm just going to write it out the best that I can... :confused: First I have a batch file that I'm writing that will convert mp4 files to mp3 files (I have a lot) for a buddies band using ffmpeg. Here's the code that I'm using: ffmpeg -i...
General Discussion
Batch File - For Command??
<This post has now been solved> Hi, Sorry if this is not the place but does anyone know how to do the following? I am trying to create a batch file to search a directory for a specified file type and list it in a text file then get the batch file to read that text file and copy all the...
General Discussion


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 17:09.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App