Planeplotter (飛行機を記録するソフトウェア) からのデータを CSV ファイルに記録するこの VBS スクリプトを見つけました。
ここで私の質問は、このスクリプトを変更して毎日新しい CSV ファイルを作成する方法です。これで、すべてが 1 つのファイルに詰め込まれます。
' PlanePlotter script for logging active aircraft (including those received by sharing)
' Create a file in the Log Files directory
Dim fso, f1, ts
Const ForWriting = 2
Set fso = CreateObject("Scripting.FileSystemObject")
fso.CreateTextFile ("B:\_Mijn Downloads en Werkmap\_Spotten\PlanePlotter\Log\pp_share_log.txt")
Set f1 = fso.GetFile("B:\_Mijn Downloads en Werkmap\_Spotten\PlanePlotter\Log\pp_share_log.txt")
Set ts = f1.OpenAsTextStream(ForWriting, True)
' Tap in to PlanePlotter
Dim MyObject
Set MyObject = GetObject(,"PlanePlotter.Document")
' Write all the aircraft data out to file every minute for 24 hours
while 1
i = 0
while i < MyObject.GetPlaneCount()
hexc = MyObject.GetAllPlaneData(i,0)
regc = MyObject.GetAllPlaneData(i,1)
flnc = MyObject.GetAllPlaneData(i,2)
latf = MyObject.GetAllPlaneData(i,3)
latc = Cstr(latf)
latc = Replace(latc,",",".")
lonf = MyObject.GetAllPlaneData(i,4)
lonc = CStr(lonf)
lonc = Replace(lonc,",",".")
altf = MyObject.GetAllPlaneData(i,5)
altc = CStr(altf)
altc = Replace(altc,",",".")
hedf = MyObject.GetAllPlaneData(i,6)
hedc = CStr(hedf)
hedc = Replace(hedc,",",".")
spdf = MyObject.GetAllPlaneData(i,7)
spdc = CStr(spdf)
spdc = Replace(spdc,",",".")
recc = MyObject.GetAllPlaneData(i,8)
recc = Replace(recc," ",",") ' put a comma half way through
icao = MyObject.GetAllPlaneData(i,14)
shar = MyObject.GetAllPlaneData(i,18)
verr = MyObject.GetAllPlaneData(i,21)
verc = CStr(verr)
planeinfo = recc + "," + hexc + "," + regc + "," + flnc + "," + icao + "," + altc + "," + latc + "," + lonc + "," + spdc + "," + hedc + "," + shar + "," + verc + ","
ts.WriteLine (planeinfo)
i = i + 1
wend
ts.WriteLine ("---------")
Wscript.Sleep 180000 ' 60 Seconds
n = n - 1
wend
ts.Close