Archived

This topic is now archived and is closed to further replies.

martinlest2

Any vbs/programming gurus here?

Recommended Posts

Hi. For reasons I won't bore you with, I am trying to run Pete Dowson's makerunways programme as part of a batch script programme. It is activated by this vbs script:

 

   intAnswer = _

    Msgbox("           Do you want to run MakeRunways?", _

        vbYesNo, " ")

 

If intAnswer = vbYes Then

 

WScript.Sleep 2000

Dim objShell

Set objShell = WScript.CreateObject( "WScript.Shell" )

objShell.Run("""D:\FS9\MakeRwys.exe""")

Set objShell = Nothing

 

Else    

 

End If

 

This starts the programme up just fine, but for some strange reason, it stops (not hangs - says it is finished) after locating only 46 runways in my entire FS9 setup! If I run it from the file itself the programme finds 30000, or whatever.

 

Why would the programme, once started, show these differences, depending on whether I start it directly, or via a script?

 

Thanks,

 

Martin

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

I'm not sure why you have included either the sleep command or the double set of quotes on the run command. Both should be harmless, but maybe they are messing up the script compiler. If there were embedded blanks in the path, then you would need three quotes on either side of the string. With no embedded blanks, one quote on either end works.

 

The only other thing that I can think of is that by scripting, somehow, you are "starting off" in the wrong folder and this is causing trouble.

Share this post


Link to post
Share on other sites

I can try changing the quotes, but this format works in every other vbs script I use. The sleep command is not essential but makes the whole batch file, of which this vbs script is part, more 'user friendly'.

 

What is odd to me is that the programme starts up, as I imagined, but stops says it is done after finding just 46 airports. No txt, csv or xml files are created either, so something is very wrong.

Share this post


Link to post
Share on other sites

As you say, the script is for some reason starting off in the 'wrong' folder: placing the vbs file in the FS9 main folder (where the makerwys.exe file is) solves the problem.

Share this post


Link to post
Share on other sites