Alert Devonthink to that a mounted volume is in fact mounted and correct the path

Here’s a simple example replacing strings in paths, e.g. enter the old prefix ("/Volumes/groupdirs-1/") and the new one ("/Volumes/groupdirs/").

tell application id "DNtp"
	activate
	try
		set this_selection to the selection
		if this_selection is {} then error "Please select some items."
		
		repeat
			display dialog "Find:" default answer "" buttons {"Cancel", "OK"} default button 2
			set searchString to the text returned of the result
			if searchString is not "" then exit repeat
		end repeat
		
		display dialog "Replace:" default answer "" buttons {"Cancel", "OK"} default button 2
		set replacementString to the text returned of the result
		
		if searchString is not equal to replacementString then
			show progress indicator "Updating Paths..."
			my updatePaths(this_selection, searchString, replacementString)
			hide progress indicator
		end if
	on error error_message number error_number
		hide progress indicator
		if the error_number is not -128 then
			try
				display alert "DEVONthink" message error_message as warning
			on error number error_number
				if error_number is -1708 then display dialog error_message buttons {"OK"} default button 1
			end try
		end if
	end try
end tell

on updatePaths(theseRecords, theSearch, theReplacement)
	local this_record, this_path
	tell application id "DNtp"
		repeat with this_record in theseRecords
			step progress indicator (name of this_record as string)
			set this_path to (path of this_record as string)
			if this_path is not "" then set the path of this_record to my replaceString(this_path, theSearch, theReplacement)
			my updatePaths(children of this_record, theSearch, theReplacement)
		end repeat
	end tell
end updatePaths

on replaceString(theString, theOriginalString, theNewString)
	set {od, AppleScript's text item delimiters} to {AppleScript's text item delimiters, theOriginalString}
	set theStringParts to text items of theString
	if (count of theStringParts) is greater than 1 then
		set theString to text item 1 of theStringParts as string
		repeat with eachPart in items 2 thru -1 of theStringParts
			set theString to theString & theNewString & eachPart as string
		end repeat
	end if
	set AppleScript's text item delimiters to od
	return theString
end replaceString