Jump to content

Enter Key stroke


Erbl
 Share

Recommended Posts

Hi all!

Kinda new to all this.

I have virtual PC and am trying to write a file that will open virtual PC and then hit the start button (Already selected) once the splash screen has gone.

My aim is to be able to click just one icon and have it open and run my saved state VPC....

here is the code I'm using

@echo off
CD "C:\Program Files\Microsoft Virtual PC"
"Virtual PC.exe"
WinWaitActive("Virtual PC", "Virtual PC Console")
ControlSend("Virtual PC Console", "", $controlID,  "{Enter}")
exit

All this does is open VPC and that's it!

Please help!

Link to comment
Share on other sites

Well....... lol

Wrote it in batch first, then moved to Autoit when I couldn't get batch to do it! lol!

I guess I want it written in Autoit really....

It seams to me...

that you either are waiting for the wrong window to be active,

or you are trying to send the ENTER key to the wrong window...

But if your window is Titled: Virtual PC Console, Then use this...

RunWait("C:\Program Files\Microsoft Virtual PC\Virtual PC.exe", "C:\Program Files\Microsoft Virtual PC")
WinWaitActive("Virtual PC Console")
ControlSend("Virtual PC Console", "", $controlID,  "{Enter}")

Otherwise use this if your window name is: Virtual PC

RunWait("C:\Program Files\Microsoft Virtual PC\Virtual PC.exe", "C:\Program Files\Microsoft Virtual PC")
WinWaitActive("Virtual PC")
ControlSend("Virtual PC", "", $controlID,  "{Enter}")

Hope this is helping...

Link to comment
Share on other sites

OK! So it was just TO easy!

Feel like a total N00B! (which I am!)

Code was simple when I thought about it and started from scratch....

Run ("C:\Program Files\Microsoft Virtual PC\Virtual PC.exe")
WinWaitActive("Virtual PC Console")
Send("{ENTER}")
Link to comment
Share on other sites

Incase you are interested in the way to use Controls to make this happen:

Run("C:\Program Files\Microsoft Virtual PC\Virtual PC.exe", "C:\Program Files\Microsoft Virtual PC")
WinWaitActive("Virtual PC Console")
Do
    Sleep(9)
Until ControlCommand("Virtual PC Console", "", "Button2", "IsEnabled", "")
ControlSend("Virtual PC Console", "", "Button2", "{Enter}")
"Button2" is the start button, which is not enabled right away.

If you get into more complicated VM needs, VirtualBox has a GUI interface kind of like the MS VPC and it has a command line exe that can start a VM with lots of options.

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

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