Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Batch Running Programs  (Read 561 times)

dennislp3

  • Bay Watcher
    • View Profile
Batch Running Programs
« on: November 06, 2010, 02:47:19 pm »

Is there a way to start dwarf fortress, soundsense, and dwarf therapist at the same time with one icon?


http://www.technixupdate.com/single-shortcut-to-launch-multiple-programs/

I follow the instructions below to make a bat file but it doesnt work right....DF pulls up errors about finding files and dwarf therapist just opens and closes...I assume soundsense does the same
« Last Edit: November 06, 2010, 04:32:23 pm by dennislp3 »
Logged

0x517A5D

  • Bay Watcher
  • Hex Editor‬‬
    • View Profile
Re: Batch Running Programs
« Reply #1 on: November 07, 2010, 01:21:18 am »

I follow the instructions below to make a bat file but it doesnt work right....DF pulls up errors about finding files and dwarf therapist just opens and closes...I assume soundsense does the same

The problem is likely that DF isn't fully up and running by the time the tools go looking for it.  DF takes several seconds before it creates its main window.  One common technique to find the DF process is by looking for its window name and class.

Standard batchfile language doesn't have anything that can help.  It's well over twenty years old and was built for the mindset where there's only one program running at a time, and the batchfile runs each program in sequence.

It looks like that Utility Launcher tool you posted can't do it either.

You could use a more advanced language like Windows PowerShell, JPSoft's Take Command, or the Cygwin port of the bash shell, or you could just live with the inconvenience.

Here's (parts of) the Take Command batchfile that I use.  Note the loop that idles until DF is up and running, based on the fact that there is a window named "Dwarf Fortress".

Code: [Select]
@echo off
start /POS=-4,-13,0,0 /pgm "Dwarf Fortress.exe"
:wait
set Q=%@winexename[Dwarf Fortress]
if "%Q" eq "" ( echo Waiting & delay /m 250 & goto wait )
start /wait /pgm ..\utils\stone_sense\stone_sense.exe -q
Logged