Structure-preserving algorithms for solving conservative PDEs with added linear dissipation are generalized to systems with time dependent damping/driving terms. This study is motivated by several PDE models of physical phenomena, such as Korteweg-de Vries, Klein-Gordon, Schrödinger, and Camassa-Holm equations, all with damping/driving terms and time-dependent coefficients. Since key features of the PDEs under consideration are described by local conservation laws, which are independent of the boundary conditions, the proposed (second-order in time) discretizations are developed with the intent of preserving those local conservation laws. The methods are respectively applied to a damped-driven nonlinear Schrödinger equation and a damped Camassa-Holm equation. Numerical experiments illustrate the structure-preserving properties of the methods, as well as favorable results over other competitive schemes.