Save for web photoshop cs3 and rename file

Hi I know there is a lot of posts that have save for web but I have tried some and they are all very different. I want to make apple scripts to merge into automator


on run {input, parameters}
	
	tell application "Adobe Photoshop CS3"
		activate
		set docheight to height of document 1
		set docWidth to width of document 1
		set display dialogs to never
		set thisdoc to current document
		tell thisdoc
			resize image resolution 72 width pixels 240.0 height pixels 240.0 resample method bicubic
		end tell
	end tell

then I want the save for web to rename a file for example filename.jpg to be p0filename_240_240.jpg with these settings:
{class:save for web export options, optimized size:true, quality:60, with profile:true}

then save the file into a downsize folder on the desktop

then the whole process repeats for the 60x60 and the 500x500 and saved into the same downsize folder

so basically we start with a thefile.tif and end up with p0thefile_500_500.jpg , p0thefile_240_240.jpg , p0thefile_60_60.jpg

I had the photoshop action pack for tiger and it worked but no longer works in 10.5

can someone please help,

Thanks

Robert

Just to follow up I have found a solution to my question by using another script written by members here. I tried to find the original post but have not found it. I modified it to fit my needs but here it is.
Thanks for everyones help on this!!!

on compileAsOption(valStr)
	tell application "Adobe Photoshop CS3"
		run script "tell application \"Adobe Photoshop CS3\" to return {«class fltp»:" & valStr & "}"
	end tell
end compileAsOption

set inputFolder to choose folder with prompt "Pick your TOP level folder!"
--
tell application "Finder"
	set filesList to (files of entire contents of inputFolder)
end tell
--
repeat with aFile in filesList
	set fileIndex to 0
	tell application "Finder"
		set theFile to aFile as alias
		set theFileName to name of theFile
		set the subFolder to the container of theFile
	end tell
	--
	tell application "Adobe Photoshop CS3"
		activate
		set UserPrefs to properties of settings
		set ruler units of settings to pixel units
		--
		open theFile showing dialogs never
		set docRef to the current document
		tell docRef
			set docName to name of docRef
			set docBaseName to getBaseName(docName) of me
			--if (mode is not RGB) then
			--change mode to RGB
			--end if
			--if (bits per channel is sixteen) then
			--set bits per channel to eight
			--end if
			--set myOptions to {class:save for web export options, optimized size:true, quality:40, with profile:false} & my compileAsOption("JPEG") --I added a couple of additional options I use. Feel free to delete if you don't want them
			--set myExportOptions to {«class fltp»:JPEG, quality:40}
			--resizing images proportionaly and non proportionaly scaled
			--
			resize image height 500 resolution 72 resample method bicubic sharper
			set newFileName to (subFolder as string) & "p0" & docBaseName & "_500_500.jpg"
			save docRef in file newFileName as JPEG with options ¬
				{quality:6} appending lowercase extension with copying
			--
			resize image height 240 resolution 72 resample method bicubic sharper
			set newFileName to (subFolder as string) & "p0" & docBaseName & "_240_240.jpg"
			save docRef in file newFileName as JPEG with options ¬
				{quality:6} appending lowercase extension with copying
			--
			resize image height 60 resolution 72 resample method bicubic sharper
			set newFileName to (subFolder as string) & "p0" & docBaseName & "_60_60.jpg"
			save docRef in file newFileName as JPEG with options ¬
				{quality:6} appending lowercase extension with copying
		end tell
		--
		close current document saving no
		--
		set ruler units of settings to ruler units of UserPrefs
		--
	end tell
end repeat
--
on getBaseName(fName)
	set baseName to fName
	repeat with idx from 1 to (length of fName)
		if (item idx of fName = ".") then
			set baseName to (items 1 thru (idx - 1) of fName) as string
			exit repeat
		end if
	end repeat
	return baseName
end getBaseName