Example XML Configuration File

<?xml version="1.0"?>
<TaskSets>
  <TaskSet WindowsUser="HTPC">
    <LaunchApplication>
      <Path>C:\Program Files\EventGhost\EventGhost.exe</Path>
      <CommandLineArgs>-hide -file "C:\xbmc_addtl.xml"</CommandLineArgs>
    </LaunchApplication>
    <LaunchApplication>
      <Path>C:\Program Files\XBMC\XBMC.exe</Path>
    </LaunchApplication>
  </TaskSet>
  <TaskSet WindowsUser="HTPC-Admin">
    <SetRegistrySz>
      <Key>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon</Key>
      <Name>Shell</Name>
      <Value>"explorer.exe"</Value>
    </SetRegistrySz>
    <LaunchApplication>
      <Path>userinit</Path>
      <WaitForExit>True</WaitForExit>
    </LaunchApplication>
    <SetRegistrySz>
      <Key>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon</Key>
      <Name>Shell</Name>
      <Value>"C:\Xshell\Xshell.exe"</Value>
    </SetRegistrySz>
  </TaskSet>
</TaskSets>

What It Does

As a prerequisite: I have configured Windows to automatically log in to the "HTPC" account upon start-up and have set Xshell as the Windows shell. I also have an account named "HTPC-Admin" that I use to log in through remote desktop to administer the machine. I have applied a patch to the box that will let me RDP into the box without logging off the HTPC account.

The configuration above will launch EventGhost with the specified configuration file and then launch XBMC for the "HTPC" account. If I remote desktop in using my HTPC-Admin account, the script will set the shell to Explorer, restart the shell, then set the shell back to Xshell for the next load. This process is a "hack" to start explorer.exe as a shell and not a folder browser.

TaskSets, Commands, and Conditions

A TaskSet is a sequence of Commands to be executed. For example:
<TaskSet WindowsUser="WilliamS">
    <GoodbyeCruelWorld />
</TaskSet>
<TaskSet>
  <HelloWorld />
</TaskSet>

<GoodbyeCruelWorld /> and <HelloWorld /> are commands in the TaskSet. In the default Xshell implementation, multiple TaskSets can be defined in a single configuration but only one TaskSet will be executed. You can tell Xshell how to determine which TaskSet will execute by using Conditions.

In the above example, the WindowsUser="WilliamS" attribute of the TaskSet element tells Xshell to only execute this TaskSet if the currently logged in Windows User Account is WilliamS.

Last edited May 27, 2010 at 1:42 PM by wgraham, version 7

Comments

No comments yet.