Teamviewer - Automatically close the 'Sponsored Session' popup
#61
Heh, I'm not usually not the one who posts solutions and stuff on forums. But what the hell, I have such deep respect for everything open-source, so I decided helping you guys out with this was worth a forum-registration.

I've found that a combination of the tool posted in OP and the program "HideAnyWindow" accomplishes exactly what I believe all of us here are trying to achieve. I can start "Teamviewing" at any given moment, and exit it with no popups (no "sponsor" popup, and no TV-main windows in foreground) with the fullscreen of any program, not just XBMC, still intact.

Just download HideAnyWindow, google it (or go to -> http://www.hideanywindow.com/ if you trust people with 1 forum post xP), open Teamviewer so the main window is visible, then go to the "What to hide" section of HideAnyWindow -> Add -> select from running programs or open windows -> choose Teamviewer from that list -> uncheck "Hide tray icon"-> save.
Make sure all the items that was already in that sections are unchecked before you press "Hide" on the main window.

What you hide is hidden through reboots aswell, so this is a one time operation Smile

For some reason Teamviewer 7 wouldn't show up in the list of running programs. After an update to TV8 everything worked fine though.
Also, don't use the option in settings to "Hide selected programs and windows automatically", cause then you'll see a toast window telling you that "windows are now hidden" every so often.
And btw, uncheck the option to start HideAnyWindow with windows if you have XBMC on boot, for some reason it puts itself in the foreground over XBMC at boot when that was enabled. Instead put a shortcut to HideAnyWindow in autostart!

So my setup is:
XBMC, HideAnyWindow and ExitTV*.exe in the autostart folder..

The only prob I have now is that the start menu field is on top of xbmc at boot, solved that by using auto-hide, but it still removes all UI sounds from XBMC.. any ideas?
(I'll google around and add how to solve it to this post if i find the answer!)
Reply
#62
I do not have an automated solution sadly. But I have a workaround. My wife is very ill and bed ridden so I find Teamviewer very useful to help her from my office. Especially around XBMC.

The Session POPUP is so annoying when my wife is so ill she cannot move to close it after i have worked on the Mac. Here is what I do after closing a session on Teamviewer and XBMC is running on top.:

I SSH into the MAC and type

Code:
top -u

This gives me a list of processes running and their PID's. There are two Teamviewer processes. The one with teamviewer_s must not be tampered with. Get the PID of the other teamviewer processs. Then I kill it with this:

Code:
sudo kill insertPIDhere

I enter in my Mac's root password and teamviewer and the pop up disappear and my wife can see XBMC in the front again.

If i need to run a Teamviewer session again i simply SSH into the Mac and type

Code:
open -a teamviewer

I have Teamviewer automatically sign into my profile so that I can teamview from my office to home.

It would be so great to have this done automatcially
Reply
#63
Someone has an script that can be run on OSX? My xbmc installation is running on a mac mini, and when i close my teamviewer session i also get the popup. Is it possible to create such a script to disable it on OSX?
Reply
#64
I want that too for OSX
Reply
#65
Easier solution

Under the TeamViewer Options, Advanced, enable "Automatically minimize local TeamViewer Panel".
Reply
#66
I just registered to brag. I solved this. First person on the web lol. On a mac at least. There are 4 popups, panels, and icons Teamviewer forces on you. After 8+ hours of obsession I figured out how to disable/hide all of them. Here is how to remove all the popups and etc teamviewer throws at you. http://www.websitecodetutorials.com/foru...1164#p1164
Reply
#67
(2014-01-22, 07:58)blazer380 Wrote: Easier solution

Under the TeamViewer Options, Advanced, enable "Automatically minimize local TeamViewer Panel".

wow that was more than easy. this popup was driving me nuts for a long time. glad I found this thread, thanks.
Image
Reply
#68
(2012-07-10, 06:09)csmith665 Wrote: Those of you who use TeamViewer are surely aware of the sponsored session notice present after nearly every remote session. This was incredibly annoying when trying to work with my media center remotely because this popup takes focus away from XBMC. Below is a copy of a script written in AutoHotKey that will find and close this window. It may be helpful to stick a shortcut in the 'Startup' folder in the 'All Programs' menu so that the exe executes at Windows login. The program sits in the task bar and typically utilizes less than 2mb of RAM.

Code:
var1 = 0

#SingleInstance force

While True
{
    ifWinExist , Sponsored session
    {
        WinActivate
        sleep, 500
        Send , {Enter}
    }
}

Direct link to compiled exe: https://www.sugarsync.com/pf/D6150252_4591673_779635


Hey all

So i got this to work using autohotkey HOWEVER! i want to modify it.

lets see if i can explain this right

heres my code: THIS WILL NOT WORK!!!!
Quote:; Force shut down of run away app

#z::ExitApp

; Shut down of Sponsored message from teamviewer
{
var1 = 0

#SingleInstance force

While True
{
ifWinExist , Sponsored session
{
WinActivate
sleep, 500
Send , {Enter}

ifWinExist , Steam

WinActivate
}
}
}
BUT when i change it to:
Quote:; Shut down of Sponsored message from teamviewer
{
var1 = 0

#SingleInstance force

While True
{
ifWinExist , Sponsored session
{
WinActivate
sleep, 500
Send , {Enter}

ifWinExist , Steam

WinActivate
}
}
}

; Force shut down of run away app

#z::ExitApp
IT DOES work.

Can any one explain to me why? All I did was switch places of the "#z" command.

Thanks a ton
--Ozz
Reply
#69
Hello to everyone.

I made custom application for windows based TeamViewer that closes all annoying windows like Commercial use suspected, Sponsored session etc.

Its running on .NET 4 Framework. So if you are a WinXP user, please install before launch.

I am posting link for download.

Please give me feedback.
Reply
#70
I stumbled upon this post looking for something completely different, but got interested in the read when I saw code.

While it's a cool script how it is, I'd make it more efficient. 20% CPU usage is a lot for a little script like this.

Put a sleep in the loop so it checks once per x (I'd do 500ms to a second, personally - why does it have to be instant? If you need it quicker, even a 10 ms sleep will DRASTICALLY reduce CPU hogging) instead of as much as the script possibly can. Remove the silly focus and enter. Just make it kill the process. Relying on a focus with a sendkey is VERY loose; simply sending "enter" is not a reliable way to have a loop run on your computer and close windows. Nor is the waiting and sending ALT+F4. You'll eventually run into some pretty crazy issues just sending keys.

Code:
var1 = 0

#SingleInstance force

While True
{
    ifWinExist , Sponsored session
    {
        WinClose('Sponsored session')
    }

    sleep, 200
}

May need a bit of tweaking to actually get the window closed - didn't test it at all. In theory, WinClose should work fine, but if you experience any issues, just change that to WinKill. WinClose will allow a window to halt the closing of itself (save dialogs, etc.). WinKill forces a window to close.

One thing that could prove useful in your situation(s) as well: Set the title it searches for to an array. Put in as many titles as you'd like and modify the code to loop through the array.

If I knew what window you were wanting to maintain focus, I'd also write some code out for you that focused that window if it wasn't already. I don't, so I'm just going to suggest that you throw a focus check in right before the sleep.

Based on this code:

Code:
ifWinExist , Steam

WinActivate
}

It looks like it's steam. That code should check to see if Steam actually has focus prior to activating it. If it's got focus, you don't want something trying to give it focus over and over. That's wasted CPU.

Quote:Can any one explain to me why? All I did was switch places of the "#z" command.

That line kills the script. It theoretically never triggers when below the "While", because nothing triggers the exiting of the "While" loop. Your script, with the placement of that line at the top, kills itself immediately upon running. Your placement in the second code block is exactly where it should be: after the loop.

EDIT-----

Read through my post, realized I appear condescending. My apologies, no judgement or harsh tone meant here. Just meant to help out.
Reply
#71
(2015-06-11, 22:19)Tacticious Wrote: That line kills the script. It theoretically never triggers when below the "While", because nothing triggers the exiting of the "While" loop. Your script, with the placement of that line at the top, kills itself immediately upon running. Your placement in the second code block is exactly where it should be: after the loop.

That's perfect explanation, Thank you a ton for showing me what it was doing and why it failed if i had it first. EDIT: Would adding Return to the end of the bracket but before the "; force shut down..." cause it to work ahead of the loop??

Quote:
Code:
Code:
var1 = 0

#SingleInstance force

While True
{
    ifWinExist , Sponsored session
    {
        WinClose('Sponsored session')
    }

    sleep, 200
}

I had to change this a little bit so that AHK (From here https://www.autohotkey.com/docs/commands/WinClose.htm) could read it. changed it too whats below. With that being said. I created a .txt doc, called it Sponsored Session. and when the AHK is running it closes the notepad instantly. so that works for that. Ill test it with the actual sponsored message from TV a little later.

Quote:While True
{
ifWinExist , Sponsored session
{
WinClose, Sponsored session
}

sleep, 200

Now i know what you mean by increasing the sleep time but where would i put it so that AHK sleeps the code for 10ms. you are correct in thinking that it does NOT have to be instant....change it from 200 to 1000? or place it else where so that I'm not using 12% of my cpu just with just this script?

Quote:One thing that could prove useful in your situation(s) as well: Set the title it searches for to an array. Put in as many titles as you'd like and modify the code to loop through the array.

If I knew what window you were wanting to maintain focus, I'd also write some code out for you that focused that window if it wasn't already. I don't, so I'm just going to suggest that you throw a focus check in right before the sleep.

Based on this code:

Code:
ifWinExist , Steam

WinActivate
}

It looks like it's steam. That code should check to see if Steam actually has focus prior to activating it. If it's got focus, you don't want something trying to give it focus over and over. That's wasted CPU.

With this you are correct, I have Steam running usually in big picture mode when my son needs me to remote in, i do what i gotta do and get out, sometimes its longer then 1 min of work, thus causing all this chaos and the sponsored messaged popup. would i put the sleep command (to reduce CPU usage) somewhere in here? Or somewhere mentioned above?

Now I'm no noobie when it comes to PC's, but when it comes to programming things or writing code I simply suck at it and cant seem to grasp whats going on in my head even with trying my hardest.

So when we talk about making the code look to see if it has focus before 'winactavte', and creating a array of windows, im not sure at all what you would be talking about Sad but im willing to learn and write code with you if youd like to teach me a little bit.

Thanks for all the help already and the explinations.

SupremeSoul
Reply
#72
(2015-06-12, 04:16)Supremesoul Wrote:
(2015-06-11, 22:19)Tacticious Wrote: That line kills the script. It theoretically never triggers when below the "While", because nothing triggers the exiting of the "While" loop. Your script, with the placement of that line at the top, kills itself immediately upon running. Your placement in the second code block is exactly where it should be: after the loop.

That's perfect explanation, Thank you a ton for showing me what it was doing and why it failed if i had it first. EDIT: Would adding Return to the end of the bracket but before the "; force shut down..." cause it to work ahead of the loop??

No problem at all. Anything after a semicolon is a comment. As soon as "#z::ExitApp" is ran, the application will close without evaluating any further code. That code just needs to be exactly where you want it to close, which in this case, is if it somehow exits the never-ending loop.

(2015-06-12, 04:16)Supremesoul Wrote:
Quote:
Code:
Code:
var1 = 0

#SingleInstance force

While True
{
    ifWinExist , Sponsored session
    {
        WinClose('Sponsored session')
    }

    sleep, 200
}

I had to change this a little bit so that AHK (From here https://www.autohotkey.com/docs/commands/WinClose.htm) could read it. changed it too whats below. With that being said. I created a .txt doc, called it Sponsored Session. and when the AHK is running it closes the notepad instantly. so that works for that. Ill test it with the actual sponsored message from TV a little later.

Ahh, I didn't know you were working with AHK; I thought you were working with AutoIt. Your code is definitely solid, though.

(2015-06-12, 04:16)Supremesoul Wrote:
Quote:While True
{
ifWinExist , Sponsored session
{
WinClose, Sponsored session
}

sleep, 200

Now i know what you mean by increasing the sleep time but where would i put it so that AHK sleeps the code for 10ms. you are correct in thinking that it does NOT have to be instant....change it from 200 to 1000? or place it else where so that I'm not using 12% of my cpu just with just this script?

Presently, that "sleep, 200" is causing it to sleep for 200 milliseconds (the number itself is just defining the sleep duration in milliseconds). If you changed that to 1000, you'd wait a second between each iteration of the loop, and save 5x more CPU usage on that script compared to what my 200ms sleep is saving.

(2015-06-12, 04:16)Supremesoul Wrote:
Quote:One thing that could prove useful in your situation(s) as well: Set the title it searches for to an array. Put in as many titles as you'd like and modify the code to loop through the array.

If I knew what window you were wanting to maintain focus, I'd also write some code out for you that focused that window if it wasn't already. I don't, so I'm just going to suggest that you throw a focus check in right before the sleep.

Based on this code:

Code:
ifWinExist , Steam

WinActivate
}

It looks like it's steam. That code should check to see if Steam actually has focus prior to activating it. If it's got focus, you don't want something trying to give it focus over and over. That's wasted CPU.

With this you are correct, I have Steam running usually in big picture mode when my son needs me to remote in, i do what i gotta do and get out, sometimes its longer then 1 min of work, thus causing all this chaos and the sponsored messaged popup. would i put the sleep command (to reduce CPU usage) somewhere in here? Or somewhere mentioned above?

Now I'm no noobie when it comes to PC's, but when it comes to programming things or writing code I simply suck at it and cant seem to grasp whats going on in my head even with trying my hardest.

So when we talk about making the code look to see if it has focus before 'winactavte', and creating a array of windows, im not sure at all what you would be talking about Sad but im willing to learn and write code with you if youd like to teach me a little bit.

Thanks for all the help already and the explinations.

SupremeSoul

So, one great thing about arrays is that it's just a variable of variables. I'm not familiar with AutoHotkey, so I'll post in AutoIt (if you download the AutoIt SCITE Editor, you can copy and paste the code I provided). If, for example, you wanted two windows to be searched, you'd first set an array of the names of those windows:

Code:
local $windows[2]

$windows[0] = 'Sponsored session'
$windows[1] = 'Skype'

That's simply defining our two windows, which you could certainly have as many as you want in theory. Next, instead of the code above, you'd do something like this:

Code:
While True
{
    For $i = 0 to 1 step +1
        If WinExists($windows[$i]) Then
            WinClose($windows[$i])
        EndIf
    Next

    sleep, 200
}

That code is another loop within our loop. What it does is defines $i, and loops over it starting at the first number (in this case, 0), stopping at the second number (in our case 1), and stepping a certain amount (this example is +1, you could do -2, +50, etc.). Everything from that line to "Next" will be ran through that loop. So, logically what we are doing is checking for "Sponsored Session" as $windows[0] is "Sponsored Session", and then "Skype" as $windows[1] is "Skype". If you had 20, you'd simply set the "local $windows[2]" to "local $windows[20]", and change "For $i = 0 to 1 step +1" to "For $i = 0 to 19 step +1". Array indexes always start at 0 (some languages don't, but AutoIt does). Remember that, as it'll cause some frustration when your brain says "two variables, the first is one" and the code says "two variables, the first is zero" and you forget to translate it into code.

That should get you where you can make a (nearly) infinite list, not that you'd need to, but you could have it killing every WINDOW but Steam Wink

Finished product:

Code:
#include <Misc.au3> ;This is simply here to include functions we reference by setting hotkeys.

local $windows[2] ;This is the amount of windows you will be looping through

$windows[0] = 'Sponsored session' ;Window 1, starting at 0 because arrays start at 0
$windows[1] = 'Skype' ;Window 2

HotKeySet("{F1}", "Exit") ; HotKey set to F1

Func Exit()
    Exit ; Code for action here, in this case to exit the script (i.e. close the program)
EndFunc

;Never-ending loop, built this way so it will run until you stop it
While True
{
    ;Small loop that only loops through each of your Windows, in this case, 2 (0 through 1) incrementing by 1 per iteration
    For $i = 0 to 1 step +1
        ;If the window at the present index exists ($window[$i], where $i = 0 or 1)
        If WinExists($windows[$i]) Then
            WinClose($windows[$i])
        EndIf
    ;On to the next window
    Next

    ;Now, make sure steam is focused
    If WinExists('Steam') Then
        WinActivate('Steam')
    EndIf

    ;Give the CPU a rest for 200ms
    sleep, 200
}

I removed a few things as I wasn't aware it was AHK before. This is fully compatible with AutoIt. What it's not presently doing in that code is checking for itself to ensure it's not multi-instantiated. You MAY want to do that, but it may also be fluff if you're diligent and make sure you're not running more than one instance of this script at a time.

There is an instance where you may want to kill something that is not rendering a window. In AutoIt you can kill a process as opposed to a window. If that becomes a need, it's just as easy as killing a window. I don't imagine you'll need to, as a process won't block the view of streaming, but I thought I'd mention it just in case.

I do think you'll be better-served with AutoIt, but that's more of an opinion than anything else. AutoIt has a lot of classes, is more updated (AHK has been quite a bit behind the times in the past), and as such will be more optimized and probably use less CPU. I don't have both of them running in front of me to compare, but I would dare say you could have that AutoIt script running with less CPU usage. Maybe not, just a guess.

P.S. I want to commend you. Scripting isn't the easiest (albeit, not the hardest) thing in the world to jump into. Way to go on getting your hands dirty and coming up with a functional script so quickly! I LOVE coding (do it for a living - love work), and I am of the opinion that it is very rewarding to see keystrokes translate into something functional. Again, good job.

P.P.S. Oh, also, I would like to bring up one point. If you go to close this script, it may be difficult as every 200ms Steam will receive focus. A great way to give yourself an easy kill-command is hotkeys. I've included that in the final code snippet. In my example it's F1, but change it to your liking. You may ask yourself "if the Func Exit() is before the while loop, why doesn't it kill the program without doing anything?" which would be a good question. Functions are only ran when called. You're storing a bit of code in memory to be called later on. You may know that, you may not. Thought I'd elaborate just in case there was curiosity. One thing about AutoIt, though (I think it's this way with AHK as well) once you click the task tray icon it pauses. Always a good idea to have a kill hotkey for any infinite loop, however.
Reply

Logout Mark Read Team Forum Stats Members Help
Teamviewer - Automatically close the 'Sponsored Session' popup2