another way but waits for Ready to connect(secure connection) status message (english language only) since it appears your trouble is because your not connected .
if using another language besides english in teamviewer use code below.
int w
run "$program files$\TeamViewer\TeamViewer.exe" "" "" "" 0x800 win("TeamViewer" "#32770") w
;again
str text.getwintext(child("" "Static" w 0x0 "id=1")) ;;text '
if(text !="Ready to connect (secure connection)") 0.3; goto again
str txt.getwintext(child("" "Edit" w 0x0 "id=1")) ;;editable text 'YOUR ID'
out txt
str txt1.getwintext(child("" "Edit" w 0x0 "id=1" 2)) ;;editable text 'PASSWORD'
out txt1
if using another language besides english in teamviewer use code below.
int w
run "$program files$\TeamViewer\TeamViewer.exe" "" "" "" 0x800 win("TeamViewer" "#32770") w
;again
str txt.getwintext(child("" "Edit" w 0x0 "id=1")) ;;editable text 'YOUR ID'
if(empty(txt) or txt="-") 0.3; goto again
out txt
str txt1.getwintext(child("" "Edit" w 0x0 "id=1" 2)) ;;editable text 'PASSWORD'
out txt1