Hi,
I think that's the issue isn't only the usefulness of the script. The script itself it's ugly :p
Actually, you should be getting first the recovery mode of the DB and after the shrink, you should set it again to the original mode. Also, there is a undocummented SP to LOOP over the DBs.
SP_MSForEachDB
Identically to that, there is another to loop through the tables on the current DB:
SP_MSForEachTable
Both of them have a LOT of useful parameters. Take a look at them.
Cheers,
Gonzalo