ALTIN Posted September 14, 2010 Share Posted September 14, 2010 (edited) 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 September 20, 2010 by ALTIN Link to comment Share on other sites More sharing options...
ALTIN Posted September 14, 2010 Author Share Posted September 14, 2010 No one can give me an answer here??? Let me know if you need more details... Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 14, 2010 Share Posted September 14, 2010 (edited) 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 September 14, 2010 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 More sharing options...
ALTIN Posted September 14, 2010 Author Share Posted September 14, 2010 (edited) Ok, first see the screenshot of Window Info tool: http://img230.imageshack.us/img230/4716/screenshot1os.pngIm 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') EndIfbut 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) EndIfbut it does not have any effect too... means does not activate or give the focus to the TeamViewer program window... Edited September 14, 2010 by ALTIN Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 14, 2010 Share Posted September 14, 2010 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 More sharing options...
ALTIN Posted September 15, 2010 Author Share Posted September 15, 2010 (edited) oh thanks, here it is: expandcollapse popup>>>> 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 September 18, 2010 by ALTIN Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 15, 2010 Share Posted September 15, 2010 (edited) 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 September 15, 2010 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 More sharing options...
ALTIN Posted September 15, 2010 Author Share Posted September 15, 2010 (edited) 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 September 15, 2010 by ALTIN Link to comment Share on other sites More sharing options...
thehasty Posted January 22, 2014 Share Posted January 22, 2014 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now