ExifTool: Remove (editable) image file metadata

Exists one similar script from user @peavine on the Code Exchange forum.
Here is my own version:


-- script: Remove (editable) image file metadata
-- written: by KniazidisR (today)
-- free ExifTool command-line utility can be found at "https://exiftool.org"

property exiftoolPath : "/usr/local/bin/exiftool "

set imagePath to quoted form of (POSIX path of (choose file of type "public.image"))

display dialog "Delete All metadata?" buttons {"Cancel", "Do Not Delete All", "Delete All"}
if button returned of result is "Delete All" then
	do shell script exiftoolPath & " -overwrite_original -all= " & imagePath
	return
end if

set theTags to paragraphs of (do shell script exiftoolPath & " -s -G " & imagePath)

set ATID to AppleScript's text item delimiters
set AppleScript's text item delimiters to {"[", "]", " "}
set groupNames to {}
set tagNames to {}
repeat with theTag in theTags
	if not (word 1 of theTag is in groupNames) then set end of groupNames to word 1 of theTag
	if not (word 2 of theTag is in tagNames) then set end of tagNames to word 2 of theTag
end repeat
set AppleScript's text item delimiters to ATID

display dialog "Select the method to delete" buttons {"Cancel", "Delete the Metadata Group", "Delete the Metadata"}
set buttonReturned to button returned of result

if buttonReturned is "Delete the Metadata Group" then
	set aChoice to choose from list groupNames with prompt "Select the Metadata Group to delete"
	if aChoice is false then return
	set aChoice to item 1 of aChoice
	try
		do shell script exiftoolPath & " -overwrite_original -" & aChoice & ":all= " & imagePath
	on error
		display dialog "This TagGroup is not editable."
	end try
else
	set aChoice to choose from list tagNames with prompt "Select the Metadata to delete"
	if aChoice is false then return
	set aChoice to item 1 of aChoice
	try
		do shell script exiftoolPath & " -overwrite_original -" & aChoice & "= " & imagePath
	on error
		display dialog "This Tag is not editable."
	end try
end if