help please: entering Authentication Required password

I need a way for AppleScript to enter a predefined password into the “Authentication Required” window which comes up when running an installer.

I’m currently using:

keystroke myPassword
keystroke return

but i noticed that there is a few seconds pause before it enters the information into the authentication window.

Is there something wrong with the implementation or is this a limitation?
Is there a different ways to do this which would enter the information real time?

any help would be very much appreciated.