Randomize Text Callouts

Copy link to clipboard
Copied
Hi folks,
I am teaching an anatomy course remotely this semester. To help students learn, I have been using Adobe Acrobat to create labeled diagrams of skeletons and muscles. Right now, I am labeling each bone with its proper name using text callouts, but I am also considering using non-specific labels (A, B, C...) so that students can use these sheets to quiz themselves.
If I were to create ten text callouts, for example, is there any way to randomize the text of each callout? e.g. so that A becomes a random letter? Otherwise, I am worried that the students will just memorize that A = femur and not actual learn how to identify the femur.
Thank you,
Tony
Copy link to clipboard
Copied
You could create text field that can change random letter on mouse enter or create button to change text field letter on click.
See this video example and let me know if thats what you looking for.
Copy link to clipboard
Copied
Hi Tony,
As a workaround, you can also consider changing the author name in the RHP comment list.
For example: Please see the attached screenshot I have changed the author for the first three comments and it works as a label for the comment if I guess your requirement.
Regards,
Arvind
Copy link to clipboard
Copied
It's possible to do it with a script, but there's an additional complication: It will have to keep a list of all previously used letters, as you probably don't want there to be duplicates... I wrote for you the code that does it. You can execute it from the JS Console or even from a button field:
this.syncAnnotScan();
var annots = this.getAnnots();
if (annots!=null) {
var lettersUsed = [""];
for (var i in annots) {
var annot = annots[i];
if (annot.type=="FreeText") {
var randomLetter = "";
while (lettersUsed.indexOf(randomLetter)!=-1) {
randomLetter = String.fromCharCode(65+Math.floor(Math.random()*26));
}
lettersUsed.push(randomLetter);
annot.contents = randomLetter;
}
}
}
If you want to to work only on the comments in a specific page then change this line:
var annots = this.getAnnots();
To:
var annots = this.getAnnots({nPage: 0});
(the value of nPage is the page number to process, but it's zero-based, so 0 is the first page in the file, 1 the second page, etc.)
Copy link to clipboard
Copied
PS. Make sure there are no more than 26 items, or it will enter an endless loop...

Copy link to clipboard
Copied
Wow, this is great! Thank you for the help. I will try to implement this for my students upcoming quiz and let you know if there are any complications.

