Step 1: Find the explicit object. Step 2: choose the pronoun with the same meaning. Step 3: attach it directly to the verb.
ضَرَبَ حَامِدٌ مَحْمُودًا → ضَرَبَهُ حَامِدٌ
نَصَرَ زَيْدٌ حَامِدًا → نَصَرَهُ زَيْدٌ
كَتَبَ الطَّالِبُ الدَّرْسَ → كَتَبَهُ الطَّالِبُ
The examples are deliberately simple: in each pair the receiver of the action stays the object, even though its visible form changes.