Flightdeck Solutions Forum Index Flightdeck Solutions
Technical Support Forum
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Auto-Launching flight-sim programs:

 
Post new topic   Reply to topic    Flightdeck Solutions Forum Index -> FDS Support
View previous topic :: View next topic  
Author Message
timh



Joined: 16 Mar 2005
Posts: 32

PostPosted: Mon Apr 25, 2005 11:07 pm    Post subject: Auto-Launching flight-sim programs: Reply with quote

Although this is a hardware forum, the software interface side of things is
integrally related, so I believe this is a helpful place to put this. I received a question regarding autostarting of flight-sim realted apps, so here's my response for the benefit of all:

Just about every flight simmer requires the ability to have multiple applications open automatically on startup and in a particular order - either on a MSFS server or client PC. You can do this two ways - the first way everybody knows:

1)Place shortcuts into "C:\Documents and Settings\<userName>\Start
Menu\Programs\Startup" and have them open automatically in alphabetical order.

but there's a second way that is just as easy and gives you far more control:
2)Create a batch file (.bat)!

A .bat file is just a text file that tells windows what to do line by line. Don't be put off thinking this is too technical or for programmers only - it really isn't - for builders with full decks and multiple client PCs, I imagine this will be a necessity. For flightsim purposes, we just need one to launch programs in a particular order, and in some cases pause for a bit inbetween. Here's how do exactly this:

First, create a new text file - lets put it in C:\temp\ and name it something like "simLaunch.bat" - ignore window's warning about changing the file extension - no danger at all.
There are just three 'commands' that we need for our purposes - they are:
'echo' - outputs a message
'start' - launches a program and keeps going
'call' - launches a program and waits until it's closed before continuing

Although there are a dozen or so different commands, we only need these for our purposes.
Right-click on your new bat file and click 'Edit' - this will open the file using 'notepad'. Now simply enter a line for each thing you want the batch file to do by entering the 'command' followed by a space followed by the 'parameter'. In the case of 'echo', the parameter will be the message you want to output, and in the case of 'start' the parameter will be the path to the program. Easy! Here's an example:

echo starting wideClient
start C:\wideFS\wideClient.exe
echo starting PMSystems
start C:\pmSystems\pmsystems.exe
echo starting MCP
start C:\MCP\mcp.exe

Make your own to open some programs you have and give it a test now by just double-clicking the bat file. The bat will execute in a command prompt, and then close automatically once finish.

All fine and good - everything executes immediately with no delay, but what if we want to pause and wait for a bit before opening the next program? An example of the need for this might be if we wanted to make sure that PMSystems was the last application to open, thus making it the application with 'focus' and the recipient of subsiquent keystrokes (from an encoder or keyboard). There is a simple program called 'sleep.exe' which you can get here:
[href]http://www.computerhope.com/download/utility/sleep.exe[/href]

Download it (5kb) and put in your C:\windows directory. The sleep.exe program takes a parameter that specifies how many seconds to 'sleep' for before closing itself - perfect for our needs. Now you recall that the 'call' command waits until the program has finished before continuing to the next line in the batch file, so with that in mind, we can 'call' the sleep program followed by the number of seconds to wait, effectively 'pausing' the batch file while the other programs load. So:
call C:\windows\sleep.exe 45
will put a 45 second pause into the batch file. Now here's an expansion on the first example using sleep:

echo starting wideClient
start C:\wideFS\wideClient.exe
echo sleeping for 5 seconds
call C:\windows\sleep.exe 5
echo starting PMSystems
start C:\pmSystems\pmsystems.exe
echo sleeping for 10 seconds
call C:|windows\sleep.exe 10
echo starting MCP
start C:\MCP\mcp.exe

Finally, once you have your batch file operating as you require, just drop a shortcut to it (or even the .bat file itself if you want) into your "C:\Documents and Settings\<userName>\Start Menu\Programs\Startup" and there you have it!

They can be even better - I have been able to create a bat file that open seven flight sim realted apps on my flight-sim server, in a particular order, over a period of three minutes (waiting for MSFS to open etc.) and call a truVoice.exe to have an artificial voice speak what it is about to do and wish me a good flight when it is finished - all with a single double-click - you get the picture. If you'd like to find out more just google batch files - there's a lot of imfo out there.

I hope this helps some of you. If you have any further questions I'm more than happy

to help.

-Timh
Back to top
View user's profile Send private message
sbecker777



Joined: 09 Jun 2004
Posts: 76
Location: San Diego, USA

PostPosted: Tue Apr 26, 2005 12:37 am    Post subject: Reply with quote

Tim,
thanks for the great tip! I forgot all about batch files!

Steve
Back to top
View user's profile Send private message
bwr014



Joined: 10 Mar 2004
Posts: 1064
Location: Netherlands

PostPosted: Tue Apr 26, 2005 1:02 am    Post subject: Reply with quote

Just a note...

Isnt this all standard in Widefs under the RUN command ect?

gr.

Frans M
_________________
Frans M
www.airbus320.nl
Back to top
View user's profile Send private message Send e-mail Visit poster's website
timh



Joined: 16 Mar 2005
Posts: 32

PostPosted: Tue Apr 26, 2005 3:47 am    Post subject: Reply with quote

Quote:
Isnt this all standard in Widefs under the RUN command ect


OK, I wasn't even aware of a RUN command under wideFS - sounds even easier - Thanks Frans.
Back to top
View user's profile Send private message
bwr014



Joined: 10 Mar 2004
Posts: 1064
Location: Netherlands

PostPosted: Tue Apr 26, 2005 4:04 am    Post subject: Reply with quote

Hi Tim,

Dont want to say that your batch files will not work but maybe this is much easer....

You can use the RUN ect. option in Widefs or you can downlaod a freeware prog at the same site where Widefs/FSUIPC can be downloaded that is called FSUIPCRunOption.zip here are also other handy small progs for the FS that can be used Smile

Or direct link here...
http://www.schiratti.com/files/dowson/FSUIPCRunOptions.zip

Lot of info about Run/close ect can be found in the Forum there as well.

gr.

Frans M
_________________
Frans M
www.airbus320.nl
Back to top
View user's profile Send private message Send e-mail Visit poster's website
warvet



Joined: 15 May 2004
Posts: 1298

PostPosted: Tue Apr 26, 2005 5:03 am    Post subject: Reply with quote

ty Frans,
Very Happy


Tim
A340
Canada
Back to top
View user's profile Send private message Send e-mail
dnoize



Joined: 04 Aug 2004
Posts: 643
Location: Netherlands

PostPosted: Tue Apr 26, 2005 5:28 pm    Post subject: Reply with quote

and dont forget the RunReady function wich makes WideFS wait for flightsimulator to start before WideFS launches the PM programs.
(to be more precise, WideClient will wait for PM to start till its connected to WideServer, ie will wait till FS is booted up)

Stef
_________________
www.boeing737ng.com - the 737 simulator project
Back to top
View user's profile Send private message Visit poster's website
DeMuth-Olsen



Joined: 28 Dec 2003
Posts: 290
Location: Colorado Springs, CO. USA

PostPosted: Tue Apr 26, 2005 9:57 pm    Post subject: Reply with quote

timh wrote:
Quote:
Isnt this all standard in Widefs under the RUN command ect


OK, I wasn't even aware of a RUN command under wideFS - sounds even easier - Thanks Frans.


Tim,
I think you opened pandora's box of resourceful information. Laughing
_________________
Best regards,
Chad C. DeMuth-Olsen
737NG Cockpit Builder/Pilot
www.sim737.com
Back to top
View user's profile Send private message Visit poster's website
timh



Joined: 16 Mar 2005
Posts: 32

PostPosted: Tue Apr 26, 2005 10:23 pm    Post subject: Reply with quote

and here was I being a 'know it all' Very Happy
The 'waiting for MSFS to load' function is exactly what I require for my PC running PM GA gauges - my batch file was just waiting two minutes, but load times can really vary depending on location etc, so this solves the problem.
Back to top
View user's profile Send private message
dnoize



Joined: 04 Aug 2004
Posts: 643
Location: Netherlands

PostPosted: Wed Apr 27, 2005 8:53 am    Post subject: Reply with quote

glad we could help Smile
_________________
www.boeing737ng.com - the 737 simulator project
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Flightdeck Solutions Forum Index -> FDS Support All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group