Why don't you use mIRCs inbuilt auto-op & auto-voice lists?
You can find them in the Address book / 'Control' tab. Press Alt+B (or use the 6th icon from left on toolbar) and click on "Control", then look in the drop down combo. Also see /help Control