On sharepoint, I can use OneNote webapp to edit notes. However, the win title doesn't mention the webapp name and simply gives the title of the note.
I have code where control+B bolds the text using unicode, and would like to disable this when in Office webapps. How do I identify them in AutoHotkey so this can be achieved?
Identify windows using Office webapps
-
- Posts: 501
- Joined: 03 Dec 2018, 20:02
Re: Identify windows using Office webapps
Perhaps, use a userscript to add a suffix to the wintitle of the web app.
Code: Select all
// ==UserScript==
// @name Suffix for SharePoint
// @namespace Violentmonkey Scripts
// @match https://microsoft.sharepoint.com/*
// @grant none
// @version 1.0
// @author -
// @run-at document-start
// @description Add window title suffix for SharePoint
// ==/UserScript==
const suffix = " - SharePoint Webapps";
document.title += suffix;
new MutationObserver(function(mutations) {
console.log(document.title);
if (!document.title.endsWith(suffix)) {
document.title += suffix;
}
}).observe(
document.querySelector('head'),
{ subtree: true, characterData: true, childList: true }
);
Re: Identify windows using Office webapps
I pasted the entire code into tampermonkey and enabled it, but the suffix is still not added. initially thought it was because the @match is commented out, so I took away the // but it also made no difference. could u help please?william_ahk wrote: ↑10 Jan 2024, 03:15Perhaps, use a userscript to add a suffix to the wintitle of the web app.
Code: Select all
// ==UserScript== // @name Suffix for SharePoint // @namespace Violentmonkey Scripts // @match https://microsoft.sharepoint.com/* // @grant none // @version 1.0 // @author - // @run-at document-start // @description Add window title suffix for SharePoint // ==/UserScript== const suffix = " - SharePoint Webapps"; document.title += suffix; new MutationObserver(function(mutations) { console.log(document.title); if (!document.title.endsWith(suffix)) { document.title += suffix; } }).observe( document.querySelector('head'), { subtree: true, characterData: true, childList: true } );
if it works, how do I amend the script such that it works on multiple sites? i.e.
if site A, add suffix ABC
if site B, add suffix DEF
-
- Posts: 501
- Joined: 03 Dec 2018, 20:02
Re: Identify windows using Office webapps
Make sure the script is active when you open the TamperMonkey menu on the webpage. The meta block is meant to be a comment instead of executable code, so that is not correct.
The easiest way would be duplicating the script and changing the @match url.
Btw, just found there's an extension for this. Maybe it works better:
https://chromewebstore.google.com/detail/append-to-title/gnfndkjpfcdlgbncmmkojohcnokpcona