#58508 - 2001-08-23 05:59 PM
How do I enumerate a rasphone.pbk heading?
|
Anonymous
Anonymous
Unregistered
|
I want to use kix to parse a dialup heading name e.g. [xxxxx] based on a specific tel no i.e. 1877 1231234 from a rasphone.pbk entry into a variable, and then assign the heading name as a value name to a registry setting on my ISA server to force the specific tel no. users to receive use the ISA proxy settings when they dialin. My problem is I am not sure how to parse the entry heading based on this tel no., since the rasphone.pbk contains more than one heading for other tel nos. I know the phone no, but not the name heading which could be anything and that is what I want to use. Any help will be smashing. Thanks
|
|
Top
|
|
|
|
#58509 - 2001-08-23 07:46 PM
Re: How do I enumerate a rasphone.pbk heading?
|
Les
KiX Master
   
Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
|
So, let me get this straight. You want to:1. Parse through RASPhone.pbk 2. Capture the heading inside [brackets] to a $var 3. Parse for 'PhoneNumber=' line and test for a match on phone number 4. If no match, capture next heading to $var 5. If match found, keep header it was found under 6. Bob's your uncle Possible problem I forsee is the format of phone number. Some may include hyphens, some spaces, some fewer digits, etc. Can you search on subset (ie. last four digits) of number and ensure you have correct entry? I'm not promising to write the code, just flowcharting to get an understanding. [ 23 August 2001: Message edited by: LLigetfa ]
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.
|
|
Top
|
|
|
|
#58510 - 2001-08-23 08:41 PM
Re: How do I enumerate a rasphone.pbk heading?
|
Anonymous
Anonymous
Unregistered
|
Your understanding is perfect !!! more than perfect. I am glad you pointed out the last 4 digits, that would make it easier to search since some users might have the space, dashes etc. You have it straight to the gun, understood. Thanks[ 23 August 2001: Message edited by: Ntjazzed ]
|
|
Top
|
|
|
|
#58512 - 2001-08-23 09:29 PM
Re: How do I enumerate a rasphone.pbk heading?
|
Anonymous
Anonymous
Unregistered
|
LLigetfa, Regardless, I think your kix skills definitely beats me. If you can dish me a sample code I can take it from there. I usually struggle when starting a script. The starting points is what kills me. Thanks
|
|
Top
|
|
|
|
#58514 - 2001-08-23 10:20 PM
Re: How do I enumerate a rasphone.pbk heading?
|
Anonymous
Anonymous
Unregistered
|
Don't beat yourself too much, I am gearing myself with a skeleton code and then I will post here and see if anyone can help me polish it. You gave your best shot.. remember is the effort that counts, your efforts has given me some input already. Thnx Lligetfa for trying. Peace.
|
|
Top
|
|
|
|
#58515 - 2001-08-24 03:28 AM
Re: How do I enumerate a rasphone.pbk heading?
|
Les
KiX Master
   
Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
|
OK, so you got my confidence up... well just a little. The way I look at it, this is what needs to be done: 1. With readline() parse for all the headings. That part's not too tough.
code:
IF OPEN(1, "C:\kix\rasphone.pbk") = 0 $cl = ReadLine(1) WHILE @ERROR = 0 if SUBSTR($cl, 1, 1) = "[" ? "$cl =" $cl ;put your code here ENDIF $cl = ReadLine(1) LOOP ENDIF $ = CLOSE(1) get $
2. You've got to put these headings into variables. Since there are likely to be more than one heading, I'm thinking a two dimensional array is needed. The first dimension for the header name and the second for the instance (loop count). This is where my limit is reached. I don't know how to do the two dimensional array.3. Once you're there, you query each header section for 'PhoneNumber' with ReadProfileString().
code:
$header = "NameOfHeader" ;put your code here $dev = ReadProfileString("C:\kix\rasphone.pbk", $header, "PhoneNumber") If @ERROR = 0 ? "PhoneNumber = " + $dev " ;put your code hereEndif get $
4. Now do a SUBSTR() function to test for the number. Hey, wait a minute, I'm lazy. It'd be the same as my first example, only different.5. G O T ... T O ... F I G H T ... T H E ... U R G E ... T O ... P R O G R A M ... The rest I leave to you or someone else. This is a slight departure from my first outline because I realized there may be more than one heading with the same base number. On my PC, there were several. One from the office, one from home, one from out-of-town, etc., all with a different dialing prefix. Actually, I maybe over-simplified it just a bit. The very first thing you need to do is locate the rasphone.pbk file. Depending on OS and design, they could be per user or 'All Users'. On my Win2k, it resides in C:\Documents and Settings\All Users\Application Data\Microsoft\Network\Connections\Pbk\. But then again, what you intend to do with the results is probaably no cake walk either. [ 24 August 2001: Message edited by: LLigetfa ] [ 24 August 2001: Message edited by: LLigetfa ]
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.
|
|
Top
|
|
|
|
#58518 - 2001-08-27 05:42 PM
Re: How do I enumerate a rasphone.pbk heading?
|
Anonymous
Anonymous
Unregistered
|
LLigetfa, you are the MAN. I know I owe you a big pint of lager(beer) for your endeavour. You are great and persistent. Thank you once again. DoUntil
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 546 anonymous users online.
|
|
|