In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.

Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.

How to send a hotkey to an application

Xailer English public forum
Responder
Guest

How to send a hotkey to an application

Mensaje por Guest »

Can Xailer send a Hotkey, for example an Ctrl S or a Ctrl C, to an application?
Assuming that you have the window handle or title in a variable, how do you do this?
juanc
Mensajes: 105
Registrado: Vie Dic 14, 2007 12:15 am

How to send a hotkey to an application

Mensaje por juanc »

Part of the solution:
Local oShell := CreateObject( "WScript.Shell" )
//
oShell:SendKeys( "sample" )
Tested with windows xp.
"DGauss" <galois[at]nycap[dot]rr[dot]com> escribió en el mensaje
news:4ff6ea8a$[email=1@svctag-j7w3v3j....]1@svctag-j7w3v3j....[/email]
> Can Xailer send a Hotkey, for example an Ctrl S or a Ctrl C,
> to an application?
>
> Assuming that you have the window handle or title in a
> variable, how do you do this?
>
>
Guest

How to send a hotkey to an application

Mensaje por Guest »

Yeah, it looks like there's no easy way, other than to execute an
external COM.
Thanks for the Shell sample Juan, I think I'll go the AutoIt route.
Avatar de Usuario
ignacio
Site Admin
Mensajes: 9440
Registrado: Lun Abr 06, 2015 8:00 pm
Ubicación: Madrid, Spain
Contactar:

How to send a hotkey to an application

Mensaje por ignacio »

DGauss escribió el vie, 06 julio 2012 15:39Can Xailer send a Hotkey, for example an Ctrl S or a Ctrl C, to an application?
Assuming that you have the window handle or title in a variable, how do you do this?

You can use the windows API function SendMessage() to send a WM_CHAR message to a specific window (control) knowing its handle. BTW, focus should also be given (WM_SETFOCUS) prior to that.
Regards,
Ignacio Ortiz de Zúñiga
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
juanc
Mensajes: 105
Registrado: Vie Dic 14, 2007 12:15 am

How to send a hotkey to an application

Mensaje por juanc »

You can also use AutoIt like this:
Local oKey := CreateObject( "AutoItX3.Control" )
with functions oKey:Send(), oKey:WinList(), oKey:WinExist() and
oKey:WinActivate()
"DC" <NoSpamPlease@nycap.rr.com> escribió en el mensaje
news:4ff9b715$[email=1@svctag-j7w3v3j....]1@svctag-j7w3v3j....[/email]
> Yeah, it looks like there's no easy way, other than to execute an external
> COM.
>
> Thanks for the Shell sample Juan, I think I'll go the AutoIt route.
>
Guest

How to send a hotkey to an application

Mensaje por Guest »

Ah, cool. You can use SendMessage directly from an Xailer app? That's
great, thanks Ignacio.
Responder