In Need a batch file command

Page 1 of 2 12 LastLast

  1. Posts : 21
    Windows 7 Home Premium 64bit
       #1

    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 by WinJake; 07 Mar 2014 at 22:03.
      My Computer


  2. Posts : 10,485
    W7 Pro SP1 64bit
       #2

    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


  3. Posts : 21
    Windows 7 Home Premium 64bit
    Thread Starter
       #3

    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


  4. Posts : 10,485
    W7 Pro SP1 64bit
       #4

    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


  5. Posts : 21
    Windows 7 Home Premium 64bit
    Thread Starter
       #5

    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


  6. Posts : 10,485
    W7 Pro SP1 64bit
       #6

    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


  7. Posts : 21
    Windows 7 Home Premium 64bit
    Thread Starter
       #7

    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


  8. Posts : 10,485
    W7 Pro SP1 64bit
       #8

    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


  9. Posts : 21
    Windows 7 Home Premium 64bit
    Thread Starter
       #9

    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


  10. Posts : 10,485
    W7 Pro SP1 64bit
       #10

    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


 
Page 1 of 2 12 LastLast

  Related Discussions
Our Sites
Site Links
About 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 22:38.
Find Us