' Spot the International Space Station
' Using Vbsedit's free Toolkit
url="https://spotthestation.nasa.gov/sightings/view.cfm?country=France®ion=None&city=Paris"
url="https://spotthestation.nasa.gov/sightings/view.cfm?country=United_States®ion=North_Carolina&city=Plymouth"
url="https://spotthestation.nasa.gov/sightings/view.cfm?country=Cuba®ion=None&city=Havana"
Set http = CreateObject("Msxml2.XMLHTTP")
http.open "GET", url, FALSE
http.send ""
data = http.responseText
Dim img
Set img = WScript.CreateObject("Vbsedit.ImageProcessor")
Set objShell = CreateObject( "WScript.Shell" )
resourceLocation=objShell.ExpandEnvironmentStrings("%LOCALAPPDATA%") & "\Vbsedit\Resources\"
img.Load resourceLocation & "spacewalk.jpg"
spot=False
y=5
x=5
Do While 1
pos1=InStr(data,"<td scope=""row"">")
If pos1>0 Then
pos2=InStr(pos1,data,"</td>")
If pos2>0 Then
thedate = Mid(data,pos1+16,pos2-pos1-16)
posday1=InStr(thedate,",")
If posday1>0 Then
posday2=InStrRev(thedate," ",posday1)
If posday2>0 Then
theday=CInt(Mid(thedate,posday2+1,posday1-posday2-1))
End If
End If
data = Mid(data,pos2+5)
pos3=InStr(data,"<td>")
pos4=InStr(data,"</td>")
If pos3>0 And pos4>0 Then
duration=Mid(data,pos3+4,pos4-pos3-4)
If Left(duration,1)="<" Then
minutes=0
Else
minutes = CInt(Left(duration,InStr(duration," ")-1))
End If
data = Mid(data,pos4+5)
pos5=InStr(data,"<td>")
pos6=InStr(data,"</td>")
If pos5>0 And pos6>0 Then
maxheight=Mid(data,pos5+4,pos6-pos5-4)
degree=CInt(Left(maxheight,InStr(maxheight,"°")-1))
when=""
thetime=Mid(thedate,instr(thedate,", ")+2)
If Day(Date)=theday Then
delta=0
thehour=CInt(Left(thetime,InStr(thetime,":")-1))
If Right(thetime,2)="PM" Then
thehour=thehour+12
End If
If thehour>=Hour(Now) Then
when="Today at " & thetime
End If
End If
If Day(Date+1)=theday Then
when="Tomorrow at " & thetime
End If
For i=2 To 4
If Day(Date+i)=theday Then
when=WeekdayName(Weekday(Date+i)) & " at " & thetime
End If
Next
If when<>"" And minutes>=3 And degree>=40 Then
spot=True
img.FontFamily="Arial"
img.FontSize = 10
img.Color="white"
img.FontStyle=1
h=img.TextHeight(when)
w=img.TextWidth(when)
img.DrawText when,x,y
y=y+h
End If
End If
End If
Else
Exit Do
End If
Else
Exit Do
End If
Loop
If spot Then
path = resourceLocation & "spot_iss.png"
img.Save path
Set note = img.CreateStickyNote("iss",path)
note.AddMenuOption "Website","""C:\Program Files\Google\Chrome\Application\chrome.exe"" """ & url & """"
note.AddMenuOption "Refresh","wscript.exe //B """ & WScript.ScriptFullName & """"
End If