Having more problems with form filling in IE

I have a probelm, as before i use the same method of getting a caption, opening photoshop and storing to a variable.

I also take the filename of the same file and store that in a variable.

Here are the snippets:


tell application "Adobe Photoshop 7.0"
	activate
	
	--get the information and save it
	-- sets the variable documentCaption wit hth caption of the image
	set documentCaption to caption of info of current document as text
	
	--set documentname to the filename
	set documentName to name of current document

end tell

tell application "Internet Explorer"
	Activate
	------------
	--set variables
	set fileName to documentName
	set fileCaption to documentCaption
	--set "inhouse" variables for IE

	--insert the caption at the right area
	
	do script "window.document.forms[0].elements[4].value='" & fileName & "'"
end tell


The problem i have ois that the fileName variable gets printed on screen in the right place, but if i change that to the fileCaption variable then that wont get printed. I know there is a caption, but i dont know why it doesn;t work, any ideas???

You can investigate introducing a “display dialog” after you get the caption, and see what’s going on, since there is nothing wrong in your code:

set documentCaption to caption of info of current document as text
display dialog documentCaption

just done that and it displays the caption.

Could it be the way that i am saving the caption???

As initially i saved it to the clipboard as this is what i am doing now so that all i have to do is paste it in.

Can i maybe simulate the pasting? so it does the same but in a different way??