Processing Ajax...

Title

Message

Confirm

Confirm

Confirm

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure?

User Image
ShawnJustShawn
8 discussion posts
Trying to see if it's possible to trigger or script based on a Window changing in some way.

Short term / small reason : I want to simply highlight Slack if it updates in anyway to improve visibility since the notifications are not the best. The contents of the window obviously change a little when an update happens since there are unread message tags. But also the taskbar changes as well (windows 10) because it updates the badge with an unread count.

Bigger reason : I think it would be very helpful to combine window changes with the script Thomas wrote "Actively Dim Unfocused Windows" to something that Dims all windows until they have been updated in some way after they are out of focus. Or a non dimming script that just highlights any windows that have been updated since they lost focus. I think it would be helpful on the large screen to see when the windows have been updated. (Outlook, chat apps, network monitors etc.)

I did a handful of searches in the discussion and didn't find an obvious answer.

Thanks for any answers or ideas. -S
Oct 17, 2017  • #1
Keith Lammers (BFS)'s profile on WallpaperFusion.com
Unfortunately this wouldn't really be possible to do. The only reliable way to detect when a window changes would be to monitor for WM_PAINT messages, but applications repaint themselves a lot, so the Trigger would just be constantly firing.

Sorry!
Oct 18, 2017  • #2
User Image
ShawnJustShawn
8 discussion posts
Thanks Keith,
Ah. Makes sense but of course disappointing.

Is there any ability to watch for "SetOverlayIcon" that happens on the task bar? From what I understand when nothing is present the value is Null. If there was some way to highlight a window based on the overlay icon being not equal to null maybe?

https://msdn.microsoft.com/en-us/library/windows/desktop/dd391696%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396

Unfortunately I am not a real coder so only making some leaps here. If you think it is possible I can try to piece some things together. But if a lost cause .. won't bother.

-S
Oct 18, 2017  • #3
Keith Lammers (BFS)'s profile on WallpaperFusion.com
Ah, that's an interesting idea! I will put that on our list for further investigation. If it's something we're able to implement reliably in a future version, we'll definitely let you know :)

Thanks!
Oct 18, 2017  • #4
User Image
ShawnJustShawn
8 discussion posts
Hi Keith,
In my continuing efforts to get slack improved i have rounded down a way using powershell to monitor a slack log file and trigger another action. In this case it is just a OK popup.

Can you think of any good way to integrate this idea into DisplayFusion? It would be awesome to have it trigger DF to highlight the slack window or dim everything else or whatever rather then just the OK box I have.

A round-about way is that I could have the PS script execute a process of something that doesn't matter and have DF trigger on that process launch (or end). But that seems clumsy.

This is the PS line.

Code

Get-Content -Path C:\Users\UserName\AppData\Roaming\Slack\logs\browser.log -Tail 0 -Wait | where {if ($_ -match "NEW_NOTIFICATION") {write-host (new-object -ComObject wscript.shell).Popup("Check it OK",0,"Hey You! You have a new slack message!!!")}}


FYI the browser.log file on slack only adds the NEW_NOTIFICATION item when the window is not in the foreground. Not on every new message.
May 4, 2018  • #5
Thomas Malloch (BFS)'s profile on WallpaperFusion.com
Sorry for the late reply!

I put together a script that should work for you. It uses the FileSystemWatcher class to keep track of a file of your choosing, then lets you know when it changes with the search text you provide. Here's how to get it into DisplayFusion:

  • Download the file attached to this post
  • Open DisplayFusion Settings window to the "Functions" tab
  • Press the "Add Scripted" button
  • In the window that pops up, copy the code from the file you downloaded in the first step into the window
  • Change the "Path" and "SearchText" variables on lines 20 and 21 to the file you want to watch, and the text you want to be notified about
  • Give it a name, then Click "OK" to save and close that window, then "OK" again to save and apply your changes

This script would probably work best with a "DisplayFusion Starts" Trigger. Here's how to set that up:

  • Open the DisplayFusion Settings window to the "Triggers" tab
  • Click the "Add" button
  • Select "DisplayFusion Starts" from the "Event:" dropdown
  • In the Actions section, select "Run Function" from the "Add" dropdown
  • Select the function you created in the steps above
  • Click OK to close that window, then OK again to save and apply your changes

I hope this works for you!
• Attachment: Watch for New Slack Message.txt [4,998 bytes]
May 31, 2018  • #6
User Image
ShawnJustShawn
8 discussion posts
HI Thomas,
Really appreciate the reply. I tried it out to partial success. When the function initially runs it pops an alert if it sees the search string has appeared since the last time it had the file open.

But ... it won't pop an alert when a new update is made to the file. In order for it to alert again I have to close the function and re-run it.

Along the same line, if the file has not been updated and the function is started it will not pop on any new updates.

Seems like either the file watcher isn't notifying the function of an update on the fly or the function isn't looping properly ?

My understanding of C is a bit rudimentary at best.

Any ideas? I tried making a few changes to the breaks and reviewed things but didn't have any luck yet.

Thanks again -Shawn
Jun 5, 2018  • #7
Thomas Malloch (BFS)'s profile on WallpaperFusion.com
Apologies for the late reply!

Sorry this script isn't working for you. Would you be able to try out some things for me to get to the bottom of these problems?

First: Can you make sure that the script is running in the System Tray? (all of those icons near the clock on the right side of your taskbar)

Second: Can you make sure that those "NEW_NOTIFICATION" lines are actually showing up in your log? You can do this by using some log monitoring software, like: https://www.logfusion.ca/.

Hopefully we can get to the bottom of these problems!

Thanks
Aug 14, 2018  • #8
Subscribe to this discussion topic using RSS
Was this helpful?  Login to Vote(-)  Login to Vote(-)