Kodi Community Forum

Full Version: [RELEASE] Steam Launcher - Start Steam Big Picture Mode from within Kodi
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Sounds like the AHK script isn't being run... After running the add on is there a green H icon in the icon tray on the windows task bar? Or is SteamLaunch-AHK.exe running in task manager? You're not running xbmc in portable mode or anything like that?
Nope, there's no tray icon or SteamLaunch-AHK.exe process running. By portable do you mean a portable install? My XBMC was installed conventionally.
Does this command work for you? Run it with xbmc open and it should behave just like the addon.

Code:
cscript //B //Nologo "%AppData%\XBMC\userdata\addon_data\script.steam.launcher\scripts\LaunchHidden.vbs" "%appdata%\XBMC\userdata\addon_data\script.steam.launcher\scripts\SteamLauncher-AHK.exe" "c:\Program Files (x86)\Steam\Steam.exe" "c:\Program Files (x86)\XBMC\XBMC.exe"
(double check the before running, my win7 machine likes to place a ? into that command when copy and pasted from the forums)

Also, I noticed that because of the vb script the ahk script will fail silently if its missing a argument, re-select your paths in the addon settings, plus deleting the user-script wouldnt hurt either. Can you also post a link to you debug log (wiki) and the contents of "%appdata%\XBMC\userdata\addon_data\script.steam.launcher\scripts", that might shine some light about what is going on.
The command does work for me in a batch file (after removing the extra question mark). I reselected the paths, but no luck. What/where is the user-script I should try and delete? If that doesn't work I'll upload my logs.
Strange, that is pretty much the command that is run by the addon (only difference is paths for launchhidden.vbs and steamlaunch-ahk.exe are provided by xbmc). You can delete the scripts via the addon settings, but I doubt this will have any effect as it appears the scripts are working. Seeing as its working via a batch file, can you try v0.3.6 or v0.5.2 on the first page, they used a batch file.
Hi!! I try to launch this script under MAC OS X (Maverick).
But he doesn't work....Sad

in Linux - Steam Location I Have
/APPLICATIONS/STEAM.APP/CONTENTS/MACOS/STEAM.SH

and doesn't run.

Any tips.

I try with Advanced Launcher and it´s OK. But i want you´re script.

Thanks,,,,
Can this be set up so I do not have to actually close steam to return to XBMC, but just minimize it or something?

EDIT - I see that I can choose "Return to desktop" rather than "Exit Steam" and steam will stay open, but every time I do that XBMC opens in windowed mode. Is this due to Steam Launcher?

EDIT 2 - Seems I was able to just force XBMC to open in fullscreen mode by adding this to my advancedsettigns.xml file.

<advancedsettings>
<fullscreen>true</fullscreen>
</advancedsettings>

Cool beans.
OK. Now I'm just being a pest. The more I play with this addon, the more questions I have. I was wondering if you could make it optional to shut down XBMC when launching Steam. This would come in very handy if someone sends me a message while I am watching a movie, or if I want to use the Web Browser while listening to music.
(2014-02-04, 17:16)Jamyz Wrote: [ -> ]Hi!! I try to launch this script under MAC OS X (Maverick).
But he doesn't work....Sad

in Linux - Steam Location I Have
/APPLICATIONS/STEAM.APP/CONTENTS/MACOS/STEAM.SH

and doesn't run.

Any tips.

I try with Advanced Launcher and it´s OK. But i want you´re script.

Thanks,,,,

I thought that would be the case, early versions would run on osx but I didnt think new ones would. Can you open steam-launch.sh (located in xbmc/userdata/addon_data/script.steam.launcher/scripts/ in the xbmc userdata directory)in a text editor and delete its contents and paste in the following:

Code:
#!/bin/bash
# App Launch script - Quit XBMC to launch another program
# Thanks to rodalpho @ # http://xbmc.org/forum/showthread.php?t=34635
# By Redsandro     2008-07-07
# By ryosaeba87    2010-08-24 (Added support for MacOSX)
#



case "$(uname -s)" in
    Darwin)
        XBMC_PID=$(ps -A | grep XBMC.app | grep -v Helper | grep -v grep | awk '{print $1}')
        XBMC_BIN=$(ps -A | grep XBMC.app | grep -v Helper | grep -v grep | awk '{print $5}')
                STEAM_PID=$(ps -A | grep STEAM.app | grep -v Helper | grep -v grep | awk '{print $1}')
                STEAM_BIN=$(ps -A | grep STEAM.app | grep -v Helper | grep -v grep | awk '{print $5}')
        ;;
    Linux)
        XBMC_PID=$(pidof xbmc.bin)
        XBMC_BIN="xbmc"
                STEAM_BIN="steam"
                STEAM_PID=$(pidof steam)
        ;;    
    *)
        echo "I don't support this OS!"
        exit 1
        ;;
esac

#Kill XBMC
    kill -9 $XBMC_PID #There are better ways of doing this but this is the most consistent
    echo "Shutdown XBMC"
    
# Is Steam running?
if [ $STEAM_PID ]
then
        $STEAM_BIN steam://open/bigpicture #steam is brought to focus better this way
        echo "Steam already running"
else
    $STEAM_BIN -bigpicture #steam opens better like this if not already open
    echo "Steam not running, launching"
fi

# Wait for Steam to exit
while [ $(ps -A | grep STEAM.app | grep -v Helper | grep -v grep | awk '{print $1}') ]; do #STEAM_PID variable doesnt work here, needs work
    echo "Steam running"
    sleep 1
done

#Restart XBMC
$XBMC_BIN &

Make the script executable via the addon's settings before running. This version will only restart xbmc when you completely quit steam. I dont have a mac so I cant test or improve the mac version myself, if you can get me a script that mimics the windows/linux versions I could try integrating it into the addon.

(2014-02-04, 20:32)dkplayaclub Wrote: [ -> ]OK. Now I'm just being a pest. The more I play with this addon, the more questions I have. I was wondering if you could make it optional to shut down XBMC when launching Steam. This would come in very handy if someone sends me a message while I am watching a movie, or if I want to use the Web Browser while listening to music.

Yeah good point. Here is a test ahk script which minimizes/maximizes xbmc instead of killing/restarting it. Copy it over the exisiting file in "%AppData%\XBMC\userdata\addon_data\script.steam.launcher\scripts\". You also need to comment out/delete line 114 in default.py. Its working well here, let me know how it goes.

https://dl.dropboxusercontent.com/u/2241...er-AHK.exe
I replaced the SteamLauncher-AHK.exe you linked and deleted line 114 in the default.py : addon.setSetting(id="MakeShExec", value="false")
the code then looked like this :

Code:
if makeShExec == 'true':
subprocess.Popen(precmd+" "+"\""+cmd+"\""+" "+"\""+steamWin+"\""+" "+"\""+xbmcWin+"\"", shell=True)
xbmc.executebuiltin( "ActivateWindow(busydialog)" )

I then tried to run Steam Launcher from within XBMC and got an error. This is the only error in the log file. Rather than post the whole thing I will just offer you this excerpt. Hope it helps.

Code:
11:15:16 T:3492   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.IndentationError'>
                                            Error Contents: ('expected an indented block', ('C:\\Users\\DK\\AppData\\Roaming\\XBMC\\addons\\script.steam.launcher\\default.py', 114, 12, '\t\tsubprocess.Popen(precmd+" "+"\\""+cmd+"\\""+" "+"\\""+steamWin+"\\""+" "+"\\""+xbmcWin+"\\"", shell=True)\n'))
                                            IndentationError: ('expected an indented block', ('C:\\Users\\DK\\AppData\\Roaming\\XBMC\\addons\\script.steam.launcher\\default.py', 114, 12, '\t\tsubprocess.Popen(precmd+" "+"\\""+cmd+"\\""+" "+"\\""+steamWin+"\\""+" "+"\\""+xbmcWin+"\\"", shell=True)\n'))

Did I do something wrong, or misunderstand your instructions?
I noticed that I had an indent error so I tried again, making the LaunchSteam function look like this, which I think is better :

Code:
def launchSteam():
    basePath = os.path.join(util.getAddonDataPath(), 'scripts')
    if os.name == 'nt':
        precmd = os.path.join('cscript //B //Nologo', basePath, 'LaunchHidden.vbs')
        cmd = os.path.join(basePath, 'SteamLauncher-AHK.exe')
        if makeShExec == 'true':
            subprocess.Popen(precmd+" "+"\""+cmd+"\""+" "+"\""+steamWin+"\""+" "+"\""+xbmcWin+"\"", shell=True)
            xbmc.executebuiltin( "ActivateWindow(busydialog)" )
    else:
        cmd = os.path.join(basePath, 'steam-launch.sh')
        if makeShExec == 'true':
            os.chmod(cmd, stat.S_IRWXU)
            addon.setSetting(id="MakeShExec", value="false")
        subprocess.Popen(cmd+" "+"\""+steamLinux+"\""+" "+"\""+xbmcLinux+"\"", shell=True)
        xbmc.executebuiltin( "ActivateWindow(busydialog)" )

Now I just get no response when clicking on SteamLauncher. No error, no loading, nothing. Also, no errors in log file. Odd.
The line you need to comment out/delete is

xbmc.executebuiltin( "ActivateWindow(busydialog)" )
OK. That was line 116 for me, opening default.py in notepad++.

Tested it a few times and it seems to work really nicely. Thank you.

In future versions, it would probably be best to add an option "Close XBMC on launch" with the options "Yes", "No" and "Ask each time". This way, every user can configure it exactly the way they like.

Thanks again. This script will get a LOT of use on my HTPCs. Going to test on my Ouya now, Fingers crossed. Smile
New test version, 0.9.6

Quote:Cleaned up addon + updated script files for linux + windows.
Readded macosx code.
Option to minimize xbmc instead of exiting it, this is set via addon settings. Yes, no and ask are available.
Checks if files steam/xbmc locations exist and/or steam-launch.sh is execuatable, If not a yes/no dialog appears which can take you to the settings.
Configurable timeout for 'Busy Dialog".


You need to delete and update the scripts via addon settings.
Thanks very much for this Teeedubb! I've been wanting to try Steam on my HTPC for a while now but I've been waiting until I wiped and re-installed Ubuntu 13.10 and a fresh copy of XBMC. Well, did that last night so I'll be giving this a go soon.

Now that Steam Live can stream many, many Windows games to a linux PC with pretty basic hardware requirements, your addon will probably be surging in popularity soon! Users have been reported overall success with it and I just got my beta invite a few days ago, so I can't wait to see how it works.