<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>AutoHotKey on Much Ado About IT</title><link>https://it.knightnet.org.uk/tags/autohotkey/</link><description>
Recent content about AutoHotKey from Much Ado About IT |
Ramblings and rantings from IT Architect &amp; Designer, Julian Knight</description><generator>Hugo | gohugo.io | Theme twenty-sixteen</generator><language>en-gb</language><copyright>This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.</copyright><lastBuildDate>Mon, 24 Apr 2023 21:27:28 +0000</lastBuildDate><atom:link href="https://it.knightnet.org.uk/tags/autohotkey/feed.xml" rel="self" type="application/rss+xml"/><item><title>Copy and Paste to OneNote (AutoHotKey script)</title><link>https://it.knightnet.org.uk/2009/04/copy-and-paste-to-onenote-autohotkey-script.html</link><guid isPermaLink="true">https://it.knightnet.org.uk/2009/04/copy-and-paste-to-onenote-autohotkey-script.html</guid><pubDate>Wed, 01 Apr 2009 09:05:00 +0000</pubDate><guid>https://it.knightnet.org.uk/2009/04/copy-and-paste-to-onenote-autohotkey-script.html</guid><description><div/><div>&lt;p>After yesterdays &lt;a href="https://it.knightnet.org.uk/2009/03/setting-list-item-gaps-in-microsoft-onenote-autohotkey-script.html">OneNote tool post&lt;/a>,
I thought I’d do another while I think about it.&lt;/p>
&lt;p>Another annoyance of &lt;a href="https://www.onenote.com">OneNote&lt;/a> is it’s lack of control over pasting information from the clipboard. I’ve &lt;!-- raw HTML omitted -->raised a suggestion&lt;!-- raw HTML omitted --> with MS to improve this; you can see my &lt;!-- raw HTML omitted -->comment in the newsgroup&lt;!-- raw HTML omitted -->.&lt;/p>
&lt;p>To ease things a little if you need to copy and paste lots of stuff to &lt;!-- raw HTML omitted -->OneNote&lt;!-- raw HTML omitted -->, here is an &lt;!-- raw HTML omitted -->AutoHotKey&lt;!-- raw HTML omitted --> script to help. You need to assign this to a hot-key and have OneNote open in the background. Select something and press the hot-key and it will be pasted (using the current default paste option as this cannot be controlled) into the current note in OneNote.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-fallback" data-lang="fallback">&lt;span class="line">&lt;span class="cl">AutoHotKey Script to copy pre-selected stuff from the currently active window
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">; to the currently open note in OneNote
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">; Usage: #include in your main AutoHotKey.ahk assigned to a hot key
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">; Limitations:
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">; 1) OneNote must be open - maybe change this in the future so that content goes to a new unfiled note
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">; 2) Doesn&amp;#39;t swap back to original application
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">;
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">; Author: Julian Knight, http://www.knightnet.org.uk/contact.htm
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">; Version: 2009-04-01 v1.0
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">; We need a partial title match but we will also reset to previous setting
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">oldTitleMatchMode := A_TitleMatchMode
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">SetTitleMatchMode, 2
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">; Settings
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">winTitlePart := &amp;#34; - Microsoft Office OneNote&amp;#34; ; Partial title of ON windows
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">; Copy currently selected stuff
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">SendPlay, ^c ; Use sendplay to avoid unexpected interactions with Win key
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">; If OneNote is not started, give up
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">IfWinExist, %winTitlePart%
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">{
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> ; Save the currently active window title
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> WinGetTitle, actWin, A
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> ; If OneNote is not active, activate it now
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> IfWinNotActive, %winTitlePart%
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> WinActivate, %winTitlePart%
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> ; Check again, if ON active then paste else error
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> IfWinActive, %winTitlePart%
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> {
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> ; Paste to ON &amp;amp;amp; Add some blank lines
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> SendPlay, ^v`r ; Use sendplay to avoid unexpected interactions with Win key
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> ; Switch window back to previously active
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> WinActivate, %actWin%
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> }
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> else
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> MsgBox, Could not activate OneNote window.
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">} else
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> MsgBox, Can&amp;#39;t find ON [%winTitlePart%]
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">SetTitleMatchMode, %oldTitleMatchMode%
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">return
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;!-- raw HTML omitted -->
&lt;p>&lt;!-- raw HTML omitted --> &lt;!-- raw HTML omitted -->&lt;!-- raw HTML omitted -->Technorati&lt;!-- raw HTML omitted --> : &lt;!-- raw HTML omitted -->AutoHotKey&lt;!-- raw HTML omitted -->, &lt;!-- raw HTML omitted -->Configuration&lt;!-- raw HTML omitted -->, &lt;!-- raw HTML omitted -->Development&lt;!-- raw HTML omitted -->, &lt;!-- raw HTML omitted -->Microsoft&lt;!-- raw HTML omitted -->, &lt;!-- raw HTML omitted -->Office&lt;!-- raw HTML omitted -->, &lt;!-- raw HTML omitted -->OneNote&lt;!-- raw HTML omitted -->, &lt;!-- raw HTML omitted -->Scripting&lt;!-- raw HTML omitted -->&lt;!-- raw HTML omitted --> &lt;!-- raw HTML omitted --> &lt;!-- raw HTML omitted -->&lt;!-- raw HTML omitted -->Diigo Tag Search&lt;!-- raw HTML omitted --> : &lt;!-- raw HTML omitted -->AutoHotKey&lt;!-- raw HTML omitted -->, &lt;!-- raw HTML omitted -->Configuration&lt;!-- raw HTML omitted -->, &lt;!-- raw HTML omitted -->Development&lt;!-- raw HTML omitted -->, &lt;!-- raw HTML omitted -->Microsoft&lt;!-- raw HTML omitted -->, &lt;!-- raw HTML omitted -->Office&lt;!-- raw HTML omitted -->, &lt;!-- raw HTML omitted -->OneNote&lt;!-- raw HTML omitted -->, &lt;!-- raw HTML omitted -->Scripting&lt;!-- raw HTML omitted -->&lt;!-- raw HTML omitted -->&lt;/p>
&lt;!-- raw HTML omitted --></div></description><author>Julian Knight</author><category domain="https://it.knightnet.org.uk/categories/development">Development</category><category domain="https://it.knightnet.org.uk/categories/microsoft">Microsoft</category><category domain="https://it.knightnet.org.uk/tags/autohotkey">AutoHotKey</category><category domain="https://it.knightnet.org.uk/tags/configuration">Configuration</category><category domain="https://it.knightnet.org.uk/tags/office">Office</category><category domain="https://it.knightnet.org.uk/tags/onenote">OneNote</category><category domain="https://it.knightnet.org.uk/tags/scripting">Scripting</category></item><item><title>Setting list item gaps in Microsoft OneNote (AutoHotKey script)</title><link>https://it.knightnet.org.uk/2009/03/setting-list-item-gaps-in-microsoft-onenote-autohotkey-script.html</link><guid isPermaLink="true">https://it.knightnet.org.uk/2009/03/setting-list-item-gaps-in-microsoft-onenote-autohotkey-script.html</guid><pubDate>Tue, 31 Mar 2009 05:58:00 +0000</pubDate><guid>https://it.knightnet.org.uk/2009/03/setting-list-item-gaps-in-microsoft-onenote-autohotkey-script.html</guid><description><div/><div>&lt;p>Although I like Microsoft &lt;!-- raw HTML omitted -->OneNote&lt;!-- raw HTML omitted --> and use it continuously, it does have a few failings. One of these is the inability to set the default styles and layout for text.
In particular, when you create a new paragraph or list entry in OneNote, the default – non-changeable – setting is to have no white space between the paragraphs.
This is very poor design and makes more than a small amount of text quite unreadable. I’ve &lt;!-- raw HTML omitted -->raised this with Microsoft&lt;!-- raw HTML omitted --> but who knows if or when it might be sorted.
In the mean time, I need a far quicker way of changing this. Currently, I’ve had to:&lt;/p>
&lt;ol>
&lt;li>Select the container with the text I want to format&lt;/li>
&lt;li>Use the menu to show the List Task Pane ([alt]o/L)&lt;/li>
&lt;li>Mouse click on the text box to change (you cannot tab into it)&lt;/li>
&lt;li>Change the 0.00 pt default to something like the 6.00 pt that I prefer&lt;/li>
&lt;li>Close the List Task Pane
Not nice!
Having determined that there is nothing clever that can be done in &lt;!-- raw HTML omitted -->OneNote&lt;!-- raw HTML omitted -->, I decided that the old standy “&lt;!-- raw HTML omitted -->AutoHotKey&lt;!-- raw HTML omitted -->” would be useful. So I’ve created a script for &lt;!-- raw HTML omitted -->AutoHotKey&lt;!-- raw HTML omitted --> that will change the inter-list gap for the currently selected container.&lt;/li>
&lt;/ol>
&lt;!-- raw HTML omitted -->
&lt;!-- raw HTML omitted -->
&lt;p>OK, so it’s a bit rough-and-ready but it does save a whole lot of time. I’ve got this in my default AHK script so it is loaded whenever I log in and is activated with [win]z.&lt;/p>
&lt;!-- raw HTML omitted -->
&lt;p>&lt;!-- raw HTML omitted --> &lt;!-- raw HTML omitted -->&lt;!-- raw HTML omitted -->Technorati&lt;!-- raw HTML omitted --> : &lt;!-- raw HTML omitted -->AutoHotKey&lt;!-- raw HTML omitted -->, &lt;!-- raw HTML omitted -->Configuration&lt;!-- raw HTML omitted -->, &lt;!-- raw HTML omitted -->Development&lt;!-- raw HTML omitted -->, &lt;!-- raw HTML omitted -->Microsoft&lt;!-- raw HTML omitted -->, &lt;!-- raw HTML omitted -->Office&lt;!-- raw HTML omitted -->, &lt;!-- raw HTML omitted -->OneNote&lt;!-- raw HTML omitted -->, &lt;!-- raw HTML omitted -->Scripting&lt;!-- raw HTML omitted -->&lt;!-- raw HTML omitted --> &lt;!-- raw HTML omitted --> &lt;!-- raw HTML omitted -->&lt;!-- raw HTML omitted -->Diigo Tag Search&lt;!-- raw HTML omitted --> : &lt;!-- raw HTML omitted -->AutoHotKey&lt;!-- raw HTML omitted -->, &lt;!-- raw HTML omitted -->Configuration&lt;!-- raw HTML omitted -->, &lt;!-- raw HTML omitted -->Development&lt;!-- raw HTML omitted -->, &lt;!-- raw HTML omitted -->Microsoft&lt;!-- raw HTML omitted -->, &lt;!-- raw HTML omitted -->Office&lt;!-- raw HTML omitted -->, &lt;!-- raw HTML omitted -->OneNote&lt;!-- raw HTML omitted -->, &lt;!-- raw HTML omitted -->Scripting&lt;!-- raw HTML omitted -->&lt;!-- raw HTML omitted -->&lt;/p>
&lt;!-- raw HTML omitted --></div></description><author>Julian Knight</author><category domain="https://it.knightnet.org.uk/categories/development">Development</category><category domain="https://it.knightnet.org.uk/categories/microsoft">Microsoft</category><category domain="https://it.knightnet.org.uk/categories/windows">Windows</category><category domain="https://it.knightnet.org.uk/tags/autohotkey">AutoHotKey</category><category domain="https://it.knightnet.org.uk/tags/configuration">Configuration</category><category domain="https://it.knightnet.org.uk/tags/office">Office</category><category domain="https://it.knightnet.org.uk/tags/onenote">OneNote</category><category domain="https://it.knightnet.org.uk/tags/scripting">Scripting</category></item></channel></rss>