Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling Internet-pages by VFP 4

Status
Not open for further replies.

german12

Programmer
Nov 12, 2001
563
0
16
DE
Hi, all

The following commands e.g.

a) RUN /N C:\Programme\Netscape\Communicator\Program\netscape.exe
b) RUN /N C:\Programme\Netscape\Communicator\Program\netscape.exe
do allow me a direct access to a specific Internet-page - however there are two question
for me left:

a)is it possible by a VFP command (or other routine) to avoid that every time the full
environment of my Netscape-browser will be loaded again by each of the above commands ?
(which means I want to close Netscape from memory and run it again the first time when command ( b)
starts, so that only one button will be visible on the bottom- task-line)

b)is it possible by a VFP command (or other routine) to mark the contents of that Net- page
in order to copy it via clipboard into a file?

Difficult questions, I know - but perhaps one of you has a solution.

Greetings from rainy Western Germany

Klaus
 
Klaus

There is a class library called

_Hyperlink.vcx

somewhere on your system.

If you add one of the controls to a form, you can use it to launch your browser with a single click on the control.

The property .cTarget is the web address.

IF you use OLE Drag and Drop, you can drop a url file onto the control from your favorites or any other folder, extract the address with FILETOSTR(), and access the internet that way, whilst running a VFP app.

Or you can set the .cTarget property from a table, or hard code it.
HTH

Chris [pc2]
 
ChrisRChamberlain,

I believe Hyperlink.vct requires Internet Explorer, I'm not sure it works for Netscape.
 
mgagnon

You may well be right in saying the classes require IE.

Klaus stated he was considering installing IE in another thread, hence the post which should have been qualified as being applicable to IE and maybe not Netscape. HTH

Chris [pc2]
 
Here's a browser-neutral way to open a web page:
Code:
PROCEDURE OpenUrl
LPARAMETERS pcURL
LOCAL lnRes
lnRes = ShellExec(pcURL,'','OPEN','')  && GTv10.00 wgcs
if lnRes <= 32  && v10.00 wgcs
  =MessageBox('Error number '+alltrim(str(lnRes))+' while opening '+crlf;
              + pcURL, mbxOk, 'Failed')  && v10.00 wgcs
endif  

************************************************************************
* WinApi :: ShellExecute*********************************
***    Author: Rick Strahl, West Wind Technologies
***            [URL unfurl="true"]http://www.west-wind.com/[/URL]
***  Function: Opens a file in the application that it's
***            associated with.
***      Pass: lcFileName  -  Name of the file to open
***            lcWorkDir   -  Working directory
***            lcOperation -  &quot;Open&quot; &quot;Run&quot; &quot;Play&quot; &quot;Edit&quot; etc...
***    Return: 2  - Bad Association (invalid URL)
***            31 - No application association
***            29 - Failure to load application
***            30 - Application is busy***
***            Values over 32 indicate success
***            and return an instance handle for
***            the application started (the browser)
************************************************************************
FUNCTION ShellExec
LPARAMETERS lcFileName, lcWorkDir, lcOperation, pcParameters
LOCAL pp, lcParam
pp = pCount()          && LAS v9b1w  wgcs
if pp>3                    && LAS v9b1w  wgcs
  lcParam = pcParameters   && LAS v9b1w  wgcs
else                       && LAS v9b1w  wgcs
  lcParam = ''
endif
lcWorkDir=IIF(type(&quot;lcWorkDir&quot;)=&quot;C&quot;,lcWorkDir,&quot;&quot;)
lcOperation=IIF(type(&quot;lcOperation&quot;)=&quot;C&quot;,lcOperation,&quot;Open&quot;)
DECLARE INTEGER ShellExecute ;    
    IN SHELL32.DLL ;    
    INTEGER nWinHandle,;
    STRING cOperation,;    
    STRING cFileName,;    
    STRING cParameters,;
    STRING cDirectory,;    
    INTEGER nShowWindow
RETURN ShellExecute(0,lcOperation,lcFilename,lcParam,lcWorkDir,1)
 
Hi chris, mike and wgcs thanks for all the help - each one useful - therefore a star for all
of you...*ggg

wcgs, the your neutral routine works fine and very fast - I had no problems with Netscape
Navigator which my company uses.

What do all of you think: Is it possible to mark (e.g. with such a routine) a page in the
internet - then copy to clipboard - and let VFP continue to work the the _clipboard contents -
all from VFP?

Meanwhile I found an offline-news-reader (free agent version 1.21) which is scanning a
server - lists all groups in a window and loads all articles one is interesting in - the
adress: - 1,1 MB to download) - unfortunately this is only
for newsgroup-adresses - the program even can make abonnements on new informations,
so that you get regulary the newest News.
Perhaps one of you is interested.

Regards from Germany

Klaus
 
Klaus

An alternative idea for you to avoid storing any of this information on your own PC.

Not having Netscape, I would not know whether or not this will work, but it will do for IE.

Simply drag & drop the internet address from the browser into a suitable folder in Windows Explorer.

This will create a correctly titled shortcut in the folder complete with relevant icon.

Go online with Windows Explorer open in the required folder, and navigate to the web pages by clicking on a shortcut.

You could &quot;catalog&quot; your URLs by placing them in differently titled folders, and create your &quot;database&quot; in the form of URLs.

If you want to access the URLs through VFP, use ADIR() to populate a cursor and navigate the web through clicking on a record.

I think the question you need to resolve is whether or not you really want the information on your own machine or whether you simply need a quick way of accessing it online.

If you do need the information on your PC, then again I would suggest the simplest way is just to download the web pages as discussed in another thread.

IMHO, using the clipboard, memo fields, tables, etc seems to be making hard work of something that's basically very simple. HTH

Chris [pc2]
 
Klaus,

If you have Win 2000 you have access to the &quot;Microsoft.XMLHTTP&quot; object. It may also be a part of IE6. You can call this object and &quot;Screen Scrape&quot; an entire page into a memory variable and copy it to a file. Or if you know what you're looking for, you could extract that info programmatically. You create the object like so:

* Initialize Variables
public oXMLHTTP, cHTMLpage
* Create XMLHTTP Object
oXMLHTTP = createobject(&quot;Microsoft.XMLHTTP&quot;)
* Set info for web page &quot;Get&quot; request
oXMLHTTP.Open(&quot;GET&quot;, &quot; .F.)
* Send Request
oXMLHTTP.Send()
* Store info from response into a variable
cHTMLpage = oXMLHTTP.responseText()
* Trim off extra spaces
cHTMLpage = Alltrim(cHTMLpage)
* Copy info in variable into a File
StrtoFile(cHTMLpage, &quot;C:\TestHTML.txt&quot;)
* Release Object
Release oXMLHTTP


Watch out for all the CR/LF's at the beginning of this page. It threw me off for a second until I scrolled down in Notepad.

You will find more info on this object on MSDN libary CD or at msdn.Microsoft.com.

This has lots of applications. OBJECTS RULE! Have Fun!!!!!!


Allen &quot;Uncanny&quot; Schott
 
Hi Chris & Allen - thanks for the advices.

Chris, in which standard-default does IE store the directory-information as I have to know
it when filling adir with that......?

I love it to compare different methods - and your one is not bad really - here in
Germany we have very long response -times from the internet although I use already
what is called ISDN protocol here a quite fast transfer method supported by e.g.
DEUTSCHE TELEKOM.
We have 90 hrs free for a flat-rate of about 40 US-$/month and for every minute above that
we have to pay about one cent (0.9 euro) additionally
I was told in USA and UK this is much cheaper right?
That's the reason why I would like to have much information to read offline from my PC -
and I would like to find out - which is cheaper in the long run.

Perhaps Allens module suggested could be implemented into a loop which carries
out the download while I am drinking coffee.
Allen, what do you think - when I have WIN 98 as OS - would your &quot;Microsoft.XMLHTTP&quot; object
also work under WIN98?
In that case I would copy it from someone who has WIN2000....

Regards and thanks with 2 stars again for you...

Klaus



 
Klaus

CREA CURS WEBPAGES ;
[tab](filename C(254),;
[tab]size N(10),;
[tab]date D,;
[tab]time C(8),;
[tab]attributes C(5),;
[tab]url C(254))

ADIR(laTemp,[C:\My web pages\*.url])
APPE FROM ARRAY laTemp

SCAN
[tab]lcURL = FILETOSTR(WEBPAGES.filename)
[tab]lnStart = ATC([=],lcURL)
[tab]lnEnd = ATC(&quot;[InternetShortcut]&quot;,lcURL)
[tab]REPL WEBPAGES.url WITH ALLT(SUBSTR(lcURL,lnStart + 1,lnEnd - lnStart - 1))
ENDS

You should now have a cursor with all the data you need.

In the UK, we pay £14.00 or £15.00 per month for a non ISDN unlimited access, maximum 2 hours per session, (you simply logon again after two hours). HTH

Chris [pc2]
 
Klaus,

I'll be damned if I can find a Win98 machine at my office to test the XMLHTTP object. But, from what I can tell (you just have to love the MSDN site) it looks like all the XML objects are included with IE. So, if you have IE5.5 or IE6, you should be ready to rock and roll. If not you might be able to download a WEBDAV SDK from Microsoft. I stumbled onto this link, maybe this will help:


.or.

Go to msdn.microsoft.com and search on &quot;Using the WebDAV Protocol&quot;.


Good Luck!

Allen &quot;Uncanny&quot; Schott
 
Klaus

This may be stating the obvious, but if you want to use Allen's code to save the file as a web page, change

StrtoFile(cHTMLpage, &quot;C:\TestHTML.txt&quot;)

To

StrtoFile(cHTMLpage, &quot;C:\TestHTML.htm&quot;)
HTH

Chris [pc2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top