gseller Posted November 4, 2007 Share Posted November 4, 2007 (edited) Hey all, Thanks to Nahuel for helping me and Smoke_N's function and INETGetSource and StringRegExp we can now tap into www.google.com Latest API for time and timezone information. They way it works is if you go to www.google.com and type for your search "time morocco" you will get the time and date and timezone information at the top of the search. I was having fits getting this to work and Nahuel helped me get-R-done in the help section...Herer is the file: Please give me some feedback, I still have a slight bug in that it still shows the < b > tags in the string. I tried working them out but coulcn't get the right StringRegExp. If someone can work that out and post it would be awesome.. google_worldtime.au3Updated:: Added martin's suggestion Post #2 Updated:: Corrected the erroring out if not found and closing. Updated:: Added martins new improved functionUpdated:: made cosmetic changesUpdated:: Added Copy to clipboardUpdated:: Preset ButtonsAny new ideas are awesomely appreciated. Edited November 7, 2007 by gesller Link to comment Share on other sites More sharing options...
martin Posted November 4, 2007 Share Posted November 4, 2007 Hey all, Thanks to Nahuel for helping me and Smoke_N's function and INETGetSource and StringRegExp we can now tap into www.google.com Latest API for time and timezone information. They way it works is if you go to www.google.com and type for your search "time morocco" you will get the time and date and timezone information at the top of the search. I was having fits getting this to work and Nahuel helped me get-R-done in the help section... Herer is the file: Please give me some feedback, I still have a slight bug in that it still shows the < b > tags in the string. I tried working them out but coulcn't get the right StringRegExp. If someone can work that out and post it would be awesome.. To get rid of the bold tags you could just do this $aSRE[0] = StringReplace($aSRE[0],'<b>','') Return StringReplace($aSRE[0],'</b>','') Needs some work though because I get '0.' for London and Paris. New York and Morocco work ok though. (Stopped trying after that.) Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
sandman Posted November 4, 2007 Share Posted November 4, 2007 (edited) London and Paris, when searched on Google, have other bolded values below them for cities in the US called Paris and London. I guess that breaks the regular expression.(Try searching "time london" and "time paris" to see what I'm talking about; compare those to "time new york" and "time morocco".)It's a pretty cool script, though; good job gesller! Edited November 4, 2007 by sandman [center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center] Link to comment Share on other sites More sharing options...
gseller Posted November 4, 2007 Author Share Posted November 4, 2007 Thank You, thank you! I will be using this one at work alot. I know about the added info for like you said london or russia or someplace that has multiple time zones but don't know how I could go about setting it up to grab the entire expression from google. Any ideas would be very welcome.. Link to comment Share on other sites More sharing options...
martin Posted November 6, 2007 Share Posted November 6, 2007 Thank You, thank you! I will be using this one at work alot. I know about the added info for like you said london or russia or someplace that has multiple time zones but don't know how I could go about setting it up to grab the entire expression from google. Any ideas would be very welcome.. This is a rather crude way to get the times for the first city found when there is more than one, or more than one time zone. StringRegExp is the best way but I can't see how to do it either. Func _GoogleTime($sCity) Dim $sSource[10],$n $ss='alt="Clock"></td><td valign=top><b>' $n = 0 $sSource = _INetGetSource("http://www.google.com/search?hl=en&q=time+" & $sCity) $aSRE=StringRegExp($sSource,'<(?i)td valign=middle><(?i)b>(.*?)<(?i)/td>',3) If $aSRE = 1 Then ;FileWrite($sCity & ".tme",$sSource) $a = StringInStr($sSource,'alt="Clock"></td><td valign=top><b>') $sSource = StringMid($sSource,StringInStr($sSource,$ss) + StringLen($ss),100) $sSource = StringReplace($sSource,'<br><table border=0','|') $aSRE = StringSplit($sSource,'|') If $aSRE[0] = 1 Then MsgBox(4096,"Location", "NOT FOUND") Else $aSRE[1] = StringReplace($aSRE[1],'<b>','') Return StringReplace($aSRE[1],'</b>','') Return $aSRE[1] EndIf Else $aSRE[0] = StringReplace($aSRE[0],'<b>','') Return StringReplace($aSRE[0],'</b>','') EndIf EndFunc;==>_GoogleTime() Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
ReFran Posted November 6, 2007 Share Posted November 6, 2007 For a qick overview you may spent a link:http://www.timeticker.comHTH, Reinhard Link to comment Share on other sites More sharing options...
gseller Posted November 7, 2007 Author Share Posted November 7, 2007 @ sandman - The london Paris issue is corrected with martin's new function @ martin - Sweet Fix!! Thank You! @ ReFran - I remember seeing that back in the late 90's was way to loud then and is even more so now.. LOL Please give the new file in first post a try to see if this works for you? Thanks all for your help and support, hope someone gets some use out of this. I know everyone in my office will LOL Please keep the ideas coming. I want to add or create a Google spellcheck into this if anyone has ideas? Link to comment Share on other sites More sharing options...
martin Posted November 7, 2007 Share Posted November 7, 2007 Please keep the ideas coming. I want to add or create a Google spellcheck into this if anyone has ideas?Skizmata did a good sspellchecker and so did Toady. AzKay did a very neat online _Define. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
gseller Posted November 7, 2007 Author Share Posted November 7, 2007 Yes, I love the one Skizmata did and have been tinkering with it to see if I could change it to do editing within a listview or edit (for my purposes)but no luck so far. I will have to search for Toady's, have not seen it yet. Thank you... Link to comment Share on other sites More sharing options...
ReFran Posted November 7, 2007 Share Posted November 7, 2007 Hi, looks good now .... also if I would prefer to see 22:30 (international time format) instead of 10:30 pm. Where is the button to update the system time? Where is the button for "Sterkrade" (the part of the town where I live). Best regards, Reinhard Link to comment Share on other sites More sharing options...
gseller Posted November 8, 2007 Author Share Posted November 8, 2007 Hi,looks good now .... also if I would prefer to see 22:30 (international time format) instead of 10:30 pm.Where is the button to update the system time? Where is the button for "Sterkrade" (the part of the town where I live).Best regards, Reinhard@ReFranThis will update your system time. http://www.autoitscript.com/forum/index.php?showtopic=55907"Sterkrade" is not defined by google to have a time setup. Sorry... Also, I do not see that google offers this military/24hr time format. You could add a clock device to the existing script to have it add to the time format or adjust the regexpression but is not something I wish to pursue for mine script. What you make of my script can be anything you wish. The code is there... Enjoy! Link to comment Share on other sites More sharing options...
LIMITER Posted February 14, 2008 Share Posted February 14, 2008 (edited) Cool script gesller I like it ... Edited February 14, 2008 by LIMITER 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