List Copy PLEASE HELP

Hello I was wondering if anyone could help me with a script I am writing. I have got so far but now have run into a little problem. Right at the beginning of the script, I have added an extra line to copy whatever goes into “selectedFilepaths” out to the end of list “joblist”. Then further down “joblist” is copied to “finishedFilepaths” and then this is the list the find and replace code runs on, only the code dosn’t work when it is running on the copied list. It works great on selectedFilepaths copied to finishedFilepaths but not when selectedFilepaths has been copied to joblist. Arghhh, as you have probably guessed I am new AppleScript and am not terribly good but I want to persevere as I can see it has loads of potential. If anyone has any suggestions I would be extremly grateful

Cheers

set selectedFilepaths to dragInfoPasteboard

copy selectedFilepaths to end of jobList

if (count of selectedFilepaths) > 0 then

set tids to AppleScript's text item delimiters

set AppleScript's text item delimiters to "/"



-- to get the single file name--
set singleFiles to {}

copy selectedFilepaths to toSingleout

repeat with x from 1 to toSingleout's length
    
    set y to toSingleout's item x
    
    set end of singleFiles to text item -1 of y
    
    display dialog "I am moving " & singleFiles
    
end repeat
-- to get the single file name--


set AppleScript's text item delimiters to tids

end if

copy jobList to finishedFilepaths

set toBeReplaced to “Volumes”

set correctBeginning to “RAID/Data”

→ {“/RAID/Data/SHARE/Artwork/extra_special.jpg”, “/RAID/Data/SHARE/Artwork/james.jpg”}

set tids to AppleScript’s text item delimiters – save

repeat with i from 1 to finishedFilepaths’s length

set s to finishedFilepaths's item i

set AppleScript's text item delimiters to toBeReplaced
set s to s's text items
set AppleScript's text item delimiters to correctBeginning
set s to s as string

set finishedFilepaths's item i to s

end repeat

set AppleScript’s text item delimiters to tids

set remoteLogin to “rsh -l XXXX XX.XX.X.XXX cp -p "
set destinationDir to " /RAID/Data/Clients_ODIN/XX/James/Testing/out”

repeat with i from 1 to finishedFilepaths’s length

set toCopy to finishedFilepaths's item i

do shell script remoteLogin & toCopy & destinationDir

I’ll admit that I’m kind of brain fried today but just off the top of my head…have you tried adding “as alias” to the end of that copy command? It seems to me that selectedFilepaths would be in alias form but when you add it to then end of a list it would become text. So you may need to specify to applescript in which form you want your variable so it knows what it’s going to be doing with it.

I’m sort of new to applescript myself but it seems that may be what’s happening.