These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Running two Folderscripts with cExec: "ProcessDocument()", is not possible

Gebhard
Registered: Jul 18 2011
Posts: 25
Answered

Hello Forum,
I have the following Problem:
I made three Folderscripts the first splits e. DIN A3 to 2x DINA4
, the second script splits Spreads in the the middle not running on the first and last Page.
The third script changes the first and last Page in a Document.
So every Script is running alone in the Javascript folder everything works fine.
I think theres a Problem with the cExec: "ProcessDocument()" the first and second Script are using both.
The script changes the first and last Page in a Document runs with the first AND the second script I think, because here it another cExec: "PPReversePages();", so Its running.
The scripts No. 1+2 are using the commands from the other scripts and so on.
If I change the loading order in the Javascriptfolder the second folderscript uses the Commands of the first Folderscript.
So whats going wrong. I need all the Scripts running in a MenuItem at the SAME time, so I cannot deactivid also one Script and restart Acrobat.
Please could you help me?
kind regards Gebhard
 
//end of the first script
// add the menu item
app.addMenuItem({
cName: "DoppelSeitenZuEinzelSeitenJS", // this is the internal name used for this menu item
cUser: "DoppelSeiten zu Einzelseiten Trennen", // this is the label that is used to display the menu item
cParent: "Tools", // this is the parent menu. The file menu would use "File"
cExec: "ProcessDocument()",// this is the JavaScript code to execute when this menu item is selected
cEnable: "event.rc = (event.target != null);", // when should this menu item be active?
nPos: 1
});
//end of the second script
app.addMenuItem({
cName: "ersteletzteV2JS", // this is the internal name used for this menu item
cUser: "ErsteundLetzteEinzelnTestDoppelseiten", // this is the label that is used to display the menu item
cParent: "Industrie-+WerbedruckWestphalApogeeTools", // this is the parent menu. The file menu would use "File"
cExec: "ProcessDocument()", // this is the JavaScript code to execute when this menu item is selected
cEnable: "event.rc = (event.target != null);", // when should this menu item be active?
nPos: 2
});
//end of the third script
app.addMenuItem({
cName: "Titel-Rueck-Seiten Vertauschen 8-1 zu 1-8",
cUser: "",
cParent: "Tools",
cExec: "PPReversePages();",
cEnable: "event.rc = (event.target != null);",
nPos: 3
});

My Product Information:
Acrobat Pro 8.2.6, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Accepted Answer
Your description is not very clear (to me, at least), but you can't have two different functions with the same name, if that's what you're trying to do. Simply rename one of them to solve it.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

Gebhard
Registered: Jul 18 2011
Posts: 25
Hello try67,
thank you for your responce:-)
yes I know its a little bit hard to understand also because I have to translate from German to English.
First of all the scripts are having differnt filenames in the Javascriptfolder.
In the cName: I put the Name else as the Filename
In the cUser: There also diffent Names
In the CExec: there is 2 Times "ProcessDocument()", for 2 scripts
In the CExec: for my third script there is cExec: "PPReversePages();",
So in my menuItem (Tools) all is ok with different Names
BUT if I use e.g.cUser: "ErsteundLetzteEinzelnTestDoppelseiten", the usage of the folderscript is the command of the folder script:cUser: cUser: "DoppelSeiten zu Einzelseiten Trennen",
So one folderscript uses the contense from the other Folderscript.
I hope you understand it now a little bit better
kind regards Gebhard
try67
Expert
Registered: Oct 30 2008
Posts: 2398
The file names don't matter. What matters is the name of the function. You can't have two functions with the same name (well, with the same signature, to be exact).

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

Gebhard
Registered: Jul 18 2011
Posts: 25
Hello try67,
what do you mean with:If you agree with the response, be sure to mark the post as a "correct
answer". This will help other community members benefit from your post as
well.
I only have the QuickPost to answer or do you mean "Accept This Asnwer"
Be sorry I´m new here.

You sad I can´t have no Two functions like cExec: "ProcessDocument()", in 2 or more different folderscripts, so are there some other commands for get in running?
The third script uses cExec: "ProcessDocument()", and it runs the both other scripts very well at the same Time
Note I´m a newbie in Adobe JavaScript
kind regards Gebhard
try67
Expert
Registered: Oct 30 2008
Posts: 2398
This text is created by the forum software, not by me. When you feel your question was answered, click that link next to the post that solved it.

You can call your functions whatever you want. ProcessDocument() is just the name of the function, which you use when you call it, but you replace it with any other name (within certain conditions).
For the moment, you can use ProcessDocument1(), ProcessDocument2(), ProcessDocument3(), etc., just to see that it works. Later on you should change the names to something more meaningful.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

Gebhard
Registered: Jul 18 2011
Posts: 25
Hello try67,
ok automatic text creation.
By the Time if have had the same idea like you and I tried This:
ProcessDocument1 = app.trustedFunction(function()
cExec: "ProcessDocument1()"
AND ALL FOLDERSSCRIPTS ARE RUNNING VERY WELL AT THE SAME TIME.
Thank you very very much, you are my hero
So now I will send my next Problem to the forum, perhaps you can help me, too
kind regards
Gebhard