+ Post New Thread
Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 31
How do you do....it? Thread, Select Single Paragraph From Text File At Random in Technical; Strange that, not really sure what might have caused it. Anywho, don't know if you saw my edited post above, ...
  1. #16

    LosOjos's Avatar
    Join Date
    Dec 2009
    Location
    West Midlands
    Posts
    5,447
    Thank Post
    1,438
    Thanked 1,168 Times in 797 Posts
    Rep Power
    707
    Strange that, not really sure what might have caused it. Anywho, don't know if you saw my edited post above, there's an updated version there that will dump any errors to the command line rather than them popping up, it won't disturb your students then plus if you get the error again, I'll have a better idea why if you tell me what the error says in the command line

  2. #17

    DaveP's Avatar
    Join Date
    Oct 2006
    Location
    Can't talk now: The mother-ship is calling!
    Posts
    8,788
    Thank Post
    351
    Thanked 1,274 Times in 870 Posts
    Blog Entries
    4
    Rep Power
    1126
    Quote Originally Posted by LosOjos View Post
    Strange that, not really sure what might have caused it. Anywho, don't know if you saw my edited post above, there's an updated version there that will dump any errors to the command line rather than them popping up, it won't disturb your students then plus if you get the error again, I'll have a better idea why if you tell me what the error says in the command line
    Excellent work! Thanks again.

  3. #18

    DaveP's Avatar
    Join Date
    Oct 2006
    Location
    Can't talk now: The mother-ship is calling!
    Posts
    8,788
    Thank Post
    351
    Thanked 1,274 Times in 870 Posts
    Blog Entries
    4
    Rep Power
    1126
    @LosOjos [or anyone else who might be able to help with this]

    Now that I can select and display randomly selected text with GetLine I had the thought that, perhaps, Getline can also help with another BGInfo problem I am having:

    I get BGInfo to display some other information which helps me when assisting my users remotely. The station IP address is what I am interested in here. I have recently made changes as to how the IP address is accessed/displayed by BGInfo [because it would often display valid and non valid IPs on two lines: See below]

    169.168.1.200
    0.0.0.0

    What it does now is write the valid IP address to a file and then query that. However for some reason the IP address is written to the file twice so that I get:

    169.168.1.200,169.168.1.200

    Is there any way that I can use GetLine to strip out only one copy of the valid IP or the left-most IP?

    Many thanks.

  4. #19

    LosOjos's Avatar
    Join Date
    Dec 2009
    Location
    West Midlands
    Posts
    5,447
    Thank Post
    1,438
    Thanked 1,168 Times in 797 Posts
    Rep Power
    707
    Quote Originally Posted by DaveP View Post
    Is there any way that I can use GetLine to strip out only one copy of the valid IP or the left-most IP?
    Not in it's current state, but I'll gladly add in a command line option for you that allows you to return a certain column from a CSV (which is essentially what BGInfo seems to be returning).

    Gimme half hour

  5. Thanks to LosOjos from:

    DaveP (12th July 2010)

  6. #20

    DaveP's Avatar
    Join Date
    Oct 2006
    Location
    Can't talk now: The mother-ship is calling!
    Posts
    8,788
    Thank Post
    351
    Thanked 1,274 Times in 870 Posts
    Blog Entries
    4
    Rep Power
    1126
    Quote Originally Posted by LosOjos View Post
    Not in it's current state, but I'll gladly add in a command line option for you that allows you to return a certain column from a CSV (which is essentially what BGInfo seems to be returning).

    Gimme half hour
    Absolutely stellar. I would add to your Rep but I have done that too recently for you so have a 'Thanks' instead.

    Edit: BGInfo currently gets the IP address from a file called IP.TXT [If that matters?]
    Last edited by DaveP; 12th July 2010 at 01:19 PM. Reason: Clarify post content.

  7. #21

    LosOjos's Avatar
    Join Date
    Dec 2009
    Location
    West Midlands
    Posts
    5,447
    Thank Post
    1,438
    Thanked 1,168 Times in 797 Posts
    Rep Power
    707
    Quote Originally Posted by DaveP View Post
    BGInfo currently gets the IP address from a file called IP.TXT [If that matters?]
    I imagine that IP.TXT is the file you want to pass to GetLine to get the IP address then.

    Here is the new version with support for CSV/TSV files: GetLine.zip

    Usage is as follows:

    Code:
    Usage:
         getline /IN:"Source.txt" /OUT:"Destination.txt"
                  [/L:Line Number]
                  [/COL:Column Number (CSV/TSV File)]

    So for your needs, it's be something like:

    Code:
    getline /IN:"IP.TXT" /OUT:"REAL_IP.TXT" /L:1 /COL:1

    EDIT: that's assuming of course that the IP address is on the first line and in the first 'column' (before the first comma).

    Let me know if you have any trouble

  8. Thanks to LosOjos from:

    DaveP (12th July 2010)

  9. #22

    DaveP's Avatar
    Join Date
    Oct 2006
    Location
    Can't talk now: The mother-ship is calling!
    Posts
    8,788
    Thank Post
    351
    Thanked 1,274 Times in 870 Posts
    Blog Entries
    4
    Rep Power
    1126
    @LosOjos: Thanks again for your help.

    I now have REALIP.TXT working. Now I just have to get BGInfo to show it which it is refusing to do at the moment.

    Problem for another day. Time for a cooling pint...

    Edit: Permissions for IP.TXT and RealIP.TXT differ. That could be the answer!
    Last edited by DaveP; 12th July 2010 at 03:45 PM.

  10. #23

    LosOjos's Avatar
    Join Date
    Dec 2009
    Location
    West Midlands
    Posts
    5,447
    Thank Post
    1,438
    Thanked 1,168 Times in 797 Posts
    Rep Power
    707
    Quote Originally Posted by DaveP View Post
    Time for a cooling pint...
    Sounds like a fantastic idea to me!

    Always feel free to request more features, I'm an old skool geek who enjoys a little programming to break up my day

  11. Thanks to LosOjos from:

    ba9ag (2nd August 2010)

  12. #24

    Join Date
    May 2009
    Posts
    103
    Thank Post
    11
    Thanked 5 Times in 5 Posts
    Rep Power
    11
    Hi LosOjos

    I have just been trying your getline code out as I also had problems with reduandant IPs being displayed on some machines. Works great but a slight issue I have come across is on machines where there are not multiple IPs, the text in IP.txt will be something like 192.168.1.1. Then when you run getline on this it falls over and comes up with the message "This is not a comma/tab seperated file" and outputs nothing to RealIP.txt if this makes sense!

    Would it be possible to add a check to the code where if only a single entry exists then it passes this onto RealIP.txt and if there are multiples it only passes the first entry?

    Thanks for all your input!

    Paul

  13. #25

    DaveP's Avatar
    Join Date
    Oct 2006
    Location
    Can't talk now: The mother-ship is calling!
    Posts
    8,788
    Thank Post
    351
    Thanked 1,274 Times in 870 Posts
    Blog Entries
    4
    Rep Power
    1126
    I have started to notice the same issue reported by ba9ag:

    Where historically I could expect my IP.TXT file would contain something like:

    192.168.1.201,192.168.1.201

    some of my stations' IP.TXT files have only the first entry:

    192.168.1.201

    GetLine then gives the error:

    This is not a comma/tab seperated file
    How can I resolve this?

  14. #26

    LosOjos's Avatar
    Join Date
    Dec 2009
    Location
    West Midlands
    Posts
    5,447
    Thank Post
    1,438
    Thanked 1,168 Times in 797 Posts
    Rep Power
    707
    Hi both, sorry it's been an age since I logged in. I don't have the code on the machine I'm on at the moment, it's on my laptop at home, when I get home I'll tweak it so that it just returns the specified line when it detects that the file isn't a CSV/TSV.

    I'll post the new version up tomorrow for you

  15. Thanks to LosOjos from:

    DaveP (19th August 2010)

  16. #27

    DaveP's Avatar
    Join Date
    Oct 2006
    Location
    Can't talk now: The mother-ship is calling!
    Posts
    8,788
    Thank Post
    351
    Thanked 1,274 Times in 870 Posts
    Blog Entries
    4
    Rep Power
    1126
    Thanks again with all of your help on this.

  17. #28

    LosOjos's Avatar
    Join Date
    Dec 2009
    Location
    West Midlands
    Posts
    5,447
    Thank Post
    1,438
    Thanked 1,168 Times in 797 Posts
    Rep Power
    707
    Just a quick update: sorry to keep you waiting! Been a hectic couple of weeks for me personally so I haven't gotten round to this yet (taking on a second job is very tiring!) but I will get it sorted by the weekend. Sorry again to keep you waiting, just thought I'd post an update so you don't think I've forgotten about it!

  18. #29

    DaveP's Avatar
    Join Date
    Oct 2006
    Location
    Can't talk now: The mother-ship is calling!
    Posts
    8,788
    Thank Post
    351
    Thanked 1,274 Times in 870 Posts
    Blog Entries
    4
    Rep Power
    1126
    That is good to hear. I wouldn't push this: You are helping and I look forward to having the solution.

    Thanks again.

  19. #30

    LosOjos's Avatar
    Join Date
    Dec 2009
    Location
    West Midlands
    Posts
    5,447
    Thank Post
    1,438
    Thanked 1,168 Times in 797 Posts
    Rep Power
    707
    Finally got round to tweaking it for you! I strongly suggest you test it out first as I haven't had the time to, things are manic here right now, but it should now return the selected line from a file even if it was expecting columns, with a message posted to the command prompt to let you know that's what it has done.

    Any problems let me know and I'll do my best to solve them a lot quicker this time.

    GetLine.zip

  20. Thanks to LosOjos from:

    DaveP (6th September 2010)

SHARE:
+ Post New Thread
Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. RM Ascend 2050 random text
    By dhoward_westexetc in forum Hardware
    Replies: 5
    Last Post: 6th November 2009, 06:12 PM
  2. Batch File (select random file) help
    By fil_b in forum Windows Server 2000/2003
    Replies: 5
    Last Post: 5th November 2009, 04:13 AM
  3. password protect a single file
    By rocknrollstar in forum Windows
    Replies: 15
    Last Post: 30th July 2009, 09:21 AM
  4. Outlook 2003 random e-mails not showing text
    By phreak in forum Office Software
    Replies: 0
    Last Post: 23rd July 2009, 03:30 PM
  5. Multiple People Accessing single file
    By Nij.UK in forum Windows
    Replies: 6
    Last Post: 5th June 2006, 08:52 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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