2016-04-04, 18:18:02
Good time of the day!
Before I begin, once again, I want to thank you for the wonderful weather engine
I can find a workaround for getting METAR export for Pro ATC X from FSXWX.
As I said before, my English is not very good, so my explanation may be not clear. But I'll try...
I found that FSXWX writes METAR data in %TEMP% directory in file FSXWXmetar.txt. This file have own format which is not recognized by Pro ATC X. I wrote unix bash shell script for extract METAR data from FSXWXmetar.txt and put it to another file. I installed cygwin on my system, using default installation and add "dos2unix" package.
In Pro ATC X I use weather option "Use OPUS weather", and set path to OPUS weather as F:\Weather.
I wrote cmd script for executing unix shell script with cygwin's bash.exe
I wrote windows power shell script for catch creation or changing %TEMP%\FSXWXmetar.txt and call cmd script for creating fake OPUS weather file. I used solution found on stackoverflow.com as a template
And at last, I wrote cmd script for shortcut to call powershell script.
My temporary files path is F:\TEMP
***metar.sh
cd /cygdrive/f/Temp
awk -F\; '{print $3}' FSXWXmetar.txt >/cygdrive/F/Weather/OpusWeather.txt
unix2dos /cygdrive/F/Weather/OpusWeather.txt
***end of metar.sh
***metar.cmd
F:\cygwin64\bin\bash.exe metar.sh
***end of metar.cmd
***metar.ps1
### SET FOLDER TO WATCH + FILES TO WATCH + SUBFOLDERS YES/NO
$watcher = New-Object System.IO.FileSystemWatcher
$watcher.Path = "F:\Temp"
$watcher.Filter = "FSXWXmetar.txt"
$watcher.IncludeSubdirectories = $false
$watcher.EnableRaisingEvents = $true
### DEFINE ACTIONS AFTER A EVENT IS DETECTED
$action = { $command="F:\FSXWX\metar.cmd"
iex $command
$command="echo changed"
iex $command
}
### DECIDE WHICH EVENTS SHOULD BE WATCHED + SET CHECK FREQUENCY
$created = Register-ObjectEvent $watcher "Created" -Action $action
$changed = Register-ObjectEvent $watcher "Changed" -Action $action
while ($true) {sleep 5}
***end of metar.ps1
***FSXWX-metar.cmd
powershell -File metar.ps1
***end of FSXWX-metar.cmd
How it works.
I put all scripts in F:\FSXWX directory, where placed fsxwx.exe.
I created shortcut for invoke FSXWX-metar.cmd on desktop.
Before running simulator and FSXWX I run shortcut. Script will wait for file %TEMP%\FSXWXmetar.txt will created or changed, and make a fake OpusWeather.txt file.
In this file I can insert non-existent fake METARs for airports such as UKCW, UKCS, ZULS and similar airports which does not have a real METARs. So, Pro ATC X is recognized weather in such airports and give proper runway for takeoff or landing.
I can try to implement export METAR feature to FSXWX if you don't mind. I have experience programming on C, C++ under Linux, I think I can handle this job.
Before I begin, once again, I want to thank you for the wonderful weather engine
I can find a workaround for getting METAR export for Pro ATC X from FSXWX.
As I said before, my English is not very good, so my explanation may be not clear. But I'll try...
I found that FSXWX writes METAR data in %TEMP% directory in file FSXWXmetar.txt. This file have own format which is not recognized by Pro ATC X. I wrote unix bash shell script for extract METAR data from FSXWXmetar.txt and put it to another file. I installed cygwin on my system, using default installation and add "dos2unix" package.
In Pro ATC X I use weather option "Use OPUS weather", and set path to OPUS weather as F:\Weather.
I wrote cmd script for executing unix shell script with cygwin's bash.exe
I wrote windows power shell script for catch creation or changing %TEMP%\FSXWXmetar.txt and call cmd script for creating fake OPUS weather file. I used solution found on stackoverflow.com as a template
And at last, I wrote cmd script for shortcut to call powershell script.
My temporary files path is F:\TEMP
***metar.sh
cd /cygdrive/f/Temp
awk -F\; '{print $3}' FSXWXmetar.txt >/cygdrive/F/Weather/OpusWeather.txt
unix2dos /cygdrive/F/Weather/OpusWeather.txt
***end of metar.sh
***metar.cmd
F:\cygwin64\bin\bash.exe metar.sh
***end of metar.cmd
***metar.ps1
### SET FOLDER TO WATCH + FILES TO WATCH + SUBFOLDERS YES/NO
$watcher = New-Object System.IO.FileSystemWatcher
$watcher.Path = "F:\Temp"
$watcher.Filter = "FSXWXmetar.txt"
$watcher.IncludeSubdirectories = $false
$watcher.EnableRaisingEvents = $true
### DEFINE ACTIONS AFTER A EVENT IS DETECTED
$action = { $command="F:\FSXWX\metar.cmd"
iex $command
$command="echo changed"
iex $command
}
### DECIDE WHICH EVENTS SHOULD BE WATCHED + SET CHECK FREQUENCY
$created = Register-ObjectEvent $watcher "Created" -Action $action
$changed = Register-ObjectEvent $watcher "Changed" -Action $action
while ($true) {sleep 5}
***end of metar.ps1
***FSXWX-metar.cmd
powershell -File metar.ps1
***end of FSXWX-metar.cmd
How it works.
I put all scripts in F:\FSXWX directory, where placed fsxwx.exe.
I created shortcut for invoke FSXWX-metar.cmd on desktop.
Before running simulator and FSXWX I run shortcut. Script will wait for file %TEMP%\FSXWXmetar.txt will created or changed, and make a fake OpusWeather.txt file.
In this file I can insert non-existent fake METARs for airports such as UKCW, UKCS, ZULS and similar airports which does not have a real METARs. So, Pro ATC X is recognized weather in such airports and give proper runway for takeoff or landing.
I can try to implement export METAR feature to FSXWX if you don't mind. I have experience programming on C, C++ under Linux, I think I can handle this job.