Home   Archive   Permalink

How to Select a Single record from text file.

Pls help me.What I want to do is load a list of thousands of words from a text file and select a single word randomly and then show that word in a label or field or give an alert about it. Pls help me I have been trying it for many days but none code works.Please help me.

posted by:   Sagar       16-Sep-2014/3:58:52-7:00

This is untested but should be close to what you need.
R E B O L []
word-list: parse read %file.txt none ; read the file file.txt then use parse to break the strings into a block
word: first random word-list ;pick a random string from the block
alert word ; display the word in an alert window

posted by:   johnk       16-Sep-2014/7:33:46-7:00

Thanks John,I tried the above code but it doesnt work.

posted by:   Sagar       16-Sep-2014/9:24:05-7:00

do %r3-gui.r3
random/seed now
write %file.txt "asdf sdfg dfgh fghj"
word-list: parse to-string read %file.txt none
wrd: first random word-list
alert wrd

posted by:   Nick       16-Sep-2014/12:27:19-7:00

Thankyou very very much Nick.The Code worked.All thanks to you.Can you please tell me more about the parse command and the the random/seed,to-string and word-list commands and pls can u provide a full detail list of all the commands.

posted by:   Sagar       17-Sep-2014/23:13:20-7:00

And can you pls help me in how can i use the rebgui3.Currently I am using rebol 2.7 and I dont know much about rebol3 and its deployment of apps.I am a vb6 programmer since 7 yrs.I was finding for a language same a like vb6 which will be simple and found rebol,now I am going to transfer my all softwares in rebol.Can you please help me if I stuck in any problem during converting those to rebol.I am going to upload all my apps made in rebol on the forum.And also last thing please help me out in using ms access database with rebol.

posted by:   Sagar       17-Sep-2014/23:20:37-7:00