Forum virtualnega letalstva Slovenije

Klub virtualnega letalstva Slovenije
Danes je 28 Mar 2024, 11:18

Vsi časi so UTC + 1 ura [ DST ]




Napiši novo temo Odgovori na temo  [ 4 prispevkov ] 
Avtor Sporočilo
OdgovorObjavljeno: 28 Apr 2005, 13:49 
Odsoten
Administrator
Uporabniški avatar

Pridružen: 16 Mar 2003, 15:56
Prispevkov: 3956
Kraj: Cerklje na Gorenjskem, Slovenija
Tema je v originalu tukaj:
http://www.flightdecksolutions.com/forum/viewtopic.php?t=1099
========================================

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:

  • 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:
  • 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:
Koda:
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:
http://www.computerhope.com/download/utility/sleep.exe

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:
Koda:
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:
Koda:
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

_________________
Goran Brumen


Na vrh
 Profil  
 
 Naslov prispevka:
OdgovorObjavljeno: 28 Apr 2005, 13:51 
Odsoten
Administrator
Uporabniški avatar

Pridružen: 16 Mar 2003, 15:56
Prispevkov: 3956
Kraj: Cerklje na Gorenjskem, Slovenija
Frans napisal/-a:
Just a note...

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

gr.

Frans M
_________________
Frans M
http://www.airbus320.nl

_________________
Goran Brumen


Na vrh
 Profil  
 
 Naslov prispevka:
OdgovorObjavljeno: 28 Apr 2005, 13:55 
Odsoten
Administrator
Uporabniški avatar

Pridružen: 16 Mar 2003, 15:56
Prispevkov: 3956
Kraj: Cerklje na Gorenjskem, Slovenija
Frans napisal/-a:
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

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
http://www.airbus320.nl

_________________
Goran Brumen


Na vrh
 Profil  
 
 Naslov prispevka:
OdgovorObjavljeno: 28 Apr 2005, 13:55 
Odsoten
Administrator
Uporabniški avatar

Pridružen: 16 Mar 2003, 15:56
Prispevkov: 3956
Kraj: Cerklje na Gorenjskem, Slovenija
dnoize napisal/-a:
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
_________________
http://www.boeing737ng.com - the 737 simulator project

_________________
Goran Brumen


Na vrh
 Profil  
 
Prikaži prispevke prejšnjih:  Razvrsti po  
Napiši novo temo Odgovori na temo  [ 4 prispevkov ] 

Vsi časi so UTC + 1 ura [ DST ]


Kdo je na strani

Po forumu brska: 0 registriranih uporabnikov in 1 gost


Ne morete pisati prispevkov v temi
Ne morete odgovarjati na teme v forumu
Ne morete urejati prispevkov v temi
Ne morete brisati vaših prispevkov forumu
Ne morete dodati priponk prispevkom

Išči za:
Pojdi na:  
cron
Powered by phpBB® Forum Software © phpBB Group