Originally posted by Jan Van Boghout:
<STRONG>Thanks , but it didn't work . I do have another question now , though
How can you read a file from the Internet with AppleScript ?
What I would like to do is read the contents of a text file (http://homepage.mac.com/janvanboghout/versie.txt for example) and display that in a text view . Is that possible ?</STRONG>
I don't think it is possible with just AppleScript unless you download the file and then read it from the .. but that isn't practical.
You'd need to use a cocoa method...
in your project, create a new header file and call it whatever you want like "fileGetter.h" then put in this info:
<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>#import <Foundation/Foundation.h>
@interface fileGetter : NSObject {
}
+ (NSString *)getCode

NSString *)path;
@end</font>[/code]
Then make a class file and call it whatever you want again like "fileGetter.m" and put in this:
<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>#import <font color = red>"fileGetter.h"</font>
@implementation fileGetter
+ (NSString *)getCode

NSString *)path {
return [NSString stringWithContentsOfURL:[NSURL URLWithString

ath]];
}
@end</font>[/code]
Then from your applescript, you can use this code...
<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>on clicked theObject
tell window of theObject
set theCont to (call method <font color = red>"getCode:"</font> of class <font color = red>"fileGetter"</font> with parameter <font color = red>"http:<font color = brown>//homepage.mac.com/janvanboghout/versie.txt"</font>)</font>
set theCont to theCont as string
set contents of text field <font color = red>"mySourceField"</font> to theCont
end tell
end clicked</font>[/code]
Works for me. BTW, someone else did the cocoa for me, I don't know anything

I am using it for my forum viewer.