| View previous topic :: View next topic |
| Author |
Message |
Vyath Guest
|
Posted: Tue Dec 05, 2006 12:27 pm Post subject: Sending keys to a flash object within a website? |
|
|
Hey,
I'm an avid user of the music site http://www.pandora.com, and they have a flash player that is used to playback content. As I usually listen to this at work, and frequently need to pause when interrupted, I thought about having a hotkey to pause playing when the site is open. All I have to do is to send {Space} to the flash activeX object within the browser page, but so far I haven't really succeeded in doing that.
I've been going at it for a few hours, trying to figure out how to do this while using all sorts of different class handlers but none seems to work. Does anyone have an idea? |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 3626 Location: Belgrade
|
Posted: Tue Dec 05, 2006 1:17 pm Post subject: |
|
|
You will probably have to use javascript to achieve that.
You can also see if there is any interface to the mentioned player. Flesh allows to accept driving via java scripting witch is often used on web pages do redirect HTML input to Flash movie. If such mechanism is implementd, for instance via some form of play, pause etc.. commands using js functions, you can easily achieve that.
Some thought is floating in my head that you might be able to control flash from js even if flash was not designed for such thing.... you will have to examine javascript and Flash communication. Google a little. _________________
 |
|
| Back to top |
|
 |
Vyath Guest
|
Posted: Tue Dec 05, 2006 3:29 pm Post subject: |
|
|
| It doesn't make any sense - after all, if the window is focused when the space space key is pressed in the browser, the flash componenet receives the action. So how hard can it be to send a key to the browser window? |
|
| Back to top |
|
 |
JSLover
Joined: 20 Dec 2004 Posts: 542 Location: LooseChange911.com... the WTC attacks were done by the US Gov't... the official story is a lie...
|
Posted: Tue Dec 05, 2006 7:19 pm Post subject: Re: Sending keys to a flash object within a website? |
|
|
To send any keys to flash...even for real...you need to click on the flash somewhere to focus it...which would mean your pause button would need to...switch to the browser window, click in a non-hyperlinked spot on the flash...then press space...if you can scroll the flash out of the viewable browser window...then that is another problem...the script would have a hard time clicking/finding it...so any solution wouldn't be perfect...but it should be doable... _________________
Home • Click image! • Blog |
|
| Back to top |
|
 |
Vyath Guest
|
Posted: Wed Dec 06, 2006 8:12 am Post subject: |
|
|
| A solution I found was to active the right window and to use {click} at the right coordinates to catch the button. However I'd like to switch back to the window I was working on before firing the script, how do I go about doing that? |
|
| Back to top |
|
 |
Vyath Guest
|
Posted: Wed Dec 06, 2006 8:30 am Post subject: |
|
|
Alright, here is the functional working script for pandora use. Please note that the coordinates are set according to my system specs and with Firefox - you might need to change yours accordingly:
| Code: |
IfWinExist, Pandora
{
WinGetActiveTitle, WorkingWin
WinActivate
Send {Click 500, 410}
SetKeyDelay, 100
SendEvent {Space}
WinActivate, %WorkingWin%
}
|
|
|
| Back to top |
|
 |
|