Jump to content

Recommended Posts

Posted

Hi.

I can't seem to get this to work. I've been reading the forums and testing stuff and I still don't understand why it doesn't work.

#include <FF.au3>
#include <trimmer.au3>

_FFStart("about:blank","default",1,False)
$dict=ClipGet()

;Removes spaces before and after the string.
$dict=_ALLTRIM($dict)

;Split the string into words.
$dict2=StringSplit($dict," ")

Do
    _FFOpenURL("http://dictionary.reference.com/browse/" & $dict2[$n],True)
    If _FFSearch("No results found for " & $dict2[$n]) Then
        If _FFSearch("Did you mean ") Then
                        ;Need to get their suggested word. (Did you mean suggestedword?)
                        ;Doesn't work here!
            $tempstring=StringRegExpReplace(_FFReadText(),'Did you mean \b([a-zA-Z]+)\b\?','\1')
            $dict2[$n]=$tempstring
        Else
            $dict2[$n]=""
        EndIf
    EndIf
    $n=$n+1
Until $n>=UBound($dict2)

;Do something here

_FFQuit()

Any help would be appreciated.

Posted

What is the initial string ans what should the string look like after RegExp? (I cannot run your script @work)

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Posted

_FFReadText returns the entire webpage's text. I don't know if there's a more pratical/faster way to do it tho.

The final string should only be the suggested word, if there's any. Else it returns blank.

Posted

Hi.

I can't seem to get this to work. I've been reading the forums and testing stuff and I still don't understand why it doesn't work.

#include <FF.au3>
#include <trimmer.au3>

_FFStart("about:blank","default",1,False)
$dict=ClipGet()

;Removes spaces before and after the string.
$dict=_ALLTRIM($dict)

;Split the string into words.
$dict2=StringSplit($dict," ")

Do
    _FFOpenURL("http://dictionary.reference.com/browse/" & $dict2[$n],True)
    If _FFSearch("No results found for " & $dict2[$n]) Then
        If _FFSearch("Did you mean ") Then
                        ;Need to get their suggested word. (Did you mean suggestedword?)
                        ;Doesn't work here!
            $tempstring=StringRegExpReplace(_FFReadText(),'Did you mean \b([a-zA-Z]+)\b\?','\1')
            $dict2[$n]=$tempstring
        Else
            $dict2[$n]=""
        EndIf
    EndIf
    $n=$n+1
Until $n>=UBound($dict2)

;Do something here

_FFQuit()

Any help would be appreciated.

You can read the suggested word with:

; ...
If _FFSearch("Did you mean ") Then
  $tempstring=_FFXPath("//div[@class='dym']//a")
  $dict2[$n]=$tempstring
Else
; ....

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
×
×
  • Create New...