Jump to content
Sign in to follow this  
mrboring

ControlSend not working when window has focus

Recommended Posts

mrboring

Hi All

I wish to load a Pandora mini player (basically http://www.pandora.com/?cmd=mini is a small popup player) into an IE control. I want a HotKey (Ctrl + Win + Space) to toggle Pause/Play. The following script works as expected as long as the window does NOT have focus. If the window has focus the ControlSend does not get to the Flash player.

The following script has been tested on Vista Business 32 and XP Pro. Any ideas what I might be doing wrong?

#include <GUIConstants.au3>
#include <INet.au3>
#include <IE.au3>

Opt("GUIEventOptions",1)
Opt("GUIOnEventMode", 1)
Opt("SendKeyDelay", 400)

$Form1 = GUICreate("TestProg", 728, 360)
GUISetState(@SW_SHOW)

HotKeySet( "^#{space}", "play" )

_IEErrorHandlerRegister ()
$oIE = _IECreateEmbedded ()
$GUIActiveX = GUICtrlCreateObj($oIE,0,0,728,360)
_IENavigate ($oIE, "http://www.pandora.com/?cmd=mini")

While 1
    Sleep(10)
WEnd

Func play()
    ControlSend($Form1, "", "[CLASS:MacromediaFlashPlayerActiveX; INSTANCE:2]", "{space}")
EndFunc

Thanks in advance.

mrboring

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.