Hi markco3000,
I’m afraid you’d need to examine the file system to find out the raw connection IDs: they’re not available through AppleScript.
That said, for things like YubiKey we recommend using Viscosity and OpenVPN’s static challenge support which is built especially for one time passwords (instead of using the Username/Password dialog). Information about static challenge support can be found in the following post:
https://www.sparklabs.com/forum/t/otp-box-in-login-prompt/696/2
Cheers,
James