The Ghost got it mostly right, but I'm going to rewrite the sub the way I would do it:
sub auto_insure
set !lpc #lpc
set #lpc 1
finditem * c_ , #backpackid
set #lpc 10
for #findindex 1 #findcnt
{
if #findtype notin ckf_twf_ ;add more things to this that do not need to be insured, and are in your backpack... ckf is for bag types. twf is for shovels, etc, etc...
{
wait 10 <--- this is so #property updates, may need to raise it, I wouldn't go lower than 10
event property #findid
if legendary in #property && insured notin #property <--- chage this or add more like: || blahblahblah in #property && insured notin #property
{
exevent popup #charid
click x y ;---need to figure out where the x and y coords are for toggle item insurance on your shard
wait 10
set #ltargetid #findid
set #ltargetkind 1
target
event macro 22 0
key esc
}
}
}
set #lpc !lpc
return
#property is a PITA. I've just hashed this out while working on my BOD Filler. The above SHOULD work, but it will be relatively slow, as wait 10 = 500ms or .5 seconds, and is passed everytime something is scanned in your backpack (for every item). I've encapsulated the function in an if notin statement, adding more things like runebooks, spellbooks. etc to the not to be insured list will make it waaay faster.
Hope this helps, I'll check in later.
- Lydaan
*edit*
LMAO

KISS = Keep It Simple Stupid
See you can see in the screenshot below that the artifact falls into the characters pack and that is the message that pops up, but he does not insure it using the Insure Sub in the script. Even though I put these lines in the script:
if Durability in #property && insured notin #property <--- chage this or add more
if Minax in #property && insured notin #property
if Blackthorn in #property && insured notin #property
if legendary in #property && insured notin #property <--- chage this or add more
if minor magic item in #property && insured notin #property <--- chage this or add more
if lesser in #property && insured notin #property <--- chage this or add more
if greater in #property && insured notin #property <--- chage this or add more
Even when it was just "if Minor" and not "If minor magic item" it still did not try to insure it. As soon as the artifacts started droppign in the characters pack the Insure Sub just stopped working all together. Everything else worked, like he cast EVs in same spot but he still cast them, he healed and cured but the insure sub just stopped working after they started falling in his pack. Also that Insure Sub is with a wait 50 and the second wait was 30. So I upped it from 10 to 50 then up from 10 to 30 to give it more then enough time, and no im not lagging.

EDIT: Just tested something interesting... When I opened the Insure menu and manually checked the box next to each item and then clicked Ok... The Insure Sub started working except it UN Insured both items and left them both UN Insured. Did not try to Re Insure them.