Error while attempting to Export to GIF using Photoshop CS3

Hello World, I am trying to export a MOV file to GIF using Photoshop with Applescript via the Export - Save For Web command. Currently I am recieving an error after the export command

Can anybody help me with this error?

Here is my Code:

set fileCounter to 0
set mfolder to choose folder with prompt "Choose folder to Convert" default location (path to desktop)

--THis gets the angle in which you need to Rotate the image
set alert_message to ("Please Choose a Rotation Angle:") as Unicode text
display dialog the alert_message buttons {"-90", "90", "0"} default button 3 with icon 1
set the rotate_Choice to the button returned of the result as real

--THis sets the placement choice of the logo
set logo_Placement to first item in (choose from list {"Lower Center", "Lower Right", "None"} with prompt "Where would you like the logo placed?") as string

--set dfolder to choose folder with prompt "Choose destination folder" default location (path to desktop)

tell application "Finder"
	launch
	set fileList to files of (mfolder) as alias list
	if exists folder "Processed GIFs" of mfolder then
		delete folder "Processed GIFs" of mfolder
	end if
	set dfolder to make new folder at mfolder with properties {name:"Processed GIFs"}
end tell

repeat with j from 1 to (number of fileList)
	
	set wFile to item j of (fileList)
	set fileCounter to fileCounter + 1
	
	
	--this asks Photoshop to open each item, Rotate the canvas if desired, place the logo as a new layer (* not yet implemented), and then export to GIF
	tell application "Adobe Photoshop CS3"
		try
			open (wFile) showing dialogs never
			set docRef to current document
			tell docRef
				if rotate_Choice is not 0 then rotate canvas docRef angle rotate_Choice
				
				
				--if logo_Placement is not "None" then Add new layer at logo_Placement
				
				set myExportOptions to {class:save for web export options, web format:CompuServe GIF, colorReduction:perceptual, colors:256, lossy:0, dither:diffusion, ditherAmount:100, transparency:false}
				export docRef in ((dfolder) as alias) as save for web with options myExportOptions
				
				close current document saving no
			end tell
		on error
			--
		end try
		
	end tell
	
end repeat
display dialog "You Have Converted  " & fileCounter & " Files." buttons {"OK"}

Model: MacBook Pro
AppleScript: 2.1.1
Browser: Safari 531.21.10
Operating System: Mac OS X (10.6)

Hi,

I guess you have to specify the whole file path, not just the folder


.
repeat with j from 1 to (number of fileList)

	set wFile to item j of fileList
	set fileCounter to fileCounter + 1
	set {name:Nm, name extension:Ex} to (info for wFile)
	set baseName to text 1 thru ((get offset of "." & Ex in Nm) - 1) of Nm
	
	
	--this asks Photoshop to open each item, Rotate the canvas if desired, place the logo as a new layer (* not yet implemented), and then export to GIF
	tell application "Adobe Photoshop CS3"
		try
			open (wFile) showing dialogs never
			set docRef to current document
			tell docRef
				if rotate_Choice is not 0 then rotate canvas docRef angle rotate_Choice
				
				
				--if logo_Placement is not "None" then Add new layer at logo_Placement
				
				set myExportOptions to {class:save for web export options, web format:CompuServe GIF, colorReduction:perceptual, colors:256, lossy:0, dither:diffusion, ditherAmount:100, transparency:false}
				export docRef in ((dfolder as text) & baseName & ".gif") as save for web with options myExportOptions
				
				close current document saving no
			end tell
		on error
			--
		end try
		
	end tell
end repeat
.

Thank you so much for your reply Stephan! I really appreciate it!

After using your changes, I found a few more problems with my code in the Save for web options. After fixing that. I am able to export!!!

However, I have noticed that the quality of the image is terrible using the same export parameters as I do when manually exporting in Photoshop. Any idea as to why this is happening??

Best Regards,

Ive discovered a bug in the photoshop applescript syntax that is causing my terrible quality GIF images. A “quality” of 100 really equals a quality of 0. So if you want quality to be at 100% you must set

.