Jump to content

Aquiring or Generating Random words or phrases?


Gui
 Share

Recommended Posts

Aye guys, I was wondering if there was a good method of getting random words and phrases from not only maybe IE, but somewhere else, and have them to use in your program that your making? Simply, I want to have a words and phrases list that is always changing and that I can use inside a program, or in a GUI. Is it possible? Or if there is a different method of getting random words and phrases, I'd love to know o.O. Thanks guys.

PS: Generating real words is ok too.

GUI.

Edited by Gui
Link to comment
Share on other sites

Yes, you are allowed to bump, but you should wait 24 hours to give people in different time zones a chance to view your post.

Two web sites that will generate words for you are here and here. Use IE commands to get your word. You could also just compile a small dictionary text file. Each line would have one word. Generate a random line number, read the word, and that is your random word. This would probably be faster, but would be limited on the words it can produce.

Link to comment
Share on other sites

It will be used by other people, so they won't have the text file :). I was hoping there was a handy function that created random words or phrases, that would be wonderful. I just wanted a way that would be seen, to get em'. Thanks for the help by the way.

Link to comment
Share on other sites

Is there a function that can do it? I don't want to run an external program to get the words, that's why. If you used those websites, then you would have to run it externally like in an Obj to get the words..

Link to comment
Share on other sites

Is there a function that can do it? I don't want to run an external program to get the words, that's why. If you used those websites, then you would have to run it externally like in an Obj to get the words..

There is no existing function to do what you want. Feel free to write one though.

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

Link to comment
Share on other sites

It will be used by other people, so they won't have the text file :). I was hoping there was a handy function that created random words or phrases, that would be wonderful. I just wanted a way that would be seen, to get em'. Thanks for the help by the way.

Maybe
FileInstall
is what you're looking for.

Just stick the text file in a random location on your users PC lol.

Edit: Glad you found a solution that works for you.

Edited by jebus495
Link to comment
Share on other sites

Are there any other sites that generate? Basically I ran an $oIE Object that was hidden, to one of those word generator sites, and since everytime you visit them, there is a different word. So I just pulled the words and phrases off there. After a while the site shuts down though..Ugh. This is what the script looks like. Just when it inserts the edit box, It overwrites. I have to fix that, but you can see if you want..Just need to fix the edit problem, but there has to be a better way, lol. Again, other sites that make a word everytime you visit? And if theres other idea's on doing this, fill free to share :).

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
#Include <Misc.au3>
#include <EditConstants.au3>
#Include <GuiEdit.au3>
#Include <Timers.au3>
#Include <GuiToolBar.au3>
#NoTrayIcon
#include <Constants.au3>
#include <GUIStatusBar.au3>
#include <StaticConstants.au3>
#include <GUImenu.au3>
#include <GUIListView.au3>
#include <GUIListBox.au3>
#include <File.au3>
#include <ProgressConstants.au3>

Global $running = 0
Opt("TrayOnEventMode",1)
Opt("TrayMenuMode",1)
Opt("TrayIconHide", 0)

TraySetOnEvent($TRAY_EVENT_PRIMARYUP,"SpecialEvent")
TraySetState()
Global $running = 0
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Words n Phrases", 304, 210, 194, 124)
$words = GUICtrlCreateList("", 8, 8, 137, 177)
$Button1 = GUICtrlCreateButton("Save List", 152, 160, 107, 25)
$mtray = GUICtrlCreateButton("Minimize to Tray", 152, 128, 107, 25)
$start = GUICtrlCreateButton("Start", 152, 96, 107, 25)
$Radio1 = GUICtrlCreateRadio("Words", 160, 16, 113, 17)
$Radio2 = GUICtrlCreateRadio("Phrases", 160, 40, 113, 17)
$StatusBar1 = _GUICtrlStatusBar_Create($Form1)
Dim $StatusBar1_PartsWidth[1] = [-1]
_GUICtrlStatusBar_SetParts($StatusBar1, $StatusBar1_PartsWidth)
_GUICtrlStatusBar_SetText($StatusBar1, "Items Aquired : ", 0)
$Radio3 = GUICtrlCreateRadio("Both", 160, 64, 113, 17)
$oIE = _IECreateEmbedded()
$WORD = GUICtrlCreateObj($oIE,16,26,100,100)
GUICtrlSetState($WORD,$GUI_HIDE)
GUIRegisterMsg($WM_COMMAND,'command')
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Func command($hwnd,$msg,$wparam,$lparam)
    $nNotifyCode = BitShift($wparam, 16)
    $nID = BitAND($wparam, 0x0000FFFF)
    If $nID = $start Then
        If GUICtrlRead($start) = 'Start' Then
            $running = 1
            GUICtrlSetData($start,'Stop')
        ElseIf GUICtrlRead($start) = 'Stop' Then
            $running = 0
            GUICtrlSetData($start,'Start')
        EndIf
    EndIf

    If $nID = $mtray Then
        If GUICtrlRead($mtray,'Minimize to Tray') Then
            $running = 1
            TraySetIcon("C:\Users\Henry\Desktop\Bots and Scripting Needs\Zero Icon.ico")
            GuiSetState(@SW_HIDE)
            TraySetState(1); show
            TraySetToolTip ("Click to Restore.")
        EndIf
    EndIF
            
EndFunc

While 1
$nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $start
            start()
        Case GUICtrlRead($Radio1) = $GUI_CHECKED 
            $oURL = 'http://watchout4snakes.com/CreativityTools/RandomWord/RandomWord.aspx'
                $oID = 'tmpl_main_lblWord'
        Case GUICtrlRead($Radio2) = $GUI_CHECKED
            $oURL = 'http://watchout4snakes.com/CreativityTools/RandomWord/RandomPhrase.aspx'
                $oID = 'tmpl_main_lblPhrase'
        Case GUICtrlRead($Radio3) = $GUI_CHECKED
            $x = Round(Random(1,2)
                If $x = 1 Then
                    $oURL = 'http://watchout4snakes.com/CreativityTools/RandomWord/RandomWord.aspx'
                        $oID = 'tmpl_main_lblWord'
                ElseIf $x = 2 Then
                    $oURl = 'http://watchout4snakes.com/CreativityTools/RandomWord/RandomPhrase.aspx'
                        $oID = 'tmpl_main_lblPhrase'
                EndIf
    EndSwitch
WEnd

Func SpecialEvent()
    GuiSetState(@SW_Show)
    TraySetState(2); hide
EndFunc

Func start()
    While $running
        For $x = 0 To 999999999
            _IENavigate($oIE,$oURL)
                $ra = _IEGetObjById($oIE,$oID)
                    $ma = _IEPropertyGet($ra,'innertext')
                        _GUICtrlListBox_AddString($words,$ma)
            _GUICtrlStatusBar_SetText($StatusBar1,'Items Aquired : ' & $x)
        Next
    WEnd
ENdFunc
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...