Turn display off and leave MacBook Pro running
To answer your question, "How can I turn off my display and keyboard illumination, while at the same time leaving my MacBook Pro running to execute my iMacro scripts?", one way is to use the Function Keys.

To change the Display brightness use F1 and or F2 respectively to decrease and increase brightness.

To change the backlit Keyboard brightness use F5 and or F6 respectively to decrease and increase brightness.

Note that if under System Preferences > Keyboard > Keyboard you have the "Use all F1. F2, etc. keys as standard function keys" check box checked then you'll need to also press the Fn key along with the wanted Function key to use the special features printed on the keys.

See Portables: Adjusting the keyboard backlight and OS X El Capitan: Adjust your display’s brightness for additional information and note that although the later document if for OS X El Capitan the brightness function keys for portable Macs are the same in earlier versions.  You can Google "OS X Adjust your display’s brightness" for other versions, e.g.: OS X Yosemite: Adjust your display’s brightness