Sign in to follow this  
Followers 0
Darknight1366

Script Creation Help!

11 posts in this topic

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

Share this post


Link to post
Share on other sites



Yes it is possible considering the site provides the data, all you have to do is get it and display for the user.

Share this post


Link to post
Share on other sites

#3 ·  Posted (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 by guinness

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_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 parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

#6 ·  Posted (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"), "&deg;", 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   ;==>_GetWeather

NOTE: 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 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!"

Share this post


Link to post
Share on other sites

@GeoSoft Sorry, Doesn't work, It appears a Msgbox with meaningless random alphabet.

Sorry, For disturbing you :x


Visit HugeSoft(TM) To Get Any Coding Help or Anything

Share this post


Link to post
Share on other sites

@GeoSoft Sorry, Doesn't work, It appears a Msgbox with meaningless random alphabet.

Sorry, For disturbing you :x

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"), "&deg;", 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

Share this post


Link to post
Share on other sites

Obviously you want the Temperature, so why not use the GoogleWeather API? I can't see what is special about the site you presented.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_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 parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

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!"

Share this post


Link to post
Share on other sites

@saywell at last it wored! Thanks a lot everyone for wasting time.


Visit HugeSoft(TM) To Get Any Coding Help or Anything

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0