Can't find intermittent error

Hello, I have a script which generates intermittent errors. It’s the following (I’ve changed to domain name of the url):

on run {customerName, amount, street, zip, cc_number, expiry, order}
set a to “” & customerName & “&amount=” & amount & “&street=” & street & �
“&zip=” & zip & “&cc_number=” & cc_number & “&expiry=” & expiry & “&order=” & order as string
set b to “macintosh HD:ccTemp.txt” as string
tell application “URL Access Scripting”
with timeout of 180 seconds
download a to file b replacing yes
end timeout
end tell
set theFile to open for access file b
set myData to (read theFile)
close access theFile
on error errMsg number errNum
set myData to "Error: " & errMsg & " " & errNum
end try
end run

This script runs on a web server and is called by an apple event triggered by a form action on a web page. I can’t replicate the error on a development server, so I think the problem may have something to do with either user interaction in a production setting or trying to run the script under production server load.

I haven’t been able to read the error yet, but I did notice that the file that URL Access Scripting is writing to completely disappears after the error (it’s not even in the trash). Also, when I opened the script after one of these errors, I noticed that the section of the script:

	tell application "URL Access Scripting"
		with timeout of 180 seconds
			download a to file b replacing yes
		end timeout
	end tell

had been changed to:

	tell application "Microsoft Internet First Run"
		with timeout of 180 seconds
			�event aevtdwnl� a given �class fdst�:file b, �class rplc�:�constant erplyes �
		end timeout
	end tell

Any help on this would be greatly appreciated. Anibal Escobar

I found the error code that was generated: -6996.

After much research, I found out that this is a URL Access Scripting error related to https URL’s. According to the Apple website, there is no solution (actually theres one limited possible solution).

Just thought I’d share it with the list, in case anyone’s trying to do the same.

I’m not sure about the http vs. https issue but most likely this is an encoding issue. You need to encode your URL before submitting it. Take a look at Apple’s Essential AppleScript Sub-Routines for more information.


Thanks for the tip. In my code:

		set a to "" & customerName & "&amount=" & amount & "&street=" & street & ¬
			"&zip=" & zip & "&cc_number=" & cc_number & "&expiry=" & expiry & "&order=" & order as string

the variables passed to the script that are used to concatenate the target url are all url encoded at the source of the on run command. So, the variable “a”, which is the URL to download is URL encoded. I’ve verified this in testing. However, the variable which specifies the file into which to download the URL:

	set b to "macintosh HD:ccTemp.txt" as string

is not URL encoded. Is this necessary for URL Access Scripting to work properly?

I’m running this with Lasso 3.6 communicating with Filemaker 4.0 via the FM web companion. Interestingly, after the error occurrs, Lasso gets messed up and the server needs to be restarted for Lasso to work properly again. Also, the error message I captured was:

URL Access Scripting got an error: An error of type -6996 has occurred. -6996o" NAME=“-token.destination” VALUE=“emails”> </t

where everything after the last -6996 is code from a separate page that was probably being processed by Lasso at the time the error occurred. Weird! Since the error did not occur on a development server and was intermittent on the production server, I assumed it had someting to do with a conflict in the HTTP communications (Lasso vs. URL Access Scripting) under normal server load. FYI, I found out about the possible HTTPS connection from: