grimmlock Posted January 27, 2014 Posted January 27, 2014 Good Morning, I have a wierd question, that I have not been able to solve. If anyone has used Team Viewer before you know that when you are done accessing a PC (using the Personal Free Version) that the TeamViewer window pop up. So I have created a small little script that runs and closes the window if it exists. If winexists('TeamViewer', '') Then winclose('Teamviewer', '') Endif However I just ran into a snag where if I open a browser and try to login to my Team Viewer account it closes the browser, because I have told the script to close any and all windows that have TeamViewer at the title to close. Is there a way to have the script know the difference between a browser tab and the app? That way I can access my TeamViewer account using a browser but still have the TeamViewer App windows close. Thanks in advance. Grimm Thanks Grimm
BrewManNH Posted January 27, 2014 Posted January 27, 2014 The app's popup window has more than just TeamViewer in the title, try looking for that instead. Or use the class name of the window. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
grimmlock Posted January 27, 2014 Author Posted January 27, 2014 Unfortunately the title only has TeamViewer in the title for the app. I am trying to locate the Class name but finding it difficult. I have used the Autoit tool as well as WinGetHandle, both with no luck. Thanks, Thanks Grimm
jdelaney Posted January 27, 2014 Posted January 27, 2014 You'd have to post the output of autoitwindow info tool. You have to give us something to go off of. IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
grimmlock Posted January 27, 2014 Author Posted January 27, 2014 (edited) *Updated* My apologizes what output would you like to see, meaning what tabs or information? I took a screenshot and attached it. Thanks, Edited January 27, 2014 by grimmlock Thanks Grimm
JohnOne Posted January 27, 2014 Posted January 27, 2014 Summary tab. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
jdelaney Posted January 27, 2014 Posted January 27, 2014 (edited) That class is an 'enabled popup'. If you have the handle of the parent window, you can use this; $hpopup = _WinAPI_GetWindow($hParent,6) That's a really helpful function to dynamically grab any message from the application. Then use the title and text of the window to know what actions to perform. Edited January 27, 2014 by jdelaney Xandy 1 IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Xandy Posted January 27, 2014 Posted January 27, 2014 (edited) I've done this. I do kinda forget how exactly though. I suggest an array of block strings. $a_block[0] = "Google Chrome" $a_block[1] = "Internet Explorer" $a_block[2] = "Some Other String to Block" When you find one of the block strings in the window title, don't close the window. Edited January 27, 2014 by Xandy Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker)
grimmlock Posted January 27, 2014 Author Posted January 27, 2014 Data from Summary Tab >>>> Window <<<< Title: TeamViewer Class: #32770 Position: 687, 281 Size: 546, 478 Style: 0x96CA08CC ExStyle: 0x00050101 Handle: 0x00010178 >>>> Control <<<< Class: Instance: ClassnameNN: Name: Advanced (Class): ID: Text: Position: Size: ControlClick Coords: Style: ExStyle: Handle: >>>> Mouse <<<< Position: 830, 288 Cursor ID: 0 Color: 0xBBD0F0 >>>> StatusBar <<<< >>>> ToolsBar <<<< >>>> Visible Text <<<< Control Remote Computer Please enter your partner's ID in order to control the remote computer. Partner ID 772020948 772020948 Remote control File transfer Connect to partner Allow Remote Control 534 671 829 Please tell your partner the following ID and password if you would like to allow remote control. v442du Use your personal password to access this computer from anywhere. >>>> Hidden Text <<<< Initializing security settings... Statisch VPN Abort connection Personal Password Host Meeting Schedule meetings Schedule a meeting My meetings Start instant meeting Abort meeting Join Meeting Please enter the ID of the Meeting you would like to participate in. Meeting ID m Your name Join meeting Abort connection Start a spontaneous meeting and invite participants to it. Presentation mode Video mode Thanks, Thanks Grimm
BrewManNH Posted January 27, 2014 Posted January 27, 2014 When I end a TV session I get this pop up dialog.>>>>> Window <<<<Title: Sponsored sessionClass: #32770Position: 434, 280Size: 491, 168Style: 0x94C000CEExStyle: 0x00010109Handle: 0x00080460>>>> Control <<<<Class: StaticInstance: 2ClassnameNN: Static2Name:Advanced (Class): [CLASS:Static; INSTANCE:2]ID: 20097Text: This was a free session sponsored by www.teamviewer.com.TeamViewer sessions are free of charge for personal use.We thank you for playing fair!Position: 81, 11Size: 386, 75ControlClick Coords: 126, 41Style: 0x50020000ExStyle: 0x00000024Handle: 0x000404B8>>>> Mouse <<<<Position: 644, 357Cursor ID: 0Color: 0x000000>>>> StatusBar <<<<>>>> ToolsBar <<<<>>>> Visible Text <<<<Like!Buy LicenseOKThis was a free session sponsored by www.teamviewer.com.TeamViewer sessions are free of charge for personal use.We thank you for playing fair!>>>> Hidden Text <<<<4Show my desktopDon't show this dialog againWhat you're showing is the main window for TV. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
Solution grimmlock Posted January 27, 2014 Author Solution Posted January 27, 2014 (edited) I got it, it took me forever but this seems to work, $tview = "" $thandle = WinGetTitle("[ACTIVE]") If $thandle = "TeamViewer Management Console - Mozilla Firefox" Then $tview = "Console" If $tview = "Console" Then EndIf ElseIf $thandle = "TeamViewer" Then $tview = "App" If $tview = "App" Then WinClose("TeamViewer") EndIf EndIf Thanks for everyone's help Edited January 27, 2014 by grimmlock Thanks Grimm
jdelaney Posted January 27, 2014 Posted January 27, 2014 (edited) I disagree with that being the best answer. Also, you should be using the handle of the window, or the first instance of 'TeamViewer' will close, and possibly not the one you expect to close. Or, winclose("[ACTIVE]") Edited January 27, 2014 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
BrewManNH Posted January 28, 2014 Posted January 28, 2014 I didn't realize you were starting a session from the web browser and not the application. You should look for the text of the window to match, as well as the title, this way you know you're closing the right window. Xandy 1 If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
andy_mcrae Posted May 19, 2017 Posted May 19, 2017 I also use the WinGetText("text here") funct. to grab infos I need for my windows. But sometimes it unfortunately doesn't find the text I need. It really depends on the type of windows (Visual Studio, SQL Server, Chrome.. etc.)
andy_mcrae Posted May 19, 2017 Posted May 19, 2017 I also use the WinGetText("text here") funct. to grab infos I need for my windows. But sometimes it unfortunately doesn't find the text I need. It really depends on the type of windows (Visual Studio, SQL Server, Chrome.. etc.)
andy_mcrae Posted May 19, 2017 Posted May 19, 2017 I also use the WinGetText("text here") funct. to grab infos I need for my windows. But sometimes it unfortunately doesn't find the text I need. It really depends on the type of windows (Visual Studio, SQL Server, Chrome.. etc.)
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