Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Fetching random lines from different text files

    Hey all.

    I'm looking for a way to have a single, random line fetched from multiple text files, and then have that combination output somewhere, whether just to some field or another text file.

    For example:

    Text file A -
    • I like
    • I hate
    • I love
    • I despise
    • I cherish


    Text file B -
    • apples
    • bananas
    • oranges
    • grapes
    • grapefruit
    • pineapple
    • cherries


    Text file C -
    • some of the time.
    • most of the time.
    • a lot of the time.
    • pretty much never.


    So it would go in, get a line from each, and display something like:

    I love - grapefruit - most of the time.
    I cherish - pineapple - some of the time.

    etc. etc.

    I know it's a weird-sounding example, but you get the point. The line choices don't have to be separated by hyphens, but they preferably would be separated by something, like a comma, semi-colon, slash, whatever.

    I know this is pretty much a web coding forum, so that would be fine if I had to host it on my server or open it with a browser. But it would be optimal if this could be made into a standalone executable.

    I'm basically looking for something like Random Line Picker, just with the added functionality I mentioned.

    I'd be willing to make a little donation to someone if coding this would be a little difficult.

    Thanks!
    Last edited by Ryderov; 08-01-2011 at 01:58 AM. Reason: typo in title

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    26,536
    Thanks
    80
    Thanked 4,490 Times in 4,454 Posts
    So you want to run this from the desktop?

    On a Windows box or otherwise?

    If on Windows, you can write it in JavaScript and execute it using the Windows Script Host.

    But you do realize that in order to deploy it to another computer then you'd have to copy not only the code but all the text files to that other computer. And that other computer would have to be running Windows.

  • #3
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    In Windows, yes. And being able to run it locally (on one PC) is all I want.

    As far as writing it in JavaScript and executing it using the Windows Script Host, I'm pretty much a coding nub. I'm essentially looking for someone with the know how to make it for me.

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    26,536
    Thanks
    80
    Thanked 4,490 Times in 4,454 Posts
    Send me private message.

    If you don't care about it being in JS, I'll throw together an example in VBS for you that should work.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •