Author Topic: Can AltBinz be run / managed from command line ?  (Read 2696 times)

Offline necrocowboy

  • Contributor
  • ***
  • Posts: 62
Can AltBinz be run / managed from command line ?
« on: July 13, 2007, 06:44:45 pm »
Hi

Can I use command line codes to control what the app is doing ?  For example, if I'm downloading and want to play an online game (BF2142), I could write a scipt to pause altbinz, start game, restart afterwards;

....altbinz /pause
....BF2142.exe
....altbinz /resume

I know that I can kill the task & restart afterward but wanted a more elegant method.

Thanks

NC

Offline Hecks

  • Contributor
  • ***
  • Posts: 2011
  • naughty cop
Can AltBinz be run / managed from command line ?
« Reply #1 on: July 14, 2007, 01:16:47 am »
For what you want, the short answer is no.  But there's another way of doing the same thing using the altbinz_status.xml file, if you're able to do a bit of scripting.  See here:

http://www.altbinz.com/forum/viewtopic.php?t=664

That's very easy to do with Python, Ruby, Powershell, etc, otherwise you need a VB script.  This is how it might work in Powershell, for example:

Code: [Select]

function Toggle-AltbinzConnect
{
   $abstatusxml = "C:\Program Files\Altbinz\altbinz_status.xml"
   $abstat = [xml](get-content $abstatusxml)
   if ($abstat.altbinz.connect -match "false") {
      $abstat.altbinz.connect = "true"
   }
   else {
      $abstat.altbinz.connect = "false"
   }
   $abstat.save($abstatusxml)
}

Toggle-AltbinzConnect
$p = [Diagnostics.Process]::Start("C:\Program Files\BF2142\BF2142.exe")
$p.WaitForExit()
Toggle-AltbinzConnect



-Hecks

Offline necrocowboy

  • Contributor
  • ***
  • Posts: 62
Can AltBinz be run / managed from command line ?
« Reply #2 on: August 01, 2007, 07:37:14 pm »
Hi all - found a solution.

Using a command line process tool (available here http://www.beyondlogic.org/solutions/processutil/processutil.htm you can suspend / resume an application / service as required.

So for me, my script to start BF2142 now has the following lines;

...process -s altbinz.exe
...BF2142.exe
...process -r altbinz.exe

Works very well as long as you don't suspend twice (needs 2 resumes).  Can also be used to set processor priority / affinity from command line when starting an app.

I like this tool.

NC