Welcome Guest.   Make a donation to an author on the site October 21, 2014, 03:02:59 PM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
The N.A.N.Y. Challenge 2011! Download 30+ custom programs!
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1]   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: Select Random Line from Text File  (Read 5929 times)
Verathis
Participant
*
Posts: 4

View Profile Give some DonationCredits to this forum member
« on: November 17, 2008, 07:38:56 PM »

I'm looking for a program that selects a random line from a text file of my choice. There was something similar done here. But I don't want the thing to increase the chance with numbers. Also, my list has 3 spaces in front of each entry due to the program I used to generate the list. embarassed Not sure if that's needed or not, since it would just be displaying a random line.

It seems simple in nature, but I'm horrible with actual programming languages, so if someone could write this up for me, I'd be very grateful. Or if it's already been done and I'm missing it, just toss me a link. I'd prefer it be an exe, but if there is a website that will eat my txt file and give me a random entry from it, that would work too!
Logged
mhb
Charter Member
***
Posts: 22


There is no life before coffee!

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #1 on: November 18, 2008, 04:52:15 AM »

Hi Verathis,

just had a couple of free minutes available right now.... so here is a very simple solution:

In the AHK script you can define a default text file if you want, otherwise just call the EXE with the textfile as an argument
[copy or print]
RandomLine_simple.exe MyQuotes.txt

I hope it helps...

Marc

* RandomLine_simple.ahk (0.32 KB - downloaded 294 times.)
* RandomLine_simple.exe (198.87 KB - downloaded 263 times.)
Logged

There's nothing new under the sun,
but there are lots of old things we don't know. (Ambrose Bierce)
kartal
Supporting Member
**
Posts: 1,529


View Profile Give some DonationCredits to this forum member
« Reply #2 on: November 18, 2008, 08:13:59 AM »

I hope that this kind of software is not used for "spamming"
« Last Edit: November 18, 2008, 08:18:07 AM by kartal » Logged
jgpaiva
Global Moderator
*****
Posts: 4,710



Artificial Idiocy

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #3 on: November 18, 2008, 08:53:34 AM »

Verathis: With mhb's solution, you can also just drop the .txt file on the .exe file Wink
Logged

mhb
Charter Member
***
Posts: 22


There is no life before coffee!

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #4 on: November 18, 2008, 08:55:03 AM »

Hi kartal,

I don't think this program is going to support spamming, BUT I wouldn't be too surprised if suddenly somebody new to this forum suggests a website or tool "which is really good for this purpose"  Wink

Greetings,
Marc
Logged

There's nothing new under the sun,
but there are lots of old things we don't know. (Ambrose Bierce)
Verathis
Participant
*
Posts: 4

View Profile Give some DonationCredits to this forum member
« Reply #5 on: November 18, 2008, 05:05:26 PM »

Wow, that works great! Thanks a ton, everybody!

And no, it's not for spamming. Not sure how it could be used for that anyway. But I plan on writing some reviews for a friend's website, and instead of me going through and picking each and every thing each time, I figured it'd be better to have something pick it randomly, as I have a rather huge list of things I can review (1600+).
Logged
Verathis
Participant
*
Posts: 4

View Profile Give some DonationCredits to this forum member
« Reply #6 on: November 18, 2008, 06:23:51 PM »

mhb, would you happen to have the source for that exe? I'm a beginner in programming, and I'd like to see how that works.
Logged
mhb
Charter Member
***
Posts: 22


There is no life before coffee!

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #7 on: November 24, 2008, 06:44:39 AM »

Hi Verathis,

sorry to reply this late, but I am moving right now and had no internet access during the last days.
You can check the source code in the .ahk file, which is one of the attached downloads to my original reply. Just open that file in an editor and you have the source code...

I have to admit,  I didn't comment the code, which is really bad programming practice, but it was just a shorty :-)

Greetings,
Marc
Logged

There's nothing new under the sun,
but there are lots of old things we don't know. (Ambrose Bierce)
Verathis
Participant
*
Posts: 4

View Profile Give some DonationCredits to this forum member
« Reply #8 on: December 01, 2008, 05:34:50 PM »

It's fine, I really wasn't in a hurry to get it. I'm fairly new to AHK, so I didn't know the source came in the .ahk file. Thanks for all the help!
Logged
Pages: [1]   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.035s | Server load: 0.28 ]