Microsoft KB Archive/184761

= How To Automate Internet Explorer 4 to Open a Specific Web Page =

Article ID: 184761

Article Last Modified on 6/29/2004

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0b for Macintosh
 * Microsoft FoxPro 2.6a Professional Edition for Macintosh

-



This article was previously published under Q184761



SUMMARY
This article shows how to use AppleScript to start an instance of Microsoft Internet Explorer 4.0 and automatically go to a valid website address.



MORE INFORMATION
This example takes an Internet address stored in a file and uses AppleScript to start Internet Explorer 4.0, read the address from the file, and direct Internet Explorer to the desired address. The article assumes that Simple Text created the text file because the "Open For Access" command in AppleScript only reads files that have the TXT creator type. One can create a text file using FoxPro and later change the creator type. To do this, please refer to the article listed in the REFERENCES section.

Steps to Reproduce Behavior
 Create a text file named ztest.txt, using the Simple Text application, that contains the following Web address:

http://www.microsoft.com

Save the file to the root folder of your hard drive.  Open the Apple Script Editor and type the following commands: set filename to (open for access alias "HD_name:ztest.txt") set mydata to (read filename) close access filename tell application "HD_name:Internet Explorer 4.0 Preview 1:Internet     Explorer 4.0" to run tell application "HD_name:Internet Explorer 4.0 Preview 1:Internet     Explorer 4.0" to GetURL (mydata) NOTE: Each line listed above should be type as a complete line within the Apple Script Editor. To ensure that you have typed the Apple Script commands correctly, press the Check Syntax button in the Apple Script Editor.

Please note that you must give a complete path to the text file and Internet Explorer. If you do not, an error will occur. If you are not sure of the exact path, press the Apple key and "F" to invoke the File Find dialog and search for the application. In the example above, substitute the name of your Macintosh hard drive for "HD_name" and specify the path where Internet Explorer is installed.  Save the AppleScript file as a Compiled Script type with the name ZIE4test to the home folder of FoxPro.  Run the Apple Script from FoxPro or Visual FoxPro using the following command: RunScript ZIE4test 

