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
@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]
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:
Is there any way that I can use GetLine to strip out only one copy of the valid IP or the left-most IP?
Last edited by DaveP; 12th July 2010 at 02:19 PM. Reason: Clarify post content.
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
@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 04:45 PM.
ba9ag (2nd August 2010)
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!
I have started to notice the same issue reported by ba9ag:
Where historically I could expect my IP.TXT file would contain something like:
some of my stations' IP.TXT files have only the first entry:
GetLine then gives the error:
How can I resolve this?This is not a comma/tab seperated file
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
DaveP (19th August 2010)
Thanks again with all of your help on this.
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!
That is good to hear. I wouldn't push this: You are helping and I look forward to having the solution.
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.
DaveP (6th September 2010)
There are currently 1 users browsing this thread. (0 members and 1 guests)