Jump to content
Sign in to follow this  
Erbl

Enter Key stroke

Recommended Posts

Erbl

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!

Share this post


Link to post
Share on other sites
monoceres

So, what language are you using? Autoit or batch?


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites
Erbl

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....

Share this post


Link to post
Share on other sites
APPLEEATER

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...

Share this post


Link to post
Share on other sites
Erbl

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}")

Share this post


Link to post
Share on other sites
herewasplato

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]

Share this post


Link to post
Share on other sites
Erbl

Thanks Herewas!

Will have a look at VirtualBox... Just about to have a play with VMware first...

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.