Search Multi-Keywords

Description : Search the paragraphs containing all the multiple keywords within a scope, and create a new page reporting the search results in the current section. Use semicolons (;) to separate the keywords, e.g. keyword1;keyword2;keyword3. There is (theoretically) no limit to the maximum number of keywords. But the speed is optimized for searching three keywords, and it slows down when more than three keywords are used. There are five opinions of scopes available, namely, “Current Page”, “Selection”, “Current Selection”, “Current Notebook”, and “All Notebooks”. It can take a long time, if search in notebook(s). Skip function is available, that is mainly for excluding pages that contain the previous search reports, to avoid duplicating the search results. Skip can take place in all scopes except the “Current Page” opinion. Change the texts as if you desired. It will skip the pages if their names contain the defined string. The report page lists the matched paragraphs and where they are found in.

Download

Search Multi-Keywords

You need Onetastic Add-in
for OneNote to run this macro.
Download Onetastic
Author(s) : Chris K.Y. FUNG
Category : Find
Last Updated : November 03, 2016
Rating :
(5)
Download(s) : 4268
Screenshot :

Search Multi-Keywords

Find what
(use ; to separate multiple keywords)
Scope
Exclude pages
Changelog :

November 03, 2016 (C12A1D) - Chris K.Y. FUNG
This macro was broken in an update and it wasn't reporting the search results. It now does.

June 19, 2016 (C328CE) - Chris K.Y. FUNG
Automatically upgraded to the new Macro Language

These versions are no longer supported:

July 30, 2014 - Chris K.Y. FUNG
Initial version

Comments

Name
Comment
Omer Atay - 2017-01-29
Dan:
For each $Page in CurrentSection().pages
    $Texts = QueryText($Page, "#", true)
    $Texts[0].value = "Hello"
Dan - 2017-01-27
Hello Omer,

how do i make it do it for all pages now in the section
In each Page there is a #
The First # you find replace with "Hello"
Now do the next page ....etc


  <Expression>$Text = QueryText(GetCurrentPage(), "#", true)</Expression>
  <Expression>$Text[0].value = "Hello"</Expression>
I still cant figure it out :(
Omer Atay - 2017-01-26
Dan: Then you don't want to query text in current section, since you are already going through each page. You just need to query text in that page. Otherwise you are querying in the whole section for each page.
Omer Atay - 2017-01-17
Dan: $AllInstancesOfTheWordOnetastic[0].value = "Hello"
Dan - 2017-01-16

Hello Omer,

How can I replace only the first time the word is found

$AllInstancesOfTheWordOnetastic = QueryText($CurrentPage, "Onetastic", true)

Replace the first instance of onetastic with "Hello" for example
Omer Atay - 2016-12-13
Dan: Just type the character: QueryText(GetCurrentSection(), "茀", true)
Dan - 2016-12-13
Hello Omer,

just a quick one in VBA  ChrW(8300)

How would i encode that so that a macro in onetastic will understand i am looking for ChrW(8300)

QueryText(GetCurrentSection(), "&#8300", true)

didn't work :(



Dan - 2016-11-12
Thank you Omer,
it worked!
Have a great weekend :)
Omer Atay - 2016-11-11
Dan: You are never actually incrementing $i. It is always 0. Also "$i + 1" is not evaluating an arithmetic expression. It is a string literal. You need something like:
$i += 1
$Text.value = "XXX" & $i
Dan - 2016-11-11

Hi Omer,

Hope you are well.
I am trying to number each time "XXX" is found to   XXX1, XXX2,XX3 etc

  <Expression>$i = 0</Expression>
  <ForEach var="Text">
    <Array>QueryObjects("Text", GetCurrentPage())</Array>
    <Expression>$Text.selected = false</Expression>
  </ForEach>
  <ForEach var="Text">
    <Array>QueryText(GetCurrentPage(), "XXX", true)</Array>
    <Expression>$Text.value = ("XXX" &amp; "$i + 1")</Expression>
  </ForEach>
</Macro>


Is this the correct way
Thank you :)
Landon - 2016-11-09
Thank you Omer!  It is working now.
Omer Atay - 2016-11-02
Landon: Sorry it seems like I have forgotten about it. This macro is now fixed. Download it again and see if you can get it to work now.
Landon - 2016-11-02
Thank you Omer for the help.  Any progress on getting an update out?
Omer Atay - 2016-08-10
Landon: It seems like this macro got broken during 3.0 update. I will check it out later and update.
Landon - 2016-08-10
I'm not seeing the report page (any results).  Is there a default location where it is created?  Or is it a dialog box?  I am using OneNote 2016 32-bit version 16.0.7030.1021.  Onetastic is on version 3.1.1.  Thanks for the help.
Landon - 2016-08-10
I'm not seeing the report page (any results).  Is there a default location where it is created?  Or is it a dialog box?  I am using OneNote 2016 32-bit version 16.0.7030.1021.  Onetastic is on version 3.1.1.  Thanks for the help.
mwoffenden - 2016-05-30
Perfect!  OneNote's built-in search is very buggy, so it's great to have this macro.
PunterMuniya - 2015-05-18
Thank you.

Works great for me..:)
Jeremy - 2015-04-09
Hi there. Ay chance to add functionality to allow for a replace? I left a request/comment on the search and replace macro as well. I am looking to search on multiple items like you have and to replac them with one item - like a blank pace. Thanxx for the consideration.

Jeremy