You must use Firefox and the default save option must be to save as a text file. I tried IE but ran into some problems the way copy and paste worked inside Notepad.
Also, Notepad must be set by default to save to Desktop. Is there a better way to specify a save location and format regardless of the save as options?
I'm new at this, so any advice / tip would be appreciated. Not sure if there is a way easier way to do this that I'm not seeing...
; Extract weather data from the NOAA site from a major airport. ; Visit www.srh.noaa.gov/data/obhistory/?C=N;O=A to find all available airports. ; ----------------------------------------------Info Gather Gui, Font, s10, Verdana Gui, Add, DropDownList, vLoc_Value, ABQ|ALB|ATL|AUS|BDL|BHM|BNA|BOI|BOS|BUF|BUR|BWI|CHS|CLE|CLT|CMH|COS|CVG|DAL|DAY|DCA|DEN|DFW|DSM|DTW|ELP|EWR|FLL|GEG|GRR|GSO|GUM|HNL|HOU|HPN|IAD|IAH|IND|ISP|ITO|JAX|JFK|KOA|LAS|LAX|LGA|LGB|LIH|LIT|MCI|MCO||MDW|MEM|MHT|MIA|MKE|MS|MSP|MSY|MYR|OAK|OKC|OMA|ONT|ORD|ORF|ORL|PBI|PDX|PHL|PHX|PIT|PNS|PSP|PVD|PWM|RDU|RIC|RNO|ROC|RSW|SAN|SAT|SAV|SDF|SEA|SFB|SFO|SJC|SJU|SLC|SMF|SNA|STL|SYR|TPA|TUL|TUS|TYS Gui, Add, Button, default ym, Scrape Gui, Show, w325 h80, NOAA Weather Data Scrape Gui, Color, White ;Gui, Add, Picture, x0 y0 w325 h100, %A_WinDir%\system32\ntimage.gif ;use as window background if using win xp Return ButtonScrape: GuiClose: GuiEscape: Gui, Submit ; Save each control's contents to its associated variable. ; ----------------------------------------------Add Variables SetWorkingDir %A_ScriptDir% ;sets current directory as working directory Site = http://www.srh.noaa.gov/data/obhistory/K%Loc_Value%.html Web_data = %Loc_Value%_data.txt ; ----------------------------------------------Launch Firefox Run Firefox.exe %Site% WinWait, National Weather Service Sleep, 500 Send, {CTRLDOWN}a{CTRLUP}{CTRLDOWN}c{CTRLUP} Sleep, 200 Send, {LWINDOWN}r{LWINUP} WinWait, Run, IfWinNotActive, Run, , WinActivate, Run, WinWaitActive, Run, Sleep, 500 Send, {SHIFTDOWN}n{SHIFTUP}otepad.exe{ENTER} WinWait, Untitled - Notepad, IfWinNotActive, Untitled - Notepad, , WinActivate, Untitled - Notepad, WinWaitActive, Untitled - Notepad, Send, {CTRLDOWN}v{CTRLUP} Sleep, 500 Send, {CTRLDOWN}s{CTRLUP} WinWait, Save As, IfWinNotActive, Save As, , WinActivate, Save As, WinWaitActive, Save As, Send, %Loc_Value%_data.txt{ENTER} Sleep, 1000 WinActivate Send, {ALTDOWN}{F4}{ALTUP} Sleep, 500 WinWait, National Weather Service Sleep, 500 Send, {ALTDOWN}{F4}{ALTUP} Loop, read, %Web_data%, %Loc_Value%_Scrape.txt { IfInString, A_LoopReadLine, .gov, FileAppend, %A_LoopReadLine%`n IfInString, A_LoopReadLine, :, FileAppend, %A_LoopReadLine%`n } Sleep, 1000 FileDelete, %Web_data% ExitApp Return