There are bits of code here and there for that. Here is some test code I wrote a long time ago that you can use. No guarantees and you are totally on your own with the usage and implementation.
One note is this uses your character's context menu, so you need to be sure to change the value of the line passed to the sub HandleConextMenu. Right now it's set to 3, but this might be different depending on what line you find your "Insure Item".
set %item XXYYZ1
gosub InsureItem NULL %item
stop
; %1 InsureItem
; %2 #LTARGETID of item to insure
sub InsureItem
set %insure_item %2
gosub HandleContextMenu NULL 401 262 3 ; click self
target 10s
set #LTARGETID %insure_item
event macro 22 0 ; last target
target 10s
key ESC
return
; %1 HandleContextMenu
; %2 click x location
; %3 click y location
; %4 line number
sub HandleContextMenu
set %xx %2
set %yy %3
set %line_number %4
click %xx %yy mc
gosub GumpWait normal_gump NULL
set %clickxposition #CONTPOSX + 23
set %clickyposition #CONTPOSY + ( 20 * %line_number )
click %clickxposition %clickyposition mc
return