thanks for excellent script it worked till I changed to HPOS.
Can anyone update this script, it doesn't work anymore with HPOS enabled?