Quote from Daal:
If the stock has SSFs then you can use it and no tax. otherwise the only way I found is the way you describe, which works but there might be tax problems and the commisions
I actually gave you misleading advice for which I apologize. I dont think you can buy at 16:01 on the pre-ex-dividend day,this would probably settle the stock trade before the record day and give you the dividend. I believe(and I will test soon) you need to sell 15:59(maybe a little later if you are paranoid about gains in the after hours) then buy the shares back on the gap down on the ex-div date(maybe with a opening only order?)
I wonder if somebody has experience with this