This script is for SQL Server 2008 Enterprise Edition. Run the script in SSMS with "results to text". It will generate the compression statements for all tables and indexes for the database it which is run in. It creates the compression scripts in ascending order based on table/index size so smaller tables/indexes are compressed first creating additional space for larger tables/indexes to be compressed.
This will log output of estimate compression for both PAGE and ROW for all tables and indexes