Well sounds like you botched up real bad.
Heres a possable solution, although as FiberOptics has corectly said, there maybe a far better solution, if u can explain what your doing and why.
I thought id give it a go to see if i could think something up. I came up with this.
Anyway, locate your /HMAKE /HADD & /HDEL commands and replace with /_HMAKE /_HADD & /_HDEL, they run the regular command then extra code.
alias _hmake {
hmake $1-
if (-* iswm $1) { tokenize 32 $2- }
var %win = $+(@hw.,$1) | if ($window(%win)) { window -c %win }
}
;
alias _hadd {
hadd $1-
if (-* iswm $1) { tokenize 32 $2- }
var %win = $+(@hw.,$1) | if (!$window(%win)) { window -hn %win }
aline -n %win $2
}
;
alias _hdel {
hdel $1-
if (-* iswm $1) { tokenize 32 $2- }
if (!$hget($1)) { return }
var %win = $+(@hw.,$1) | if (!$window(%win)) { return }
var %i = 1
while ($fline(%win,$2,%i)) { if ($line(%win,$v1) == $2) { break } | inc %i }
if (($fline(%win,$2,%i)) || ($line(%win,$v1) == $2)) { dline %win $fline(%win,$2,%i) }
}
;
;
;usage $_hash(name,N) results with the Nth added item to that table
;
;
alias _hash {
if (($0 >= 2) && ($hget($1)) && ($2 isnum 1-)) {
var %win = $+(@hw.,$1) | if (!$window(%win)) { return }
var %c = $int($2)
var %m = $line(%win,0)
var %i = 1
while ((%i <= %c) && (%i <= %m)) {
if (!$hfind($1,$line(%win,%i))) { dline %win %i | dec %m } | else { inc %i }
}
if (%c <= %m) { return $line(%win,%c) }
}
}
You can use $_hash(Tablename,N) to locate the Nth added item name, this ONLY works on tables you have used the /_HMAKE /_HADD & /_HDEL commands on
Whats it doing extra?
/_hmake : since this only occurs if the table is new it closes any old hidden window for the table
/_hadd : creates a hidden window for the table if it dont already exist, and adds the new item name if it doesnt exist
/_hdel : if the table exists and the hidden window exists then it searches it for the deleted item and removes said item
$_hash : reads down the hidden window removing non existent items, and returns item N
* Items might become non existent becuase u used /hdel or they were destroyed due to a -uN or a -z flag on the /_hadd
* This means the /_hdel isnt stricklty needed, however if you went /hdel name item and then /_hadd name item it would get left wheer it had been on the creation listand not placed at the end.
Hope this helps. Im sure its not full proof. And doesnt take into account things like /Hinc or /Hdec or /Hload etc.