Darknight1366 Posted January 13, 2011 Share Posted January 13, 2011 Is it Possible to create a script which will tell the current day's temperature? (The Script will download/show the temperature from a website or link?(Link will be given by me after creating the script) Please help me. Visit HugeSoft(TM) To Get Any Coding Help or Anything Link to comment Share on other sites More sharing options...
pedmacedo Posted January 13, 2011 Share Posted January 13, 2011 Yes it is possible considering the site provides the data, all you have to do is get it and display for the user. Link to comment Share on other sites More sharing options...
guinness Posted January 13, 2011 Share Posted January 13, 2011 (edited) Check out the I created. Or if you post the link it would help, because the only answer to your question is yes is probably can! But for ease I would suggest the UDF. Edited January 13, 2011 by guinness UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Darknight1366 Posted January 14, 2011 Author Share Posted January 14, 2011 Thanks, for replying. But I didn't wanted that. I wanted that Autoit will get the information from a link and will show it on a Msgbox.Weather Link : http://www.theweathernetwork.com/weather/bgxx0003 Visit HugeSoft(TM) To Get Any Coding Help or Anything Link to comment Share on other sites More sharing options...
Darknight1366 Posted January 14, 2011 Author Share Posted January 14, 2011 Thanks, for replying. But I didn't wanted that. I wanted that Autoit will get the information from a link and will show it on a Msgbox.Weather Link : http://www.theweathernetwork.com/weather/bgxx0003 Dhaka,Bangladesh Is Where I live. Visit HugeSoft(TM) To Get Any Coding Help or Anything Link to comment Share on other sites More sharing options...
GEOSoft Posted January 14, 2011 Share Posted January 14, 2011 (edited) Opt("MustDeclareVars", 1) Local $sWeather = _GetWeather() MsgBox(4096, "Weather Conditions", $sWeather) Func _GetWeather() Local $sOut = "" Local $sHTML = BinaryToString(InetRead("http://www.theweathernetwork.com/weather/bgxx0003")) $sHTML = StringRegExpReplace($sHTML, "(?si).+(<div id=\x22obs\x22>.+?</div>)<!--\s/obs_conds\s-->.*", "$1");; Get only that portion of the page that contains the data $sHTML = StringReplace(StringRegExpReplace($sHTML, "(?m:^)\h+(.+)", "$1"), "°", Chr(176));; Clean up the HTML a bit so we can see what we are working with $sOut &= StringRegExpReplace($sHTML, "(?is).+<h2.+(updated:.+?)\s-\s(\w+)</span>.+", "Weather for $2 - $1") & @CRLF;; Get the location, date and time Local $sTemp = StringRegExpReplace($sHTML, "(?is).+<div id=\x22obs_currtemp.+?(\d+)</p>.+?(\260[cf]).+", "Temperature: $1 $2");Keep this separate from $sOut in case you need to convert the temp scale. ;;Convert Temperature scale here if required. $sOut &= $sTemp & @CRLF $sOut &= StringRegExpReplace($sHTML, "(?is).+<p id=\x22conddesc\x22>(\w+)</p>.+", "Current Conditions: $1") & @CRLF ;; Current atmospheric conditions added to output $sOut &= StringRegExpReplace(StringRegExpReplace($sHTML, "(?is).+wind</a></strong>:\h*(.+?/h).+", "Wind: $1"), "(\D+)(\d+)(.+)", "$1$2 $3") & @CRLF;; Wind speed and direction added to output $sOut &= StringRegExpReplace($sHTML, "(?is).+humidity</a></strong>:\s*(\d+%).+", "Humidity: $1") & @CRLF;; Get the Humidity and add it to the output $sOut &= StringRegExpReplace($sHTML, "(?is).+pressure</a></strong>:\s*([\d.]+\skpa).+", "Pressure: $1") & @CRLF;; Add pressure to output $sOut &= StringRegExpReplace($sHTML, "(?is).+visibility</a></strong>:\s*([\d.]+\s*\w{2,3}).+", "Visibility: $1") & @CRLF;; Add Visibility $sOut &= StringRegExpReplace($sHTML, "(?is).+ceiling</a></strong>:\s*([\w\h]+).+", "Ceiling: $1");; Add The ceiling Return $sOut EndFunc ;==>_GetWeatherNOTE: You can rearange or comment-out any of the "$sOut &=" lines to customize it to your liking. I was going to include the wind gusts but that information wasn't currently available so I couldn't work out the expression. If you need it then I'll try again when it's in there. It's probably the same as the wind speed expression with just changing .+wind to .+gusts Edited January 14, 2011 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Darknight1366 Posted January 14, 2011 Author Share Posted January 14, 2011 @GeoSoft Sorry, Doesn't work, It appears a Msgbox with meaningless random alphabet. Sorry, For disturbing you Visit HugeSoft(TM) To Get Any Coding Help or Anything Link to comment Share on other sites More sharing options...
saywell Posted January 14, 2011 Share Posted January 14, 2011 @GeoSoft Sorry, Doesn't work, It appears a Msgbox with meaningless random alphabet. Sorry, For disturbing you Opt("MustDeclareVars", 1) Local $sWeather = _GetWeather() MsgBox(4096, "Weather Conditions", $sWeather) Func _GetWeather() Local $sOut = "" Local $sHTML = BinaryToString(InetRead("http://www.theweathernetwork.com/weather/bgxx0003")) $sHTML = StringRegExpReplace($sHTML, "(?si).+(<div id=\x22obs\x22>.+?</div>)<!--\s/obs_conds\s-->.*", "$1");; Get only that portion of the page that contains the data $sHTML = StringReplace(StringRegExpReplace($sHTML, "(?m:^)\h+(.+)", "$1"), "°", Chr(176));; Clean up the HTML a bit so we can see what we are working with $sOut &= StringRegExpReplace($sHTML, "(?is).+<h2.+(updated:.+?)\s-\s(\w+)</span>.+", "Weather for $2 - $1") & @CRLF;; Get the location, date and time Local $sTemp = StringRegExpReplace($sHTML, "(?is).+<div id=\x22obs_currtemp.+?(\d+)</p>.+?(\260[cf]).+", "Temperature: $1 $2");Keep this separate from $sOut in case you need to convert the temp scale. ;;Convert Temperature scale here if required. $sOut &= $sTemp & @CRLF Return $sOut EndFunc ;==>_GetWeather The first bit of geosoft's code does the temperature. If the output is truly gobbledegook, then we may be using different character set! William Link to comment Share on other sites More sharing options...
guinness Posted January 14, 2011 Share Posted January 14, 2011 Obviously you want the Temperature, so why not use the GoogleWeather API? I can't see what is special about the site you presented. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
GEOSoft Posted January 14, 2011 Share Posted January 14, 2011 Character set id very likely the problem. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Darknight1366 Posted January 15, 2011 Author Share Posted January 15, 2011 @saywell at last it wored! Thanks a lot everyone for wasting time. Visit HugeSoft(TM) To Get Any Coding Help or Anything Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now