Search & Replace
Description | : | Search and replace text in the current page, section or notebook |
Download |
||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Author(s) | : | Omer Atay | |||||||||||||
Category | : | Find | |||||||||||||
Last Updated | : | January 18, 2021 | |||||||||||||
Requirements | : | OneNote 2010 or above | |||||||||||||
Screenshot | : | ||||||||||||||
![]() Search & Replace
|
|||||||||||||||
Changelog | : | January 18, 2021 (A071EF) - Omer Atay March 23, 2019 (2C3441) - Omer Atay January 23, 2018 (4B1DA4) - Omer Atay June 20, 2017 (5DF85B) - Omer Atay June 20, 2016 (F98703) - Omer Atay These versions are no longer supported: November 06, 2013 - Omer Atay March 02, 2013 - Omer Atay |
Using the "search & replace" macro, is it possible to find and replace special characters such as Paragraph Mark or Paragraph Character? If so would I have to use the ASCII code for the character?
The reason I need this is that sometimes when I copy paste text from web pages or PDF's no matter how I paste (Keep source formatting, merge formatting or text only) the content into OneNote the special characters seem to persist and the only way I can remove them is by going to each one and deleting it manually. If I don't then the text does not wrap/flow properly in the container.
MS Word seems to have solved it by adding a button called "Special" under the find tab for its "Find & Replace"
Any thoughts on why this is happening?
After trying a dozen of times, I failed to upgrade my onetastic to the latest 3.7.1.
And in the process of rolling back to the previous version of 3.2.2, I lost my former macros and find this new version of Search & Replace incompatible with onetastic 3.2.2.
So, I'd be very grateful if someone could help me get Search & Replace compatible with older version onetastic.
Please, help.
I've noticed as well that the color of the text changes if you run any macros that updates my page. (adds in any text). It happens not only for white text but for extremely light grey colored text as well. It just defaults to medium dark grey anytime I run any macro.
I believe this is more of a general issue, because it gets triggered by almost all macros out there that do updates to a page.
I have the exact same issue with the Search & Replace:
It changes the color of my SectionTitles from White to Grey.
I would really like to have a fix for that.
I looked into the "Edit Macro" code of this Macro, but couldn't spot the issue
Thanks for any tips here!
UPrinz
Every time I suse the macro, its changes the text color to white. Is there any way to avoid that?
My pages are set up to have a grey background and blue text. Every time I apply the macro, text is turned to white. Default text is set to blue and it doesn't respect that.
Thanks,
Lapo
this recent Update is AWESOME !!
I have been trying to make loads of macros for selected pages only :(
But I dont have to do that any more
Super
:)
You have been a great help as always.
It's really helpful for me to do all my stuff in onenote, otherwise I
Have to copy and paste pages and pages to word, then do it there, then bring back to onenote, so its a lot of work every day, but this will help me.
Thank you and have a good day :)
$SearchArray = Array(1, 2, 3)
$ReplaceArray = Array("A", "B", "C")
$i = 0
While ($i < Array_Length($SearchArray))
$Search = $SearchArray[$i]
$Replace = $ReplaceArray[$i]
// Do what you need to do here
$i += 1
I am trying to use only 2 Arrays : 1 for all my Search terms and 1 for all my replace terms,
I have got stuck for hours :(
<Macro name="Search & Replace Array " category="Test" description="" publishDate="00-00-00T00:00:00.000Z" version="14">
<Comment text="--------------------------------------------" />
<Comment text="Search & Replace - Using 2 Arrays" />
<Comment text="--------------------------------------------" />
<Expression>$Terms[0] = Array(1, 2, 3)</Expression>
<Expression>$Terms[1] = Array("A", "B", "C")</Expression>
<ForEach var="Term">
<Array>$Terms</Array>
<Expression>$Search = $Term[$i]</Expression>
<Expression>$Replace = $Term[$j]</Expression>
<ForEach var="Text">
<Array>QueryText(GetCurrentPage(), $Search, true)</Array>
<Expression>$Text.value = $Replace</Expression>
</ForEach>
</ForEach>
</Macro>
Can you spot the error?
Thank you :)
I will try that
:)
$Terms[0] = Array(1, "Baseball")
$Terms[1] = Array(2, "Soccer")
$Terms[2] = Array(3, "Have a Great Day!")
this one can't handle large paragraphs
$Terms = Array(Array(1, "Baseball"), Array(2, "Soccer"), Array(3, "Have a Great Day!"))
For each $Term in $Terms
$Search = $Term[0]
$Replace = $Term[1]
For each $Text in QueryText(GetCurrentPage(), $Search, true)
$Text.value = $Replace
is there a way for me to make a table to do search and replacements as explianed below
cheers
Good Sunday!
I am trying to think of ways to search for a term and replace it with a large paragraph which may be > 200 words in onenote.
I thought I would set up a table with Search Terms and replacement paragraphs as below
In a table Column 1 - Search Terms | Column 2 Replacement Paragraphs
Search Term | Replacement (Large Paragraphs)
XX1 | Text Replacement Paragraphs 1
XX2 | Text Replacement Paragraphs 2
many more etc
Then I could search a page and replace the text.
I appreciate onenote is not a word processor - but I have to do this many times a day :( and would love to be able to do it in one note.
What would be the best way to achieve this task.
This would be really helpful as otherwise I have to export my page to word and then reimport, and it takes me time to find each search item.
Because these paragraphs are large the basic Search and replace Array keeps messing up.
Or if there is another better easier way to achieve this task as you are an expert please advise
Thank you very much
:)
yay it worked :)
I was doing the search and replace - one by one, and the process was very slow.
I am totally newbie with arrays too, I just couldn't make it work.
Thanks for being a superstar and helping me!
Have a great week now
:)
$Terms = Array(Array(1, "Baseball"), Array(2, "Soccer"), Array(3, "Have a Great Day!"))
For each $Term in $Terms
$Search = $Term[0]
$Replace = $Term[1]
For each $Text in QueryText(GetCurrentPage(), $Search, true)
$Text.value = $Replace
Hope you are doing great!
I have been trying to set an array for multiple search and replace in my basic script below.
<Macro name="Mulitple Search Replace Texts" category="Test Macros" description="" publishDate="00-00-00T00:00:00.000Z" version="13">
<Comment text="----------------------------------------------------------------------------------" />
<Comment text="Mulitple Search & Replace Text " />
<Comment text="----------------------------------------------------------------------------------" />
<ForEach var="Text">
<Array>QueryObjects("Text", GetCurrentPage())</Array>
<Expression>$Text.selected = false</Expression>
</ForEach>
<ForEach var="Text">
<Array>QueryText(GetCurrentPage(), 1, true)</Array>
<Expression>$Text.value = "Baseball "</Expression>
</ForEach>
<ForEach var="Text">
<Array>QueryText(GetCurrentPage(), 2, true)</Array>
<Expression>$Text.value = "Soccer"</Expression>
</ForEach>
<ForEach var="Text">
<Array>QueryText(GetCurrentPage(), 3, true)</Array>
<Expression>$Text.value = "Have a Great Day!"</Expression>
</ForEach>
</Macro>
How can I set a basic array for search terms and replace terms
Thank you :)
I was able to make it work - with the
<Array>QueryText($oParagraph, "Apple", true)</Array>
<Expression>$Text.value = "Orange"</Expression>
Although thats a silly example - I am able to replace real text, so its good for me to learn the basic expressions. Have a great Evening :)
For each $Text in QueryText($Paragraph, "Apple", true)
$Text.value = "Orange"
This will iterate over each text object with value Apple and set their value to Orange.
hope you are great :)
I am trying to find paragraphs that begin with ZZ in that paragraph I would like to replace the word Apple with Plum as an example.
<Macro name="Search Paragraphs - Containing Text" category="Test Macros" description="" publishDate="00-00-00T00:00:00.000Z" version="13">
<Comment text="Replace in Paragraph that Begins with ZZ" />
<ForEach var="Paragraph">
<Array>QueryObjects("Paragraph", GetCurrentPage())</Array>
<If>
<Condition>String_StartsWith($Paragraph.text, "ZZ", true)</Condition>
<Expression>$FindText = QueryText($Paragraph, "Apple", true)</Expression>
<Expression>$FindText.value = "Orange"</Expression>
</If>
</ForEach>
</Macro>
is this the right way? I have looked at all the docs and examples and cant find a way to make it happen.
Hope you can fix this,thanks!
Thanks for the help. Love Onetastic!
tom
Thanxx again!
you've mentioned "slow" twice, but it sounds like you're talking about them in different contexts. are you saying that onetastic has made onenote and your computer actually slow down? i find that very hard to believe if that is the case. it is astonishing light for all that it does.
now as for your work being "slower" do you mean you aren't able to work as efficiently because onetastic is taking up 60% of the main tab? not that it matters, but you must have a very small monitor or are running at a very low resolution. regardless, the solution is very simple: go the very last item in the onetastic section and left-click on "settings" and the first item named "show in a separate tab" will do exactly what you were asking for. the second item under settings might also be handy if you are using a low resolution which is named "compact mode."
it's too bad you're having various slowdowns with using onetastic, since your only using one macro. there are SO MACROS you could be using, let alone the features in onetastic that you would be missing out on by uninstalling. the number of macros should not be slowing down your computer. i hope that helps with getting onetastic in its own tab.
I certainly like having the F & R macros on the Home tab. It just seems more appropriate that OneTastic be on the Add-In tab, since that's what it is. Doing this, at least for me, would make OneNote easier and less cumbersome to work with. I've uninstalled OneTastic for this reason as F&R is something I use occasionally. I definite wish I could keep your macro handy at all times. Thanks again for giving us a very useful macro.
Would be great if it automatically copied highlighted text into the search field.
Thanks for a great little utility
thanks a lot
And ability to just find and show me the matches as original OneNote does but in hyperlinks,could be great.
1) With a shape (a line) pasted in the same container as the search text - same error as in my post below
2) With a shape (a line) pasted into a container without the search text, and a second container containing search text - same error as in my post below
3) With a shape (a line) pasted outside containers on page with the same containers as in case 2 - search / replace works normally
4) With containers having text only - search / replace works normally
Not sure if there is any way around this, as all of my pages are made from formatted templates that have a container with text and shapes. Any help on this appreciated. I can send examples if the above can\'t be replicated.
Any ideas why this is happening? I have tried a number of different search strings, the first part of the process always works but the text never actually gets replaced. Seems also to find text with search & highlight but same error and text does not highlight.
I\'m using OneNote 2010 x64 on Win7