Applescript -> Javascript -> Acrobat 6.0

Our network fax software only archives incoming faxes as multipage tiffs. Our office database only links single page tiffs, jpgs, etc to clients. I wanted a folder action which would automatically separate the multipage tiffs into single page files and put these into a new folder. The difficult problem was that Acrobat wouldn’t accept a variable containing a string I had generated with the file name. After browsing this BBS I found the code to set the new fime to: ((((str as string) as record)‘s «class ktxt»))
It worked . I’ve attached the script incase it’ll help anyone.javascript:emoticon(’:D’)

on adding folder items to myFolder after receiving these_items
	set the image_list to {}
	repeat with i from 1 to the count of these_items
		set this_item to item i of these_items
		set the item_info to info for this_item
		if (folder of the item_info is false) and ¬
			(alias of the item_info is false) and ¬
			((the file type of the item_info is "TIFF") or ¬
				the name extension of the item_info is in {"tif", "tiff"}) then
			set the end of the image_list to this_item
		end if
	end repeat
	repeat with i from 1 to the count of image_list
		set this_item to item i of the image_list
		set FileName to ((characters 1 thru -((number of characters of the (name extension of (info for this_item))) + 1) of the name of (info for this_item)) as string) & "jpg"
		set myFilename to "/Macintosh HD/Users/rws/Desktop/Fax Export folder/" & FileName
		set myNewFileName to AsText(myFilename)
		tell application "Acrobat 6.0 Professional"
			set myScript to "this.saveAs("" & myNewFileName & "", "com.adobe.acrobat.jpeg");"
			open this_item
			activate document 1
			delay 1
			do script myScript
			close document 1 saving no
		end tell
	end repeat
end adding folder items to

on AsText(str)
	try --coerce Unicode or other text to styled string to plain text 
		return (((str as string) as record)'s «class ktxt»)
	end try
	return str -- if plain text to begin with 
end AsText

Extremely useful for something I was trying to do. Thanks!!