Jump to content
Sign in to follow this  
punchcard

Selecting vSphere Client Console window for input

Recommended Posts

punchcard

I have been trying to consistancely select the actual input part of the Vsphere client console window (vmware).  Some times it works flawlessly, and activaties the window, then insert the OS build string. The some time is will that the string I am trying to pass to the console and randomly select button (like power down, cd, floppie.....)

I have tried to using the "Class" of MKSEmbedded (see image), but have had no luck selecting by class.

I figure I am not correctly address the area of the window I want to pass the information to.

Anyone have suggestion?

================ code example =============

Opt("WinTitleMatchMode", -4)

Global $sWinTitle = $cServer, $hWin
$hWin = WinGetHandle($sWinTitle, "")

WinActivate ($hWin)
WinWaitActive($hWin)

Send("{CTRLDOWN}g{CTRLUP}")
MouseClick("left",0)
Sleep(1000)

Send( $sndstring)
Send("{ENTER}")

Sleep (3000)

Send("{CTRLDOWN}{ALTDOWN}{ALTUP}{CTRLUP}")

====================================================

vmware_info.jpg

Edited by punchcard

Regards,

Mike D

Share this post


Link to post
Share on other sites
punchcard

Here is the code I ended up using, it seems to select the console window correctly now each time.

This is for RHEL build process, so it is handy in a Satellite or Spacewalk build.

;
;  Here is the GUTS of selecting the correct window in VMware Console
;  "WindowsForms10.Window.8.app.0.ef627a"
;  CLASS:MKSEmbedded; INSTANCE:1"
Opt("WinTitleMatchMode", -4)
opt("MouseCoordMode",2)

$retWin = WinGetHandle($cServer)
$ctrlHandle = ControlGetHandle($retWin, "", "[Class:MKSEmbedded]")
$xy = ControlGetPos($retWin, "", $ctrlHandle)
$xpos = $xy[0] + ($xy[2] / 2 )
$ypos = $xy[1] + ($xy[3] / 2 ) 
WinActivate($retWin) 
MouseClick("primary", $xpos, $xpos, 1, 0)

Send("{CTRLDOWN}g{CTRLUP}") 
MouseClick("left",0)
Sleep(1000)

Send( $sndstring)
Send("{ENTER}")

Sleep (3000)

Send("{CTRLDOWN}{ALTDOWN}{ALTUP}{CTRLUP}")

Regards,

Mike D

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  

×