My guess is that since 'fmtx' is in the form oldblock=newblock, the insert command is asking whether
you want to replace the block definition, and you need to answer Yes to that question before you
cancel the insertion with the (command) function with no arguments. Try changing
(command "_.insert" fmtx)
to
(command "_.insert" fmtx "y")
--
Kent Cooper
wrote...
this code is to find an xref, detach it and insert it as a block
if its an old block it delete it and insert a new block
if its a new block with old info it will just redefine it
it works, however i still get an error at the end
; error: bad argument type: stringp nil
i know what causes it but i dont know how to correct it
if i remove the noted code below i dont get the error
can anyone tell me where im wrong?
....
(setq blockname (strcase (cdr (assoc 2 elist)))) ; get block name
(setq blockcheck (substr blockname 1 5))
(setq fmt (strcat blockcheck "2K6"))
(setq fmtx (strcat blockname "=" fmt))
....
============== error is with this========
(if (tblsearch "block" fmt)
(progn
(setvar "cmdecho" 0)
(command "_.insert" fmtx)
(command)
(setvar "cmdecho" 1)
) ;progn
) ;if
==================================
....