Skip to main content
Inspiring
March 11, 2021
Question

It takes too long time from clicking OK button on alert message box to the alert closed.

  • March 11, 2021
  • 1 reply
  • 795 views

I have a javascript to search text on PDF and then highlight it.

When it works over, an alert message box will be shown that it is over.
My script works well on Acrobat XI, but on Acrobat DC, when clicking the OK button on the alert message box,
Acrobat DC will be falled into a state of not responding,
and this state lasts for about 10 minutes and then the alert message box is closed.
In my script code, no code is executed after the app.alert().

 

The 10 minutes is too long, what should I check about this?
My PDF file is created from some html files using "Get entire site" setting,

and there are some kangxi radicals in it.
Could these character be affecting the problem?

 

Thanks.

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
March 11, 2021

10 minutes is too long? 10 seconds is too long! The alert should close the moment you press the button...

Can you share the file, or code, with us?

erieru103Author
Inspiring
March 12, 2021

Sorry I can't show you the full code and create the sample file right away.
I wrote a simple code that only output the text on each page.
It took about 2 minutes.

//----------------------------------------------------
app.addMenuItem({ cName: "Test", cParent: "Edit",
	cExec: "process();",
	cEnable: "event.rc = (event.target != null);"
});

trustedActiveDocs = app.trustedFunction(function ()
                                        {
                                            app.beginPriv();
                                            var d = app.activeDocs;
                                            app.endPriv();
                                            return d;
                                        }
                                       )

function process()
{
	var d, i;
	
	d = trustedActiveDocs() ;
	if(d.length < 1)
	{
		return 0;
	}

	for (i=0; i < d.length; i++)
	{
		GetPageTextOnEachDoc(d[i]);
	}
	
	app.alert({nIcon:3, cTitle:"TEST", cMsg:"Done"});
}

//----------------------------------------------------
function GetPageTextOnEachDoc(acd)
{
	var PageNum, WdCnt;
	var i, j;
	var wd;
	var pageText;
	

	console.println("--------------------------------------");
	console.println("File Name = " + acd.documentFileName);
	console.println("--------------------------------------");

	PageNum = acd.numPages;
	for (i=0; i<PageNum; i++)
	{
		WdCnt = acd.getPageNumWords(i);
		pageText = "";
		
		if (WdCnt > 0)
		{
		    for (j=0; j<WdCnt; j++)
		    {
			    wd = acd.getPageNthWord(i, j, false);    			
			    pageText = pageText.concat(wd);
		    }
			console.println("Page " + i + " text = " + pageText);
			console.println("--------------------------------------");
		}	
	}		
}

I am sorry that there was a mistake in what I wrote.
The followings are what I have known now.

 

1. I have written that it takes 10 minutes clicking OK button on alert message box to the alert closed.
But, after the alert message box is shown, and after a short time,
Acribat falls into the state of not responding without clicking the OK button.
When the state of not responding is over, if I click the OK button, the alert message box closed soon.

 

2. The html file I used is a html file that there are 60 links to other html files in it.
This phenomenon can only be seen with the PDF file created from the html file using "Get entire site" setting at the moment.
If not using the "Get entire site" setting, the script works OK.

 

3. If I write the code in the console of javascript debugger and execute from the console, it works OK.

 

4. Kangxi radicals were irrelevant. This phenomenon occurs without this.

 

So... I think useing the "Get entire site" setting to create PDF is affecting.
Acrobat DC are doing something in the background??

erieru103Author
Inspiring
March 12, 2021

If I delete the links from the html file and make only 3 or 4 links in it, the script works OK.