Jump to content

[SOLVED] AUTOIT does not work with TeamViewer?? Help!


ALTIN
 Share

Recommended Posts

Hello people,

I just had an idea to create a small program to help maintain Team Viewer contacts and so I need to give focus to the program window first.

But WinActivate() does not seems to work with Team Viewer and does not give the focus to that window (no effect).

It works with other programs.

Also WinGetPos() is not working to get TeamViewer window position...

Is there any other way to give focus to that window and so & so?? Please any suggestion or any thought that may help in some way.

Thanks in advance;)

Edited by ALTIN
Link to comment
Share on other sites

No idea given of what you tried or how it failed. Before trying to do anything to the window, get the handle with WinGetHandle(). If that fails, what did you try to identify the window? What do you see on the Summary tab of the AutoIt Window Info Tool (AU3Info.exe)?

;)

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Ok, first see the screenshot of Window Info tool: http://img230.imageshack.us/img230/4716/screenshot1os.png

Im creating a simple program where I can save TeamViewer IDs with a name along with the ID to know whose that ID belongs (just like a phonebook).

Then I can select a name from my program and the appropriate ID will be pasted into TeamViewer ID field. But i cant manage to set the focus or to activate the TeamViewer window using autoit. It just dont work.

I tried

If WinExists('TeamViewer') Then 
WinActivate('TeamViewer') 
EndIf

but this does not work and does not activate the window. NOTE that it does not work ONLY with team viewer. It works perfect with Notepad window or other prog.

Also tried

$handle = WinGetHandle("TeamViewer") 
If @error Then 
MsgBox(4096, "Error", "Could not find the correct window") 
Else WinActivate('TeamViewer') 
sleep(5000) 
EndIf

but it does not have any effect too... means does not activate or give the focus to the TeamViewer program window...

Edited by ALTIN
Link to comment
Share on other sites

I'm not in a sufficiently locked down station to click on imageshack links. Just highlight the text on the Summary tab and copy/paste it into

tags.

;)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

oh thanks, here it is:

>>>> Window <<<<
Title:  TeamViewer
Class:  #32770
Position:   454, 120
Size:   593, 404
Style:  0x94CA08CC
ExStyle:    0x00050101
Handle: 0x000104B4

>>>> Control <<<<
Class:  Edit
Instance:   1
ClassnameNN:    Edit1
Name:   
Advanced (Class):   [CLASS:Edit; INSTANCE:1]
ID: 1001
Text:   
Position:   419, 169
Size:   117, 15
ControlClick Coords:    49, 13
Style:  0x50000380
ExStyle:    0x00000000
Handle: 0x000104BE

>>>> Mouse <<<<
Position:   925, 324
Cursor ID:  0
Color:  0x000000

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
Please enter your partner ID in order to create a session.
ID
209 *** ***
209 *** ***
Remote support
Presentation
File transfer
VPN
Connect to partner
ID
691 *** ***
Password
****
Ready to connect (secure connection)
Please tell your partner the following ID and password if you are waiting for a session.


>>>> Hidden Text <<<<
Login for partners
Invitation e-mail
Beta feedback
Incoming connections are disabled
Abort connection
Buy License
http://go.teamviewer.com

It seems like autoit just cant control this window. Maybe you can try in your pc ?

Thanx so much...

Edited by ALTIN
Link to comment
Share on other sites

I don't have it loaded, but would have tried it this way, based on the window info:

$hTeamViewer = WinGetHandle("[CLASS:#32770; TITLE:TeamViewer]", "")
If @error Then
    MsgBox(16, "Error", "Failed to find TeamViewer window.")
    Exit
EndIf

WinActivate($hTeamViewer, "")
If WinWaitActive($hTeamViewer, "", 2) Then
    MsgBox(64, "Success", "Activated TeamViewer window: " & $hTeamViewer)
Else
    MsgBox(16, "Error", "Failed to activate TeamViewer window.")
EndIf

It might be worth bitting out the Style, ExStyle, and WinGetState() values to see if there is anything unusual set on that window, too.

;)

Edit: Clarification

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Wow, PsaltyDS, WORKED GREAT, window activated! Thanks very very much bro.

The even good part, is that I i learned that new way to

get the window handle using both Class and Title.

Thanks for your generous help and hope this can help any other too ;)

-----------------------------------

P.S. How can I add [sOLVED] to the post title here???

--------------------------------------------------------------------

Edited by ALTIN
Link to comment
Share on other sites

  • 3 years later...

I just switched to TeamViewer9 since LogMeIn Free will be gone very soon.

This is the script I use:

Quote

Local $tvHandle = 0
#NoTrayIcon
while True
   $tvHandle = WinWait("Sponsored session")
   if Not ($tvHandle = 0) Then
      WinActivate ("Sponsored session")
      sleep(20)
      Send("{Space}")
   EndIf
   sleep(100)
WEnd

Change sleep to your preference. It works great on an "old" win7 x64 AMD laptop I tested it on, mostly using 0% CPU and sometimes flickers 1%.

I also added it to start automatically under HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionRun

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...