473,406 Members | 2,549 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Parsing from a URL file

Hi,

I need to extract the URL from a url file. Here is an example

[DEFAULT]
BASEURL=http://www.gallifreyone.com/news.shtml
[InternetShortcut]
URL=http://www.gallifreyone.com/news.shtml#newsitemEpFllVZppFHWEgchmC
Modified=8067017F439AC20107

Can anyone give me some ideas on how to do this. I have trying various
methods and its just not happening. The string I need is
http://www.gallifreyone.com/news.sht...lVZppFHWEgchmC
Any help on this would be appreciated.

--
Steven
www.stevenblair.com
Nov 15 '05 #1
2 6299
Steven,

It looks like you are trying to get the shortcut from a URL shortcut
file. What you want to do is create an internet shortcut object through COM
interop, using the class id of CLSID_InternetShortcut (you should be able to
find this in one of the header files). Once you have that, you can cast
this instance to the IPersistFile interface, and call the Load method,
passing in the filename of the URL shortcut. Once you have that, you can
cast the shortcut instance to the IUniformResourceLocator interface, and
then call the GetURL method to get the shortcut.

Of course, this requires a whole lot of COM interop, but it is the right
way to do it (as the file format of a URL shortcut is not set in stone).
You could use the P/Invoke layer to call the INI functions to read the file
(as it is in that format), but I don't think that is a good idea,
personally.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Steven Blair" <st**********@btinternet.com> wrote in message
news:bs**********@sparta.btinternet.com...
Hi,

I need to extract the URL from a url file. Here is an example

[DEFAULT]
BASEURL=http://www.gallifreyone.com/news.shtml
[InternetShortcut]
URL=http://www.gallifreyone.com/news.shtml#newsitemEpFllVZppFHWEgchmC
Modified=8067017F439AC20107

Can anyone give me some ideas on how to do this. I have trying various
methods and its just not happening. The string I need is
http://www.gallifreyone.com/news.sht...lVZppFHWEgchmC
Any help on this would be appreciated.

--
Steven
www.stevenblair.com

Nov 15 '05 #2
Hello, Steven!

The way Nicholas offered seems to be smarter,
but if you only need that particular line, I would
suggest opening a URL file "manually" using
stream reader, and reading it line by line until
you reach "URL=..." or if it always the fourth line,
just "skip" right to it...
And then just extract the part of URL that you need.

Good luck.

You wrote on Mon, 22 Dec 2003 23:34:26 +0000 (UTC):

SB> I need to extract the URL from a url file. Here is an example

SB> [DEFAULT]
SB> BASEURL=http://www.gallifreyone.com/news.shtml
SB> [InternetShortcut]
SB> URL=http://www.gallifreyone.com/news.shtml#newsitemEpFllVZppFHWEgchmC
SB> Modified=8067017F439AC20107

SB> Can anyone give me some ideas on how to do this. I have trying various
SB> methods and its just not happening. The string I need is
SB> http://www.gallifreyone.com/news.sht...lVZppFHWEgchmC

SB> Any help on this would be appreciated.

With best regards, Nurchi BECHED.
Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Willem Ligtenberg | last post by:
I decided to use SAX to parse my xml file. But the parser crashes on: File "/usr/lib/python2.3/site-packages/_xmlplus/sax/handler.py", line 38, in fatalError raise exception...
2
by: Cigdem | last post by:
Hello, I am trying to parse the XML files that the user selects(XML files are on anoher OS400 system called "wkdis3"). But i am permenantly getting that error: Directory0: \\wkdis3\ROOT\home...
3
by: Pir8 | last post by:
I have a complex xml file, which contains stories within a magazine. The structure of the xml file is as follows: <?xml version="1.0" encoding="ISO-8859-1" ?> <magazine> <story>...
1
by: Christoph Bisping | last post by:
Hello! Maybe someone is able to give me a little hint on this: I've written a vb.net app which is mainly an interpreter for specialized CAD/CAM files. These files mainly contain simple movement...
4
by: Rick Walsh | last post by:
I have an HTML table in the following format: <table> <tr><td>Header 1</td><td>Header 2</td></tr> <tr><td>1</td><td>2</td></tr> <tr><td>3</td><td>4</td></tr> <tr><td>5</td><td>6</td></tr>...
3
by: toton | last post by:
Hi, I have some ascii files, which are having some formatted text. I want to read some section only from the total file. For that what I am doing is indexing the sections (denoted by .START in...
9
by: Paulers | last post by:
Hello, I have a log file that contains many multi-line messages. What is the best approach to take for extracting data out of each message and populating object properties to be stored in an...
13
by: Chris Carlen | last post by:
Hi: Having completed enough serial driver code for a TMS320F2812 microcontroller to talk to a terminal, I am now trying different approaches to command interpretation. I have a very simple...
13
by: charliefortune | last post by:
I am fetching some product feeds with PHP like this $merch = substr($key,1); $feed = file_get_contents($_POST); $fp = fopen("./feeds/feed".$merch.".txt","w+"); fwrite ($fp,$feed); fclose...
2
by: Felipe De Bene | last post by:
I'm having problems parsing an HTML file with the following syntax : <TABLE cellspacing=0 cellpadding=0 ALIGN=CENTER BORDER=1 width='100%'> <TH BGCOLOR='#c0c0c0' Width='3%'>User ID</TH> <TH...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.