Advertisement
worstbull

Export ICAOs from .pln file to .txt file

Jan 25th, 2021
1,604
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Dim FlightPlan, CurrentPath, xmlDoc, ICAO, ICAOIdent, FileContent, OutputFile
  2. Set objFSO=CreateObject("Scripting.FileSystemObject")
  3.  
  4. With CreateObject("WScript.Shell")
  5. CurrentPath=.CurrentDirectory
  6. End With
  7.  
  8. Set xmlDoc = CreateObject("Msxml2.DOMDocument")
  9. xmlDoc.setProperty "SelectionLanguage", "XPath"
  10. FlightPlan = CurrentPath + "\" + InputBox("Enter the filename (e.g. flightplan.pln) of the file - must be in this folder:")
  11. xmlDoc.load(FlightPlan)
  12. For Each ICAO In xmlDoc.SelectNodes("/SimBase.Document/FlightPlan.FlightPlan/ATCWaypoint/ICAO")
  13.     ICAOIdent = ICAO.selectSingleNode("ICAOIdent").text
  14.     FileContent = FileContent + ICAOIdent + vbCrLf
  15. Next
  16.  
  17. OutputFile = CurrentPath + "\" + InputBox("Enter the filename (e.g. flightplan.txt) of the file to write to (in this folder)")
  18.  
  19. Set File = objFSO.CreateTextFile(OutputFile,True)
  20. File.Write FileContent
  21. File.Close
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement