天气台风 ( ActiveX )

许多实用脚本和封装函数, 可以让您编写脚本更加便捷高效

Moderators: tmplinshi, arcticir

Post Reply
garry
Posts: 3740
Joined: 22 Dec 2013, 12:50

天气台风 ( ActiveX )

Post by garry » 30 Sep 2018, 13:10

EDIT : 20181014
shoul'd work if URL not change
see only picture in activeX if typhoon warning exist in Central-Eastern PACIFIC Philippines
otherwise shoul'd open link = http://www.metoc.navy.mil/jtwc/jtwc.html


use these links

Typhoon warning center :
http://www.metoc.navy.mil/jtwc/jtwc.html
http://www.tropicalstormrisk.com/
https://www.pgyc.org/weather.php
https://earth.nullschool.net/#current/w ... 879,13.692
https://www.timeanddate.com/weather/china/suzhou
=====================================================================================



;- PACIFIC Weather Warnings- Latest Typhoon PACIFIC central&eastern / China Korea Japan Philippines Vietnam
;- create 2 small htm-files --
;- a small ActiveX example


Code: Select all

;- modified= 20181014
;- created = 20180930
;- see only picture in ActiveX if typhoon warning in " Central-Eastern PACIFIC" / China Korea Japan Philippines ...
;---------------------------------------------------------------------------------------------------------------

;- create 2 small htm-files --
;- a small ActiveX example

#warn
#NoEnv
SendMode, Input
SetWorkingDir, %A_ScriptDir%
SetBatchLines, -1
Filename1=Latest Typhoon PHILIPPINES

;-- Links to > 
h0 :="http://www.metoc.navy.mil/jtwc/jtwc.html"

h1a :="https://earth.nullschool.net/#current/wind/surface/level/orthographic=123.04,23.45,1821/loc=124.879,13.692"
h1b :="https://www.windy.com/?24.107,106.260,5"  ;- Asia India
h1c :="https://www.timeanddate.com/weather/china/shanghai"


h3a:="https://www.accuweather.com/en/hurricane/tracker"
h3b:="https://earth.nullschool.net/#current/wind/surface/level/orthographic=-5.39,44.57,1821/loc=124.879,13.692"
h3c:="https://www.windy.com/?47.367,8.550,5"    ;- Europe
h3d:="https://www.timeanddate.com/weather/portugal/lisbon"


h4a:="https://www.accuweather.com/en/hurricane/tracker"
h4b:="https://earth.nullschool.net/#current/wind/surface/level/orthographic=-93.17,32.94,1821/loc=124.879,13.692"
h4c:="https://www.windy.com/?30.126,-90.352,5"  ;- USA 
h4d:="https://www.timeanddate.com/weather/usa/georgia"

h9 :="https://www.timeanddate.com/weather/china/suzhou"
;--------------------------------------------------------------



Gui, 2: -DPIScale
wa:=A_screenwidth
ha:=A_screenHeight
xx:=105
GW :=(wa*92)/xx    ;- GUI width
GH :=(ha*98)/xx    ;- GUI height
AW :=(wa*80)/xx    ;- ActiveX width
AH :=(ha*95)/xx    ;- ActiveX height
;- black
AW1 :=(wa*79)/xx   ;
AH1 :=(ha*94)/xx   ;
;xxa=Shell.Explorer                  ;- IExplorer
xxa=Mozilla.Browser                  ;- firefox
Gui,2: Color, 000000
Gui,2:Font,  S10 CDefault , FixedSys

Menu,S0,add,Typhoon warning        ,MH0
Menu,S1,add,Wind Pacific India     ,MH1
Menu,S3,add,Hurricane Europe       ,MH3
Menu,S4,add,Hurricane USA          ,MH4
Menu,S9,add,Weather Suzhou         ,MH9

menu,myMenuBar,Add,Typhoon warning      ,:S0
menu,myMenuBar,Add,Wind Pacific India   ,:S1
menu,myMenuBar,Add,Hurricane Europe     ,:S3
menu,myMenuBar,Add,Hurricane USA        ,:S4
menu,myMenuBar,Add,Weather Suzhou       ,:S9

gui,2:menu,MyMenuBar

Gui,2:Add,ActiveX, x10 y10 w%aw% h%ah% vWB1 ,%xxa%
aad=
(ltrim join`r`n
<div style="margin:0px;padding:0px;width:%aw1%px;height:%ah1%px;border:1px solid black;background-color: #000000;">
</div>
)
FX2=%a_scriptdir%\black.htm
ifnotexist,%FX2%
  fileappend,%aad%`r`n,%FX2%
stringreplace,FX2,FX2,\,/,all
F2:="file:///" . FX2
WB1.Navigate(F2)
Gui,2: Show,x0 y0 w%gw% h%gh%,%filename1%
gosub,weather_ph
return
;------------------------
2Guiclose:
exitapp
;------------------------
mh0:
run,%h0%
return

mh1:
run,%h1a%
run,%h1b%
run,%h1c%
return

mh3:
run,%h3a%
run,%h3b%
run,%h3c%
run,%h3d%
return

mh4:
run,%h4a%
run,%h4b%
run,%h4c%
run,%h4d%
return

mh9:
run,%h9%
return

;------ weather warnings PACIFIC China Korea Japan Philippines ------------
Weather_PH:
gui,2:submit,nohide
url=https://www.pgyc.org/weather.php
who := ComObjCreate("WinHttp.WinHttpRequest.5.1")
ComObjError(false)
who.Silent := True            ;- script failure = off
who.Option(4) := 0x3300	      ;- SslErrorIgnoreFlags (ignore all certificate errors)
who.Option(6) := False        ;- No redirects
who.Open("GET",url, false)
who.Send()
aa:=who.ResponseText
ax:="<!-- START Latest position of current typhoon -->"        ;- begin
bx:="</p>"                                                     ;- end
stringlen,L1,ax
  StringGetPos,P1,aa,%ax%           ;- begin position1
  P1:=P1+L1
  stringtrimleft,c2,aa,p1           ;- after found cut rest from fulltext
  StringGetPos,P2,c2,%bx%           ;- until position bx
  StringMid,aa,c2,1,P2
  aa=%aa%%bx%</div>
  
if aa contains Track of active typhoons will appear here
  {
  e5x=
  (
  <div style="margin:0px;padding:0px;width:%aw1%px;height:%ah1%px;border:1px solid black;background-color: #000000;">
  <font size="6"
  <font face="Lucida console" color="gray">Typhoon warning PACIFIC  = NO<br>Starts URL 'Typhoon warning' in 6 seconds </font>
  </div>
  )
  
  fx=%a_scriptdir%\%filename1%.htm
  ifexist,%fx%
    filedelete,%fx%
  fileappend,%e5x%`r`n,%fx%
  stringreplace,fx,fx,\,/,all
  f1:="file:///" . fx
  WB1.Navigate(F1)
  sleep,6000
  run,http://www.metoc.navy.mil/jtwc/jtwc.html
  return
  }  
  
fx=%a_scriptdir%\%filename1%.htm
ifexist,%fx%
  filedelete,%fx%
fileappend,%aa%`r`n,%fx%
stringreplace,fx,fx,\,/,all
f1:="file:///" . fx
WB1.Navigate(F1)
return
;---------------------

/*
<!-- START Latest position of current typhoon -->
    <div style="margin:0 auto; width:100%; max-width:445px;">
        <h3>27-Sep-2018 Image of Typhoon Trami 28W </h3>
	<p>
	<a href="http://www.metoc.navy.mil/jtwc/products/wp2818.gif"><img src="http://www.metoc.navy.mil/jtwc/products/wp2818.gif" style="width:100%; max-width:445px;" alt="Typhoon Trami 28W" title="Latest Typhoon Track Click to see original at JTWC" /></a></p>
                            
    </div>

;--------- if no typhoon :	
<!-- START Latest position of current typhoon -->
    <div style="margin:0 auto; width:100%; max-width:445px;">
        <div><p><img title="Track of active typhoons will appear here" src="Images/Cruising/no-storm.gif" style="width:100%; max-width: 445px;" alt="typhoon Philippines" /></p></div>
	
*/
;=========================== END script ===============================

Image
Yutu (Rosita) will make landfall in the Philippines on Monday (U.S. EDT). 20181029
Flooding rain, landslides, damaging winds and storm surge will impact the Philippines.
Yutu will weaken as it approaches southeast China.
Last week, Yutu was the strongest typhoon on record to pass over Saipan and Tinian.

Post Reply

Return to “脚本函数”