AzKay Posted August 12, 2007 Share Posted August 12, 2007 (edited) I was bored, So I made this. Enjoy.expandcollapse popup#include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Definition", 202, 242, 193, 115) $Input1 = GUICtrlCreateInput("", 8, 8, 185, 21) $Button1 = GUICtrlCreateButton("Define", 8, 32, 185, 17, 0) $ListView1 = GUICtrlCreateEdit("", 8, 56, 185, 177, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$WS_HSCROLL,$WS_VSCROLL,$ES_READONLY)) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 GUICtrlSetData($ListView1, "") $oRet = _Define(GUICtrlRead($Input1)) If Not @error Then For $i = 1 To $oRet[0] GUICtrlSetData($ListView1, $oRet[$i] & @CRLF, 1) Next Else GUICtrlSetData($ListView1, "No definition available" & @CRLF, 1) EndIf EndSwitch WEnd Func _Define($oWord) Local $oWordx, $oHTTP, $oWords $oHTTP = ObjCreate("Microsoft.XMLHTTP") $oHTTP.Open("GET", "http://www.google.com/search?hl=en&q=define:" & $oWord, False) $oHTTP.Send() $oWords = StringRegExp($oHTTP.ResponseText, "<font size=-1><li>(.*?)<br>", 3) For $i = 0 To UBound($oWords) -1 If $oWords[$i] <> "Web Images Groups News Froogle Local more» Advanced Search Preferences Language Tools AdvertisingPrograms - About Google ©2005 Google." Then $oWordx = $oWordx & $oWords[$i] & "#" EndIf Next $oWordx = StringTrimRight($oWordx, 1) $oWordx = StringReplace($oWordx, "'", "'") $oWordx = StringReplace($oWordx, "&", "&") $oWordx = StringReplace($oWordx, "<li>", "") $oWordx = StringReplace($oWordx, """, '"') $oWordx = StringReplace($oWordx, ">", ">") $oWordx = StringReplace($oWordx, "<", "<") $oWordx = StringReplace($oWordx, "–", "-") $oWordx = StringReplace($oWordx, "&" & "#39;", "'") If $oWordx <> "" Then $oWordx = StringSplit($oWordx, "#") Return $oWordx Else SetError(1) Return -1 EndIf EndFuncFEEDBACK PL0x.Oh, And feel free to add in more special characters.EDIT::Better example added. Edited September 21, 2007 by AzKay # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
Nahuel Posted August 13, 2007 Share Posted August 13, 2007 That actually looks useful.. but I can't get it to work. Could you post an example? Link to comment Share on other sites More sharing options...
AzKay Posted August 13, 2007 Author Share Posted August 13, 2007 That has an example; #include <Array.au3> $oWord = "Google" $oWord = _Define($oWord) _ArrayDisplay($oWord) # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
martin Posted August 13, 2007 Share Posted August 13, 2007 That has an example; #include <Array.au3> $oWord = "Google" $oWord = _Define($oWord) _ArrayDisplay($oWord) Neat! Here's one you missed $oWordx = StringReplace($oWordx, "'", "'");inverted comma 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...
AzKay Posted August 13, 2007 Author Share Posted August 13, 2007 Neat!Here's one you missed$oWordx = StringReplace($oWordx, "'", "'");inverted commaAdded x3 # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
martin Posted August 13, 2007 Share Posted August 13, 2007 Added x3I think the browser is converting the characters so you don't see the code in the post, so this is what needs to be in the code$oWordx = StringReplace($oWordx, "&" & "#39;", "'"); 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...
AzKay Posted August 13, 2007 Author Share Posted August 13, 2007 I think the browser is converting the characters so you don't see the code in the post, so this is what needs to be in the code$oWordx = StringReplace($oWordx, "&" & "#39;", "'");Ah, Makes sense. x3 # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
AzKay Posted September 21, 2007 Author Share Posted September 21, 2007 Anyone else find this useful? # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
Nahuel Posted September 21, 2007 Share Posted September 21, 2007 (edited) This part was extremely useful for me:Local $oWordx, $oHTTP, $oWords $oHTTP = ObjCreate("Microsoft.XMLHTTP") $oHTTP.Open("GET", "http://www.google.com/search?hl=en&q=define:" & $oWord, False) $oHTTP.Send() $oWords = StringRegExp($oHTTP.ResponseText, "<font size=-1><li>(.*?)<br>", 3)I use it all the time, it's awesome.Besides that, I made a script a while ago that would give you the definition of a word when the user highlights it and presses a key combination using your script. Unfortunately, I had a problem with my hd and lost everything (thank jebus some of my 'important' scripts were here) but you can figure out how it worked -edit- Look: http://www.autoitscript.com/forum/index.php?showtopic=51987 Edited September 21, 2007 by Nahuel Link to comment Share on other sites More sharing options...
AzKay Posted September 21, 2007 Author Share Posted September 21, 2007 This part was extremely useful for me: Local $oWordx, $oHTTP, $oWords $oHTTP = ObjCreate("Microsoft.XMLHTTP") $oHTTP.Open("GET", "http://www.google.com/search?hl=en&q=define:" & $oWord, False) $oHTTP.Send() $oWords = StringRegExp($oHTTP.ResponseText, "<font size=-1><li>(.*?)<br>", 3) I use it all the time, it's awesome. Besides that, I made a script a while ago that would give you the definition of a word when the user highlights it and presses a key combination using your script. Unfortunately, I had a problem with my hd and lost everything (thank jebus some of my 'important' scripts were here) but you can figure out how it worked -edit- Look: http://www.autoitscript.com/forum/index.php?showtopic=51987Very nice :3 # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
JSunn Posted September 21, 2007 Share Posted September 21, 2007 I actually really like this - would be useful as a widget that runs on the desktop to provide a quick definition. Good job! -John Link to comment Share on other sites More sharing options...
maqleod Posted September 23, 2007 Share Posted September 23, 2007 two suggestions: make the default action when enter is pressed while the cursor is in the input box to execute the define function make the gui wider so it is easier to read, or at least make the gui resizable [u]You can download my projects at:[/u] Pulsar Software Link to comment Share on other sites More sharing options...
Valuater Posted September 23, 2007 Share Posted September 23, 2007 Cool, Kay!!! 8) 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