In the post How to preset the path type in the xref attach dialog box there are some tips but what if you want it further automated and force the AutoCAD attach dialog box to be changed whenever the command is run? Here is one way to do it if you want to automatically get relative path. If you want something else just change the PathType and ImagePathType to 0 for absolute path or 2 for no path.
Here’s the AutoLISP code that creates a command reactor that makes the needed setting in the Windows registry before running XATTACH or IMAGEATTACH. To have this loaded in all drawings add to acaddoc.lsp.
(vl-load-com) (defun activatePathTypeReactor () (if (not PathTypeReactor) (setq PathTypeReactor (vlr-command-reactor nil '((:vlr-commandWillStart . reactonxattach)) ) ) ) ) (defun reactonxattach (event parameter) (if (= (car parameter) "XATTACH") (vl-registry-write (strcat "HKEY_CURRENT_USER\\" (vlax-product-key) "\\Profiles\\" (vla-get-activeprofile (vla-get-profiles (vla-get-preferences (vlax-get-acad-object)) ) ) "\\Dialogs\\XattachDialog" ) "PathType" 1 ) ) (if (= (car parameter) "IMAGEATTACH") (vl-registry-write (strcat "HKEY_CURRENT_USER\\" (vlax-product-key) "\\ISM\\" ) "ImagePathType" 1 ) ) ) (activatePathTypeReactor)
If any of the readers want to find out or know where the settings are for DWF, DGN and PDF please feel free to add a comment. But I think they are not persisted neither in the registry nor in any other settings file so the way to work around that would require another solution.