Jump to content

[Question] - Sendkey type command from .bat


Recommended Posts


Posted

You could try learning AutoIt. It can handle all the stuff that you can do in batch files, as well as press buttons for you.

Posted

Yeah. I have a friend who could make the auto it script in a minute or two. The .bat script I use so far makes about 20 or so changes and is all done with .bat commands and a .reg or two, I am trying to do all I want with as near to built in Windows componets as possible. Auto it may be my "out" but I am going to keep looking for a while. Thanks.

Straytoasters

Posted

What i do is the following. I create my bat file and also a WSF file in which i have my VB code

An example is the following, i use it to install clonedvd. It is the complete script and simply sends the ALT-N combination to the program.

<Job id="keystrokes">

<script language="VBScript">

Set objShell = WScript.CreateObject("WScript.Shell")

objShell.run("SetupCloneDVD2.exe /S")

WScript.Sleep 16000

objShell.AppActivate "CloneDVD2 Setup"

WScript.Sleep 100

objShell.SendKeys "%(N)"

</script>

</Job>

I have this file named as keystrokes.wsf and call it from my bat file using
cscript keystrokes.wsf

I hope this helps :)

Posted
Yeah. I have a friend who could make the auto it script in a minute or two. The .bat script I use so far makes about 20 or so changes and is all done with .bat commands and a .reg or two, I am trying to do all I want with as near to built in Windows componets as possible. Auto it may be my "out" but I am going to keep looking for a while. Thanks.

Straytoasters

You can compile the AutoIt script into an executable. This keeps you from having to install AutoIt on machines just to run the scripts. This is how I do my unattended installs where key presses are required. You can even have it disable the keyboard/mouse while it's running so that nothing interferes with the keys you send.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...