How to code if(url "http://abc.def" exists) then

Hello all,

Applescript beginner using OS 9.2 and Applescript 1.8.3

I am trying to get my code to check whether a specific folder directory on a website exists before sending another set of code to download files from that directory. I already have reliable code to download the files from the desired folder.

Can you use an If/Then combination to do this? I have tried

tell application “netscape communicator”
if (URL “http://abc.def.hij” exists) then
display dialog “it exists!!”
else
quit
end if
end tell

in many different configurations but can not get it to compile.

Any suggestions?

Thanks a bunch!!

Frank

I know this is a little late for a reply but I just found some interesting code and remembered there was someone trying to do this. Hope this helps.

set strURLPath to "http://someURL"
set strPathToFile to "Mac HD:Desktop Folder:somefile.htm"

tell application "URL Access Scripting"
	activate
	with timeout of 50 seconds
		try
			download strURLPath to file strPathToFile replacing yes
			set blnStatus to true
		on error err
			set blnStatus to false
		end try
	end timeout
	quit
end tell

if blnStatus = true then --then it succeeded
	--It exists, do something
else --it failed
	--It failed, do something else
end if

I just installed InDesign and found a bunch of great scripts from Write Track on the disc.
This code was borrowed from WT’s hyperlink verifier.