guinness Posted December 28, 2010 Share Posted December 28, 2010 (edited) This is a UDF that uses the 'undocumented' Google Weather API. Documentation has been provided in the UDF with a couple of examples too. Enjoy.WARNING: This UDF has been deprecated due to Google closing the doors on the (unsupported) Weather API. I have left the code as it is so others may learn from it.UDF:expandcollapse popup#include-once ; #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 ; #INDEX# ======================================================================================================================= ; Title .........: _GoogleWeather ; AutoIt Version : v3.3.2.0 or higher ; Language ......: English - uses https://www.google.com ; Description ...: Retrieves details about the weather in a specific region, using the 'undocumented' Google Weather API. ; Note ..........: ; Author(s) .....: guinness ; Remarks .......: ; =============================================================================================================================== ; #INCLUDES# ==================================================================================================================== ; None ; #GLOBAL VARIABLES# ============================================================================================================ ; None ; #CURRENT# ===================================================================================================================== ; _GoogleWeather_Current: Retrieves details about the current weather status in a specific region. ; _GoogleWeather_Forecast: Retrieves details about the 4 day forecast for a specific region. ; _GoogleWeather_Get: Retrieves all data that will be parsed from the Google Weather API. ; _GoogleWeather_Information: Retrieves details about the general forecast information. ; =============================================================================================================================== ; #INTERNAL_USE_ONLY#============================================================================================================ ; __GoogleWeather_CelsiusToFahrenheit ......; Converts from Celsius to Fahrenheit ; __GoogleWeather_FahrenheitToCelsius ......; Converts from Fahrenheit to Celsius ; __GoogleWeather_GetIPLocation ............; Retrieves the IP City location ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name ..........: _GoogleWeather_Current ; Description ...: Retrieves details about the current weather status in a specific region. ; Syntax ........: _GoogleWeather_Current([$sRead = -1]) ; Parameters ....: $sRead - [optional] Only data returned from _GoogleWeather_Get(). Default is IP location. ; Return values .: Success - Returns a 1D Array. $aArray[6] = [Number of Items, Condition data, Temp in F, Temp in C, Icon URL, Wind condition] ; Failure - Returns -1 & sets @error to non-zero ; Author ........: guinness ; Example .......: Yes ; =============================================================================================================================== Func _GoogleWeather_Current($sRead = -1) Local $aXML[7] = [6, "condition data", _ "temp_f data", _ "temp_c data", _ "humidity data", _ "icon data", _ "wind_condition data"] Local $sConditions = "current_conditions", $sReturn If $sRead = -1 Then $sRead = _GoogleWeather_Get() EndIf If @error Then Return SetError(1, 0, -1) EndIf $sReturn = StringRegExp($sRead, "<(?i)" & $sConditions & ">(.*?)</(?i)" & $sConditions & ">", 3) If @error Then Return SetError(1, 0, -1) EndIf $sRead = $sReturn[0] For $A = 1 To $aXML[0] $sReturn = StringRegExp($sRead, '(?i)<' & $aXML[$A] & '="(.*?)"/>', 3) If @error Then Return SetError(1, 0, 0) EndIf If $aXML[$A] = $aXML[2] Then $sReturn[0] = $sReturn[0] & ChrW(176) & "F" EndIf If $aXML[$A] = $aXML[3] Then $sReturn[0] = $sReturn[0] & ChrW(176) & "C" EndIf If $aXML[$A] = $aXML[5] Then $sReturn[0] = "https://www.google.com" & $sReturn[0] EndIf $aXML[$A] = $sReturn[0] Next If @error = 0 Then Return $aXML EndIf Return SetError(1, 0, -1) EndFunc ;==>_GoogleWeather_Current ; #FUNCTION# ==================================================================================================================== ; Name ..........: _GoogleWeather_Forecast ; Description ...: Retrieves details about the 4 day forecast for a specific region. ; Syntax ........: _GoogleWeather_Forecast([$sRead = -1[, $iTemperature = 1]]) ; Parameters ....: $sRead - [optional] Only data returned from _GoogleWeather_Get(). Default is IP location. ; $iTemperature - [optional] Use Fahrenheit (0) or Celsius (1). Default is 1. ; Return values .: Success - Returns a 2D Array. $aArray[5][5] = $aArray[0][0] - Number of Items ; [0][1] - Number Of Columns ; ; $Array[A][0] - Day of the week ; [A][1] - Temp high in C/F ; [A][2] - Temp low in C/F ; [A][3] - Icon URL ; [A][4] - Condition data ; Failure - Returns -1 & sets @error to non-zero ; Author ........: guinness ; Example .......: Yes ; =============================================================================================================================== Func _GoogleWeather_Forecast($sRead = -1, $iTemperature = 1) Local $aXML[5] = ["day_of_week data", _ "high data", _ "low data", _ "icon data", _ "condition data"] Local $iSize, $sConditions = "forecast_conditions", $sReturn, $sReturnTest If $sRead = -1 Then $sRead = _GoogleWeather_Get() EndIf If @error Then Return SetError(1, 0, -1) EndIf $sReturn = StringRegExp($sRead, "<(?i)" & $sConditions & ">(.*?)</(?i)" & $sConditions & ">", 3) $iSize = UBound($sReturn, 1) Local $aReturn[$iSize + 1][5] = [[$iSize, 5]] For $A = 0 To $iSize - 1 $sRead = $sReturn[$A] For $B = 0 To $aReturn[0][1] - 1 $sReturnTest = StringRegExp($sRead, '(?i)<' & $aXML[$B] & '="(.*?)"/>', 3) If $aXML[$B] = $aXML[1] Or $aXML[$B] = $aXML[2] Then Switch $iTemperature Case 0 $sReturnTest[0] = $sReturnTest[0] & ChrW(176) & "F" Case 1 $sReturnTest[0] = __GoogleWeather_FahrenheitToCelsius($sReturnTest[0]) EndSwitch EndIf If $aXML[$B] = $aXML[3] Then $sReturnTest[0] = "https://www.google.com" & $sReturnTest[0] EndIf $aReturn[$A + 1][$B] = $sReturnTest[0] Next Next If @error = 0 Then Return $aReturn EndIf Return SetError(1, 0, -1) EndFunc ;==>_GoogleWeather_Forecast ; #FUNCTION# ==================================================================================================================== ; Name ..........: _GoogleWeather_Get ; Description ...: Retrieves all data that will be parsed from the Google Weather API. ; Syntax ........: _GoogleWeather_Get([$sLocation = -1]) ; Parameters ....: $sLocation - [optional] Specify a location to retrieve the weather information for. Default is IP location. ; Return values .: Success - Returns data retrieved from the Google Weather API. ; Failure - Returns -1 & sets @error to non-zero ; Author ........: guinness ; Example .......: Yes ; =============================================================================================================================== Func _GoogleWeather_Get($sLocation = -1) Local $bRead, $sRead If $sLocation = -1 Then $sLocation = __GoogleWeather_GetIPLocation() EndIf $bRead = InetRead("https://www.google.com/ig/api?weather=" & $sLocation) If @error Then Return SetError(1, 0, -1) EndIf $sRead = BinaryToString($bRead) Return $sRead EndFunc ;==>_GoogleWeather_Get ; #FUNCTION# ==================================================================================================================== ; Name ..........: _GoogleWeather_Information ; Description ...: Retrieves details about the forecast information. ; Syntax ........: _GoogleWeather_Information([$sRead = -1]) ; Parameters ....: $sRead - [optional] Only data returned from _GoogleWeather_Get(). Default is IP location. ; Return values .: Success - Returns a 1D Array. $aArray[6] = [Number of Items, City data, Postal data, Forecast data, Current time, Unit system] ; Failure - Returns -1 & sets @error to non-zero ; Author ........: guinness ; Example .......: Yes ; =============================================================================================================================== Func _GoogleWeather_Information($sRead = -1) Local $aXML[6] = [5, "city data", _ "postal_code data", _ "forecast_date data", _ "current_date_time data", _ "unit_system data"] Local $sReturn If $sRead = -1 Then $sRead = _GoogleWeather_Get() EndIf If @error Then Return SetError(1, 0, -1) EndIf For $A = 1 To $aXML[0] $sReturn = StringRegExp($sRead, '(?i)<' & $aXML[$A] & '="(.*?)"/>', 3) If @error Then Return SetError(1, 0, 0) EndIf $aXML[$A] = $sReturn[0] Next If @error = 0 Then Return $aXML EndIf Return SetError(1, 0, -1) EndFunc ;==>_GoogleWeather_Information ; #INTERNAL_USE_ONLY#============================================================================================================ Func __GoogleWeather_CelsiusToFahrenheit($iTemperature) Return Round($iTemperature * (9 / 5) + 32) & ChrW(176) & "F" EndFunc ;==>__GoogleWeather_CelsiusToFahrenheit Func __GoogleWeather_FahrenheitToCelsius($iTemperature) Return Round(($iTemperature - 32) * (5 / 9)) & ChrW(176) & "C" EndFunc ;==>__GoogleWeather_FahrenheitToCelsius Func __GoogleWeather_GetIPLocation() Local $aXML[5] = [4], $bRead, $sRead, $sReturn $bRead = InetRead("http://ip.xxoo.net/") $sRead = BinaryToString($bRead) $sReturn = StringRegExp($sRead, '(?s)(?i)<B>IP Address:</B>(.*?)<script type="text/javascript">', 3) If @error Then Return SetError(1, 0, -1) EndIf $sRead = $sReturn[0] $sReturn = StringRegExp($sRead, '(?s)(?i)<div align="left">(.*?)</div>', 3) If @error Then Return SetError(1, 0, -1) EndIf $sRead = $sReturn For $A = 1 To $aXML[0] If $A - 1 = 1 Then $sReturn = StringRegExp($sRead[$A - 1], '(?s)(?i)A(.*?) ', 3) If @error Then ContinueLoop EndIf $sRead[$A - 1] = $sReturn[0] EndIf $aXML[$A] = $sRead[$A - 1] Next If @error = 0 And $aXML[2] <> "" Then Return $aXML[2] EndIf Return SetError(1, 0, -1) EndFunc ;==>__GoogleWeather_GetIPLocationExample use of Function:#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include <Array.au3> ; Required only for _ArrayDisplay(), but not the UDF. #include "_GoogleWeather.au3" ; Include the _GoogleWeather.au3 UDF. Example_2() Func Example_2() ; Get the weather information for New York. Local $sLocation = _GoogleWeather_Get("New York") ; Retrieve information for the current weather, passing the data returned by _GoogleWeather_Get. Local $aReturn = _GoogleWeather_Current($sLocation) _ArrayDisplay($aReturn, "_GoogleWeather_Current()") ; Retrieve the forecast for the next 4 days, passing the data returned by _GoogleWeather_Get. $aReturn = _GoogleWeather_Forecast($sLocation) _ArrayDisplay($aReturn, "_GoogleWeather_Forecast()") ; Retrieve general information about the current location and forecast, passing the data returned by _GoogleWeather_Get. $aReturn = _GoogleWeather_Information($sLocation) _ArrayDisplay($aReturn, "_GoogleWeather_Information()") EndFunc ;==>Example_2All of the above has been included in a ZIP file.Previous downloads: 125 Edited October 8, 2012 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...
guinness Posted December 29, 2010 Author Share Posted December 29, 2010 Cheers Deathbringer! Yeh it does support those types of locations. I didn't actually document them because I was being a little lazy 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...
guinness Posted January 5, 2011 Author Share Posted January 5, 2011 (edited) Updated: Now the UDF will grab the city based on the WAN IP Address, it can be slow depending on how fast your internet connection is and how busy the IP retrieval service is.Check out _GoogleWeather_Get() for more details. You can decide whether the Function grabs your location via the IP Address or using a generic location. Edited January 5, 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...
iamtheky Posted January 6, 2011 Share Posted January 6, 2011 (edited) No luck for US IP Addresses. For my IP it returns Salado, United States (though it is tagged correctly on their google map). With no state information the return from google is null. I will hunt for a more granular Geographic IP tool.This works for my city (well close enough) in your UDF.Func __GetIPLocation() Local $aXML[5] = [4], $bRead, $sRead, $sReturn $bRead = InetRead("http://www.ip2location.com/" , 1) $sRead = BinaryToString($bRead) $sReturn = StringRegExp ($sRead , '<span id="Livedemo1_lblLocation" class="fontgraysmall">(.*?)</span></td>' , 3) $sSplit = stringsplit ($sReturn[0], ",") $sCombo = $sSplit[3] & " , " & $sSplit[2] Return $sCombo EndFunc ;==>__GetIPLocation FOR US CITIES!! Edited January 6, 2011 by iamtheky ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
guinness Posted January 6, 2011 Author Share Posted January 6, 2011 Very weird indeed. Right now I am using http://ip.xxoo.net/ to extract the City & Country. If you know of a better site then please let me know. I know of http://xml.utrace.de/ but I was put off by their disclaimer >> http://en.utrace.de/api.php 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...
guinness Posted January 6, 2011 Author Share Posted January 6, 2011 (edited) OK, just saw you update. I did see ip2location.com but again I am concerned about their TOU >> http://www.ip2location.com/termsofuse.aspx Other than that is the UDF easy to understand? Edited January 6, 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...
iamtheky Posted January 6, 2011 Share Posted January 6, 2011 (edited) It is indeed nicely done, and trust that if I can understand and edit it then you have succeeded in making it simple. TOUs are sketchy at best, worthless most of the time. Terms like 'reverse-engineering' and 'data-mining' have no clear meaning, is viewing the source reverse-engineering? is getting the information by any other means than a browser 'data-mining'? Unless you are going to sell it I would not begin to worry, and then I would be concerned about crawling an uninterested third party site for information. Here is an example with a transparent GUI (and a different source for geolocation): expandcollapse popup#include <Array.au3> ; Required only for _ArrayDisplay(), but not the UDF! #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <file.au3> #include <GUIConstants.au3> #include <WinAPI.au3> #include <SendMessage.au3> #include <IE.au3> Opt("GUIOnEventMode", 1) Opt("GUICloseOnESC", 1) _Example_2() Func _Example_2() Local $Current, $Forecast, $Location = _GoogleWeather_Get() ; <<<<< Will use the IP default location. $Current = _GoogleWeather_Current($Location) ;~ _ArrayDisplay($Current, "_GoogleWeather_Current()") $Forecast = _GoogleWeather_Forecast($Location) ;~ _ArrayDisplay($Forecast, "_GoogleWeather_Forecast()") $Info = _GoogleWeather_Information($Location) ;~ _ArrayDisplay($Info, "_GoogleWeather_Information()") $TomTempHi = stringtrimright ($Forecast[1][1], 2) $TomTempLo = stringtrimright ($Forecast[1][2], 2) $AvgTemp = ($TomTempHi + $TomTempLo) / 2 Global $gui = GUICreate("", 250, 200, @DesktopWidth - 250, @DesktopHeight - 200 , $WS_POPUP , $WS_EX_LAYERED) GUISetBkColor(0x01, $gui) $id=GUICtrlCreateLabel($Info[1] & " " & $Info[3],50,25,200,100) GUICtrlSetfont($id,20 , 600) GUICtrlSetcolor($id,0xFF0000) $Ver = GUICtrlCreateLabel("It's " & $Current[2] & " and " & $Current[1] ,55,60,200,100) GUICtrlSetfont($Ver,10,600) GUICtrlSetcolor($Ver,0x000000) $SEC = GUICtrlCreateLabel("Tomorrow will be " & $Forecast[1][4] & " with an average temperature of " & $AvgTemp & " degrees.",55,80,200,100) GUICtrlSetfont($SEC,10,600) GUICtrlSetcolor($SEC,0x000FF) _WinAPI_SetLayeredWindowAttributes($gui, 0x01, 255) GUISetState(@SW_SHOW) while 1 GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_CLOSE, "GUI_CLOSE") wend EndFunc ;==>_Example_2 ; #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 ; #INDEX# ======================================================================================================================= ; Title .........: _GoogleWeather ; AutoIt Version : v3.3.2.0 or higher ; Language ......: English - uses www.google.com ; Description ...: Retrieves details about the weather in a specific region, using the 'undocumented' Google Weather API. ; Note ..........: ; Author(s) .....: guinness ; Remarks .......: ; =============================================================================================================================== ; #CURRENT# ===================================================================================================================== ; _GoogleWeather_Current: Retrieves details about the current weather status in a specific region. ; _GoogleWeather_Forecast: Retrieves details about the 4 day forecast for a specific region. ; _GoogleWeather_Get: Retrieves all data that will be parsed from the Google Weather API. ; _GoogleWeather_Information: Retrieves details about the general forecast information. ; =============================================================================================================================== ; #INTERNAL_USE_ONLY#============================================================================================================ ; __CelsiusToFahrenheit ......; Converts from Celsius to Fahrenheit ; __FahrenheitToCelsius ......; Converts from Fahrenheit to Celsius ; __GetIPLocation ............; Retrieves the IP City location ; =============================================================================================================================== ; #FUNCTION# ========================================================================================================= ; Name...........: _GoogleWeather_Current() ; Description ...: Retrieves details about the current weather status in a specific region. ; Syntax.........: _GoogleWeather_Current([$sRead]) ; Parameters ....: $sRead - [Optional] Only data returned from _GoogleWeather_Get() [Default = IP location] ; Requirement(s).: v3.3.2.0 or higher ; Return values .: Success - Returns a 1D Array. $Array[6] = [Number of Items, Condition data, Temp in F, Temp in C, Icon URL, Wind condition] ; Failure - Returns -1 & sets @error = 1 ; Author ........: guinness ; Example........; Yes ;===================================================================================================================== Func _GoogleWeather_Current($sRead = -1) Local $aXML[7] = [6, "condition data", _ "temp_f data", _ "temp_c data", _ "humidity data", _ "icon data", _ "wind_condition data"] Local $sReturn, $sConditions = "current_conditions" If $sRead = -1 Then $sRead = _GoogleWeather_Get() If @error Then Return SetError(1, 1, -1) $sReturn = StringRegExp($sRead, "<(?i)" & $sConditions & ">(.*?)</(?i)" & $sConditions & ">", 3) If @error Then Return SetError(1, 1, -1) $sRead = $sReturn[0] For $A = 1 To $aXML[0] $sReturn = StringRegExp($sRead, '(?i)<' & $aXML[$A] & '="(.*?)"/>', 3) If @error Then Return SetError(1, 1, 0) If $aXML[$A] = $aXML[2] Then $sReturn[0] = $sReturn[0] & ChrW(176) & "F" If $aXML[$A] = $aXML[3] Then $sReturn[0] = $sReturn[0] & ChrW(8451) If $aXML[$A] = $aXML[5] Then $sReturn[0] = "http://www.google.com" & $sReturn[0] $aXML[$A] = $sReturn[0] Next If Not @error Then Return $aXML Return SetError(1, 1, -1) EndFunc ;==>_GoogleWeather_Current ; #FUNCTION# ========================================================================================================= ; Name...........: _GoogleWeather_Forecast() ; Description ...: Retrieves details about the 4 day forecast for a specific region. ; Syntax.........: _GoogleWeather_Forecast([$sRead]) ; Parameters ....: $sRead - [Optional] Only data returned from _GoogleWeather_Get() [Default = IP location] ; $iTemperature - [Optional] 0 = Use Fahrenheit or 1 = Use Celsius [Default = 1] ; Requirement(s).: v3.3.2.0 or higher ; Return values .: Success - Returns a 2D Array. $Array[5][5] = $Array[0][0] - Number of Items ; [0][1] - Number Of Columns ; ; $Array[A][0] - Day of the week ; [A][1] - Temp high in C ; [A][2] - Temp low in C ; [A][3] - Icon URL ; [A][4] - Condition data ; Failure - Returns -1 & sets @error = 1 ; Author ........: guinness ; Example........; Yes ;===================================================================================================================== Func _GoogleWeather_Forecast($sRead = -1, $iTemperature = 0) Local $aXML[5] = ["day_of_week data", _ "high data", _ "low data", _ "icon data", _ "condition data"] Local $sReturn, $sConditions = "forecast_conditions" If $sRead = -1 Then $sRead = _GoogleWeather_Get() If @error Then Return SetError(1, 1, -1) $sReturn = StringRegExp($sRead, "<(?i)" & $sConditions & ">(.*?)</(?i)" & $sConditions & ">", 3) Local $iSize = UBound($sReturn, 1) Local $aReturn[$iSize + 1][5] = [[$iSize, 5]], $sReturnTest For $A = 0 To $iSize - 1 $sRead = $sReturn[$A] For $B = 0 To $aReturn[0][1] - 1 $sReturnTest = StringRegExp($sRead, '(?i)<' & $aXML[$B] & '="(.*?)"/>', 3) If $aXML[$B] = $aXML[1] Or $aXML[$B] = $aXML[2] Then Switch $iTemperature Case 0 $sReturnTest[0] = $sReturnTest[0] & ChrW(176) & "F" Case 1 $sReturnTest[0] = __FahrenheitToCelsius($sReturnTest[0]) EndSwitch EndIf If $aXML[$B] = $aXML[3] Then $sReturnTest[0] = "http://www.google.com" & $sReturnTest[0] $aReturn[$A + 1][$B] = $sReturnTest[0] Next Next If Not @error Then Return $aReturn Return SetError(1, 1, -1) EndFunc ;==>_GoogleWeather_Forecast ; #FUNCTION# ========================================================================================================= ; Name...........: _GoogleWeather_Get() ; Description ...: Retrieves all data that will be parsed from the Google Weather API. ; Syntax.........: _GoogleWeather_Get([$sLocation]) ; Parameters ....: $sLocation - [Optional] Specify a location to retrieve the weather information for. [Default = IP location] ; Requirement(s).: v3.3.2.0 or higher ; Return values .: Success - Returns data retrieved from the Google Weather API. ; Failure - Returns -1 & sets @error = 1 ; Author ........: guinness ; Example........; Yes ;===================================================================================================================== Func _GoogleWeather_Get($sLocation = -1) If $sLocation = -1 Then $sLocation = __GetIPLocation() ; <<<<< Slower, but a little more accurate. ;~ If $sLocation = -1 Then $sLocation = "New York" ; <<<<< Un-comment to use a generic location. Local $bRead, $sRead $bRead = InetRead("http://www.google.com/ig/api?weather=" & $sLocation) If @error Then Return SetError(1, 1, -1) $sRead = BinaryToString($bRead) Return $sRead EndFunc ;==>_GoogleWeather_Get ; #FUNCTION# ========================================================================================================= ; Name...........: _GoogleWeather_Information() ; Description ...: Retrieves details about the forecast information. ; Syntax.........: _GoogleWeather_Information([$sRead]) ; Parameters ....: $sRead - [Optional] Only data returned from _GoogleWeather_Get() [Default = IP location] ; Requirement(s).: v3.3.2.0 or higher ; Return values .: Success - Returns a 1D Array. $Array[6] = [Number of Items, City data, Postal data, Forecast data, Current time, Unit system] ; Failure - Returns -1 & sets @error = 1 ; Author ........: guinness ; Example........; Yes ;===================================================================================================================== Func _GoogleWeather_Information($sRead = -1) Local $aXML[6] = [5, "city data", _ "postal_code data", _ "forecast_date data", _ "current_date_time data", _ "unit_system data"] Local $sReturn If $sRead = -1 Then $sRead = _GoogleWeather_Get() If @error Then Return SetError(1, 1, -1) For $A = 1 To $aXML[0] $sReturn = StringRegExp($sRead, '(?i)<' & $aXML[$A] & '="(.*?)"/>', 3) If @error Then Return SetError(1, 1, 0) $aXML[$A] = $sReturn[0] Next If Not @error Then Return $aXML Return SetError(1, 1, -1) EndFunc ;==>_GoogleWeather_Information ; #INTERNAL_USE_ONLY#============================================================================================================ Func __CelsiusToFahrenheit($iTemperature) Return Round(($iTemperature * (212 - 32) / 100 + 32)) & ChrW(176) & "F" EndFunc ;==>__CelsiusToFahrenheit Func __FahrenheitToCelsius($iTemperature) Return Round(($iTemperature - 32) / 1.8) & ChrW(8451) EndFunc ;==>__FahrenheitToCelsius Func __GetIPLocation() Local $aXML[5] = [4], $bRead, $sRead, $sReturn $bRead = InetRead("http://www.whatismyipaddress.com/" , 1) $sRead = BinaryToString($bRead) $sReturnCity = StringRegExp ($sRead , '<tr><th>City:</th><td>(.*?)</td></tr>' , 3) $sReturnState = StringRegExp ($sRead , '<tr><th>Region:</th><td>(.*?)</td></tr>' , 3) $sCombo = $sReturnCity[0] & " , " & $sReturnState[0] ;~ msgbox (0, '' , $sCombo) Return $sCombo EndFunc ;==>__GetIPLocation FOR US CITIES!! ; #INTERNAL_USE_ONLY#============================================================================================================ Func GUI_Close() GUIDelete($gui) Exit EndFunc Edited January 6, 2011 by iamtheky ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
guinness Posted January 6, 2011 Author Share Posted January 6, 2011 (edited) Nice Example I wasn't able to run it as there were some errors, but I got the idea. Hope you don't mind but I tidied it up a bit and removed someof the Includes that weren't required. Edited October 8, 2012 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...
guinness Posted April 26, 2011 Author Share Posted April 26, 2011 (edited) I made a small syntax update to the OP and updated the GUI Example. Edited April 26, 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...
BrewManNH Posted April 26, 2011 Share Posted April 26, 2011 Nice Example I wasn't able to run it as there were some errors, but I got the idea. Hope you don't mind but I tidied it up a bit and removed some of the Includes that weren't required. And Thanks for the improved __GetIPLocation() still a little concerned about their TOS also >> http://whatismyipaddress.com/terms-of-useI noticed in the TOU for whatismyipaddress this line:•You may not use a script, agent, application or otherwise query this website in an automated fashion without prior written permissionFrom that line it's a violation of their TOS to use it the way that the _GetIP function inside Inet.au3 does it. Unless someone got written permission from them. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator Link to comment Share on other sites More sharing options...
guinness Posted October 16, 2011 Author Share Posted October 16, 2011 I've updated the UDF with improved syntax and an improved GUI example. I've also included everything in a ZIP file this time. See the original post for details. 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...
guinness Posted March 28, 2012 Author Share Posted March 28, 2012 I've updated the UDF with the following changes. Please see original post for details. Thanks.- CHANGED: Now uses https rather than http.- IMPROVED: Examples, by adding more comments.- IMPROVED: Source code of UDF by tidying it up and removing unwanted variables.- IMPROVED: Conversion of temperatures. 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...
guinness Posted October 8, 2012 Author Share Posted October 8, 2012 This UDF has been deprecated due to Google closing the doors on the (unsupported) Weather API. I have left the code as it is so others may learn from it. Thanks to all who used it. 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...
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