Solved auto hotkey XBMC stealing focus
#1
Hello. Im not completely new to programming languages. I can compose HTML and CSS in my sleep.
However, I seem to be having issues figuring out exactly how to execute my desired outcome using auto hotkey.

My current project is to create a simple script to activate a minimized firefox window (if it exists), otherwise, launch firefox.

I've got the script compiled to an exe so that XBMC's Launcher program can launch it.
The file is located in D:/ahk/launchffx.exe (the script is in there as well "launchffx.ahk")

Here's my current script:
Code:
IFWINEXIST ahk_class MozillaWindowClass
{
WINACTIVATE
}
ELSE
{
RUN "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
WINWAIT ahk_class MozillaWindowClass
WINACTIVATE
}

What ends up happening is this: If the window doesn't exist, firefox is launched. If the window exists, it is activated.

BUT ONLY FOR A SECOND BEFORE XBMC RECLAIMS THE FOCUS! WTF?!

not sure if this is important, but Im using Windows 7 with XBMC 11.0 in Fullscreen Window mode
Reply
#2
BUMP

Someone please give me a hand, I know some of you are also using autohotkey to help automate your XBMC setups, throw me a bone
Reply
#3
I tried your code on my system using Advanced Launcher and it works just fine. Firefox remains in focus and xbmc is in the background. You can add code to hide the xbmc window when firefox runs and resume again when firefox is closed.
Reply
#4
^thanks for the tip
Reply
#5
Heres the final code, if anyone wants to use it.

Code:
IFWINEXIST ahk_class MozillaWindowClass
{
    WINACTIVATE
}
ELSE
{
    RUN "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
    WINWAIT ahk_class MozillaWindowClass
    WINACTIVATE
}
IFWINEXIST XBMC
{
    WINMINIMIZE
}
WINWAITCLOSE ahk_class MozillaWindowClass
{
    WINRESTORE XBMC
}
Reply

Logout Mark Read Team Forum Stats Members Help
auto hotkey XBMC stealing focus0