Queener

Need help with wait until

4 posts in this topic

#1 ·  Posted (edited)

so this is my code, but it doesn't seem to work correctly with the While statement,

 

While WinExists($tvtitle, "Partner ID")
    sleep(1)

    $tvtitle = "TeamViewer"
    $tvtitle2 = "TeamViewer Authentication"
 
WinWaitActive($tvtitle, "")
sleep(5000)
    WinActivate($tvtitle, "")
    ControlSend($tvtitle, "", "[CLASS:Edit; INSTANCE:1]", "{DELETE}")
    sleep(1000)
    ControlClick($tvtitle, "", "[CLASS:Edit; INSTANCE:1]", "left", 1)
    sleep(1000)
    send("222111000") ;Partner ID
    ControlClick($tvtitle, "", "[CLASS:Button; INSTANCE:6]", "Left", 1)
    WinWaitActive($tvtitle2, "")
    sleep(1000)
    WinActivate($tvtitle2)
    ControlClick($tvtitle2, "", "[CLASS:Edit; INSTANCE:1]", "left", 1)
    send("92992") ; default pw
    ControlClick($tvtitle2, "", "[CLASS:Button; INSTANCE:1]", "left", 1)
WEnd

 

my goal is to write a code to get the active teamviewer windows text 'Partner ID'. When you open teamviewer, it pause for a little so if you just run the command, it won't type anything until it's available. Only way to tell if the editable box is available is when the text populate "Partner ID". Thats why I was aiming to wait until it sees 'Partner Id' before it prompt to run the below codes. Any help is much appreciated. I would prefer not to use the If statement unless there's no other option.

 

Edited by Queener

Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.")

Share this post


Link to post
Share on other sites



Can't you start teamviewer using command line options?

1 person likes this

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

let me try again. I could have swore I tried multiple times and it's not working correctly. Though I don't have the free version of teamviewer. I have the enterprise.

 

 

EDIT:

Yes, it worked fine. The reason I couldn't connect because I have it read from an ini file and it has duplicate ID with different password which one of them has the wrong password.

 

but anyways, if you were to write it as I request, how would you code it? This might be useful to a future project.

Edited by Queener

Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.")

Share this post


Link to post
Share on other sites

You need to declare

$tvtitle = "TeamViewer"

before your While ... Wend

$tvtitle = "TeamViewer"

While WinExists($tvtitle, "Partner ID")
    sleep(1)

    $tvtitle2 = "TeamViewer Authentication"
 
    WinWaitActive($tvtitle, "")
    sleep(5000)
    WinActivate($tvtitle, "")
    ControlSend($tvtitle, "", "[CLASS:Edit; INSTANCE:1]", "{DELETE}")
    sleep(1000)
    ControlClick($tvtitle, "", "[CLASS:Edit; INSTANCE:1]", "left", 1)
    sleep(1000)
    send("222111000") ;Partner ID
    ControlClick($tvtitle, "", "[CLASS:Button; INSTANCE:6]", "Left", 1)
    WinWaitActive($tvtitle2, "")
    sleep(1000)
    WinActivate($tvtitle2)
    ControlClick($tvtitle2, "", "[CLASS:Edit; INSTANCE:1]", "left", 1)
    send("92992") ; default pw
    ControlClick($tvtitle2, "", "[CLASS:Button; INSTANCE:1]", "left", 1)
WEnd

 


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now