Jump to content

Need help with wait until


Queener
 Share

Recommended Posts

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.")
Link to comment
Share on other sites

Can't you start teamviewer using command line options?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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.")
Link to comment
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

 

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...