Copy Folder Path and convert PSD to JPg

I’ve found this and I am just trying to work out where I can place a photoshop file and then save as jpg in the copied folder location?

-- Open this script in script editor and save with the options:
--   * File type: Application
--   * Uncheck the option "Startup screen"
-- Now you can either drag and drop a set of folders on the application or just 
-- run the application from the Finder and it will ask you to choose a folder.

on run
set source_folder to choose folder with prompt "Select folder to be duplicated:" as string
my do_main_script(source_folder)
end run

on open of source_folder_list
repeat with i from 1 to number of items in the source_folder_list
set this_folder_path to item i of the source_folder_list as string
if last character of this_folder_path is ":" then
my do_main_script(this_folder_path)
end if
end repeat
end open

on do_main_script(source_folder)
tell application "Finder" to set source_folder to folder (source_folder)
tell application "Finder" to set the target_folder to (parent of source_folder)

if source_folder is not "" and target_folder is not "" then
set new_folder_name to (name of source_folder as string) & " duplicate"
set source_folder to source_folder as string
set target_folder to target_folder as string

my create_new_folder(target_folder, new_folder_name)
my duplicate_folder_structure(source_folder, target_folder & new_folder_name & ":")
end if
end do_main_script

on duplicate_folder_structure(source_folder, target_folder)
tell application "Finder"
get name of folders of folder (source_folder)
set folder_list to result
repeat with i from 1 to number of items in the folder_list
set this_folder_name to item i of the folder_list as string
my create_new_folder(target_folder, this_folder_name)
my duplicate_folder_structure(source_folder & this_folder_name & ":", target_folder & this_folder_name & ":")
end repeat
end try
end tell
end duplicate_folder_structure

on create_new_folder(target_folder, new_folder_name)
tell application "Finder"
if not (exists item (target_folder & new_folder_name)) then
make new folder at folder target_folder with properties {name:new_folder_name}
end if
end try
end tell
end create_new_folder

I need to sandwich this in there somewhere?

set theImage to choose file of type "PSD"
set theOutputFolder to choose folder
tell application "Image Events"
	set theFile to file ((theImage) as string)
	set theImageReference to open theFile
	tell application "Finder"
		set origName to name of theFile
		set AppleScript's text item delimiters to "."
		if number of text items of origName > 1 then
			set origName to text items 1 thru -2 of origName as text
		end if
	end tell
	tell theImageReference
		scale to size 1000
		save in (theOutputFolder as string) & origName & ".JPG" as JPEG
	end tell
end tell

A while ago, I wrote a script for Photo Walkthrough:

You can adapt it to something like this:

on open of myFiles
	set newSizes to {500, 700}
	repeat with aFile in myFiles
		set filePath to aFile's POSIX path
		set bPath to (do shell script "dirname " & quoted form of filePath)
		tell application "System Events" to set {fileName, fileExt} to {name, name extension} of aFile
		set baseName to text 1 thru ((get offset of "." & fileExt in fileName) - 1) of fileName
		repeat with newSize in newSizes
			do shell script "sips " & quoted form of aFile's POSIX path & " -Z " & newSize & " --out " & quoted form of (bPath & "/" & baseName & "-" & newSize & ".jpg" as text)
		end repeat
	end repeat
end open

I might of confused things a little.

What I have is a folder structure, and deep down the folders are full of PSD.

I want to keep all the PSD where they are but convert them to jpgs, and store on another drive but in the same folder structure.

Currently I try to search for the items over a network and the PSD files take too long to load up so i figured copy them all locally but have them as jpg so once I find them I know where to look for the original. a bit like a manual version of an Alias, I would use the Alias but it doesn’t give me a thumbnail of the PSD (just the adobe thumbnail) also the alias doesn’t itself hold metadata like exif info only the original. its the exif options that I would use to find images