I built a new word bank of many words myself. I hope that every time I open this notebook nb file, this cell can run automatically, so that I can automatically assign a value to newwords, and then automatically make cursor jump to the cell of the query content.

enter image description here

newwords={"abate", "abbreviate", "aberrant", "ability pump", "abound", \
"abrade", "abrogate", "abscess", "abstain", "abstinence", "abstruse", \
"abut", "academician", "accede", "accessory", "accommodate", \
"accordion", "accredit", "accreditation", "acid", "hyper", \
"acidosis", "acne", "acquaint", "acquisitive", "acrophobia", \
"acropolis", "acumen", "acupuncture", "adamant", "adduce", "adept", \
"adjunct", "admonish", "admonition", "adobe", "adolescence", "adore", \
"adorn", "adulterate", "advent", "adversity", "adz", "aerobic", \
"aesthetic", "afferent", "affiliate", "affinity", "affluent", \
"afterlife", "ageism", "agile","..."};
SelectionMove[EvaluationCell[], Next, CellContents, 3(*跳转次数*)]

enter image description here

   "obli" ~~ __] &](*After executing the cell above, I want to jump \
to this cell automatically (this cell does not need to run \

enter image description here

I want to achieve this function by modifying the cell expression of the cell where newwords is located, but how can I do this?

enter image description here


1 Answer 1


Assuming they are consecutive cells you can do:

(*make sure this cell does not produce output because then NextCell is the output cell*)
newwords = {...};
selectCell = NextCell[];
SelectionMove[selectCell, Before, CellContents];
NotebookFind[EvaluationNotebook[], "\"", Next, CellContents];
SelectionMove[EvaluationNotebook[], After, Character];
Select[newwords, StringMatchQ[#, "obli" ~~ __] &]

Seems to do what you need.

Side note, consider Iconize for newwords or even move them to a separate .m file and Get it.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.