Batch Sequence with JavaScript

Hi Guys,
I have a batch sequence that won't save the original files. I'm getting a message "The file may be read-only, or another user may have it open. Please save the document with a different name or in a different folder."
However, another batch sequence that runs on the same file saves it fine so I know that noone else has it open and that and I know I have rights to that folder.
The sequence that won't save the file sets the open optons and has JavaScript in it that collapses the many bookmarks.
Is there something about having JavaScript in the batch sequence that's not allowing this to save?
Many thanks,
Ken

You rock!! That made it all go.
I was mistaken befeore thought, its the JavaScript Editor that's coming up on the screen when I run the sequence. I have to close it with the OK button before the sequence finishes. It comes up for each file I process. Trouble is I can't imagine what I've changed that would cause that to start happening.
The code looks like this:
//Collapses all bookmarks and shows the bookmarks panel
function BookmarksCollapse(bkm, nLevel)
var s = "";
for (var i = 0; i < nLevel; i++);
bkm.open=0;
if (bkm.children != null)
    for (var i = 0; i < bkm.children.length; i++)
        BookmarksCollapse(bkm.children[i], nLevel + 1);
BookmarksCollapse(this.bookmarkRoot, 0);
//app.execMenuItem("ShowHideNavigationPane");
//app.execMenuItem("ShowHideBookmarks");
this.saveAs(this.path);

Similar Messages

  • Batch sequence memory leak?

    I wrote a JavaScript batch sequence and ran it in Acrobat 9 Pro on a folder of PDFs. Acrobats memory use steadily increased until it hit 1.1 GB. Then an Acrobat dialog said no files were processed, the memory use dropped back to normal and the CPU usage dropped to zero. So it looks like the problem includes a memory leak. As a test, I replaced my batch sequence with a simple, one-line test:
    var r = test;
    It has the same behavior. Any ideas?

    thanks for your reply.
    i have gone through those APIs you have mentioned and understood that we can run any custom command or existing global command using those APIs.
    my requirement is to launch the sequence file created. is there any way to directly launch the sequence file or else do i need to process the sequence file to know the command and parameters?
    if i need to process the sequence file, it will be always "Recognize text using OCR" and parameters may differ. for this, what is the command i need to execute?
    i am new to this environment, please dont mistake me.
    thanks in advance.
    regards

  • Javascript in batch sequence stopped working

    The following javascript used in a batch sequence is causing Acrobat to stop working. It was working fine, this problem has happened sometime in the last 2 weeks. This has affected all of our PCs regardless of Acrobat update version. We are running Acrobat 8 (8.15, 8.17, 8.21, 8.25). The only update common to all PCs is Windows Update.
    /* Extract single pages to c:/Adobe */
    // Regular expression used to acquire the base name of file
    var re = /\.pdf$/i;
    // filename is the base name of the file Acrobat is working on
    var filename = this.documentFileName.replace(re,"");
    try {for (var i = 0; i < this.numPages; i++)
    this.extractPages({
    nStart: i,
    cPath: "C:\\Adobe\\"+filename+"_" + i +".pdf"
    } catch (e) { console.println("Aborted: " + e) }
    Any Clues?

    Thanks for the speedy response. I tried this and the problem is still there.
    I did some further testing and the original script, and the new one modified to include your correction, both work if the PDF only has one page.
    With more than one page Acrobat 'has stopped working'

  • Batch sequence to remove document JavaScript

    Does anyone know of a batch sequence that can remove the document JavaScript from a group of Acrobat 9 Pro PDFs?

    If the doc-level Javascript names are not known in advance, then the only way I found to remove all of the Javascripts is with doc.extractPages(), which will create a new doc object, and then newDoc.saveAs() followed by newDoc.closeDoc().
    I don't do this in a batch sequence but in a .Net app, so I'm not entirely sure how you would write this in a batch sequence.  Here's a code snippet that shows the basic logic:
                    object AcroJS = AcroPDDoc.GetJSObject();
                    string PdfFullPath = "C:\\filename.pdf";
                    Type T = AcroJS.GetType();
                    object newDoc = T.InvokeMember("extractPages", InvokeMethodFlags, null, AcroJS, null);
                    AcroJS = null;
                    AcroPDDoc.Close();
                    object[] saveAsDataParam = { PdfFullPath };
                    T.InvokeMember("saveAs", InvokeMethodFlags, null, newDoc, saveAsDataParam);
                    T.InvokeMember("closeDoc", InvokeMethodFlags, null, newDoc, null);
                    newDoc = null;
                    AcroPDDoc.Open(PdfFullPath);
                    AcroJS = AcroPDDoc.GetJSObject();
    This can also be used to create a new doc GUID.
    Bill

  • Javascript in batch sequence

    I've done some Acrobat scripting but mostly through VB and I'm able to write what I need but I want to have it as part of my operator's Acrobat instead of the of separate program. That said, I want to write a Java script that I can include in batch sequence.
    I need to add a page to the start of a document and I want to have that page be nubered "a" without disturbing the numbering else where in the file. By simply adding the page at the start with the batch sequence it adopts the numbering of the first page. So if the first page is numbered as "i" then the new inserted page gets numbered "i" and the rest of the numbering changes, what was i becomes ii, what was ii becomes iii, and so on. I'm able to script this in VB by adding the page at the end, renumber them using the SetPageLabels from a Javascript object, then moving the page to the beginning.
    Is there any documentation on using Javascript within a batch sequence?
    Thanks,
    Ken

    Well, hacking along here working in the console pasting my code in.
    The script adds a single page from another Acrobat file to the start of the open PDF. I need the page that goes in at the front to be numbered "a" and NOT effect numbering in the rest of the pages. Some files work fine, other files not so much, like the Javascript API reference PDF as well as other PDFs we've created here form InDesign.
    The script inserts a page at the end of the PDF and numbers that page "a" then moves it to the start of the document. The problem occurs when the page is moved to the start, it changes the number of all the other pages to follow page "a" which is a bit of a silly thing to have to send my clients. I decided to compromise and if the first page (before I insert the anything) was numeric I would simply try changing things to start page 1 after my inserted page "a".
    My code looks like this:
    var NumPages = this.numPages
    var PgLabel = this.getPageLabel(0)
    this.insertPages(NumPages-1, "/F/TNTSTUFF/Disclaimers/HUP_ProofNotice.pdf")
    this.setPageLabels(NumPages,["a", "", 1]);
    this.movePage(NumPages, -1)
    if (PgLabel.match("((-|\\+)?[0-9]+(\\.[0-9]+)?)+")) {  
            this.setPageLabels(1, ["1", "", 1]);  
    However, the setPageLabels command is causing this error:
    RaiseError: The base pages object is missing or invalid.
    Doc.setPageLabels:7:Console undefined:Exec
    ===> The base pages object is missing or invalid.
    I'm not sure it is relavent, but on the files that work the numbering in Acrobat looks like this with the parentheical numbers:
    Files that DON'T work look like this, with NO parenthetical:
    Even if I manually renumber the pages starting with 2 to make the numbering in the 2nd file look more like the numbering in the first file, I still get the error.
    Is there a way I can overcome this with Java code and what the heck is it?
    Thanks again to anyone who can help.
    Best,
    Ken

  • Batch Export with Match Sequence Settings

    How can I select a bunch of sequences in Premiere Pro and export them with Media Encoder as "Match Sequence" Settings? When I have multiple selections  that option is not available. Also, is there an option to either use or ignore the in/out when batching sequences?

    Hi TBC,
    I think you're on the wrong track with the export. Camera codecs are for acquisition. There are many different options for Export, and they do not need to be, nor should they be in most cases, the same thing you started with. The general consensus I see on these forums is to avoid "Match Sequence Settings" most of the time.
    Please let us know the destination, and we can then suggest options. For instance, if you simply want to create a "Master" copy of the completed work, on a Mac you might want ProRes, while on the PC you could look at the Lagarith Lossless codec, or the Avid DNxHDcodec (both need to be installed to use them). If going to the web, there's a ton of options, but a YouTube or Vimeo preset is a good place to start, found under "H.264" format.
    Thanks
    Jeff Pulera
    Safe Harbor Computers

  • Using Batch sequences in Acro Xi Mac

    Hello Everyone:
       I have a couple of scripts heavily in use that required they be built as part of a batch sequence, as they deal with multiple PDFs.. 
       These scripts are fairly large (one about 1000 lines, one in excess of 3000 lines) with the potential to get even larger. 
       Additionally, several requests for scripts are rolling down the line that look to be of similar or greater size. 
       The Adobe Acrobat editor is just not a good fit for building such large scripts.  I have switched the editor to UltraEdit, which is a much more capable editor.
       However, the problem comes when a new version is finished and I need to install it in other computers.  It seems that the only way to do this is to copy the script into a text file, take that text file to the next computer in line, open it up in a text editor, copy the script to the pasteboard, open up the batch sequence, open up the execute Javascript command, open up the script and copy the new code on top of the old code.  If this needs to be done on multiple machines, it becomes, ahem, tedious.
       Is there any way to save the script to a XXX.js file and just copy the new js file over the old XXX.js file?  I've looked at addscript but was not reassured by its examples in the Batch Sequence PDF that it could do the job I need it to do..

    Gilad:
       Thank you.  Though I would have preferred something a bit simpler, the import/export method you suggest is indeed simpler than the process I was using.  It still has its warts and wrinkles, but with practice I am sure I can find ways to minimize those minor irritants.
    R,
    John

  • Setting User Preferences With Javascript In Acrobat X

    Hi All,
    Is there a way thru Javascript to programatically set a value in the User Preferences?
    I am trying to create a batch sequence that exports PDFs to HTMLs. In the Acrobat X preferences, there is a conversion option that sets the option of "Run OCR If Needed" to true or false.
    Edit --> Preferences --> Convert From PDF --> HTML --> Run OCR if needed (True|False)
    Depending on conditions, I need to programtically set the value of this preference during the batch sequence before I export the document to HTML. Is this possible? Any help would be greatly appreaciated.
    Thank you,
    Teri

    There are very few user preferences that can be controlled with JavaScript, and this isn't one of them.

  • Batch Sequence Problem

    I am using Acrobat 9.4. I have a JavaScript that runs a batch sequence to create pop-up tool tips for certain words and phrases. The sequence works properly on most PDF files. I have a problem that on one basic PDF file the batch sequence properly creates the pop-ups but in the process converts the file to a PDF Form. The JavaScript author believes the problem must be that Acrobat adds Form Fields to the basic PDF file during the sequence operation and then thinks the file is a PDF Form. Is there any way to stop this from happening?

    Technically, a document with just a single button is a form. If you mean that the Forms document message bar appears, then that's a known problem. There is a user preference that controls whether the message bar is shown, but it's up to the user to set it.
    Without seeing the code, it seems apparent that it does add some type of form fields to the document to implement the tooltips and that is indeed the reason you're seeing the mesage bar.

  • Batch Sequence Page Scaling

    I have a few hundred PDFs that I need to change the page scaling on, hopefully using a batch sequence or another automated method. I know I can change a single PDF in Acrobat by going to the Advanced tab on the Document Properties and setting the Page Scaling to Default, but I do not want to change hundreds of PDFs manually. I have also tried creating a PDF package and changing the document properties, but it only affects a single PDF in the package.
    I am really looking for a JavaScript code to use in a batch sequence that will change the page scaling to either "fit to printable area" or "shrink to printable area" and save the document with that setting so I can distribute them to others with the page scaling already set and ready from them to print.

    I have been able to use code in Acrobat 6 Standard (Advanced - JavaScript - Document Actions - Document Will Print) to change the page scaling on documents, but it only saves the action in Acrobat 6 and does not save the print setting when the PDF is opened in Reader or Acrobat 8. I tried copying the full acro_script from Acrobat 6 to 8 using a batch sequence in 8, but it does not work.
    Code used in Acrobat 6:
    var pp = this.getPrintParams;
    pp.Handling = pp.constants.handling.shrink;
    Is there a way to convert this code to work in 8? And is there somewhere else in Acrobat 8 (I have Pro) to enter JavaScript besides in a batch sequence?

  • Run batch process by javascript

    Hi,
    I am created one Batch Sequences in the name of “Auto Update” which displayed below.
    Now I want to run this Batch Sequences "Auto Update" just by calling  batch name as "Auto Update" in javascript code.
    Or
    By using OLE Automation C#.
    So please advice me how can I do this?
    Regard
    Thirusanguraja Venkatesan

    Hi Thank you Gilad and Dave
    I am try to do set the Document Properties - > Initial View after creating PDF file from Post Script File.
    Input PDF Initial View:
    After my setting the Initial of the PDF file will as below:(What I am trying to do)
    This only I am trying to do by automation.
    Note:
    I am saw one discussion in this forum as my request in the below link
    http://forums.adobe.com/message/2306817
    From this discussion I am got one point that is Document open options (DOCVIEW) setting in Post Script file.
    With the help of pdfmark Reference (Adobe SDK) and above discussion I am tried to set DOCVIEW in post scrip
    Post Script:
    [ /PageMode /UseOutlines /Page 1 /View [/Fit] /DOCVIEW pdfmark
    The above script will set
    Document Properties - > Intial View
    Document Option
    Show: Bookmarks Panel and Page
    Page Layout: Default
    Magnification: Fit Page
    Window Options
    Show : File Name
    But my expectation is as shown below,
    Document Properties - > Intial View
    Document Option
    Show: Bookmarks Panel and Page
    Page Layout: Continuous
    Magnification: Fit Width
    Window Options
    Show : Document Title
    So please give me advice.
    What is correct way to meet my requirement by automation.
    If you can please provide me PSOT SCRIPT coding to set those setting in post script file it self, it is better to me.

  • Batch Test With Parallel TestSequen​ces

    Need a little assistance programming a TestStand batch sequence also containing test sequences which must run in parallel with synchronization.
    I have a panel containing multiple UUT. Each UUT consist of 2 parts. The test may be divided into 4 groups:
    1: Common start up test and programming
    2a: Specific test and calibration on part 1
    2b: Specific test and calibration on part 2
    3: Common test and calibration of complete UUT
    My application runs with the batch model (which I normally use and is familiar with), but must in this case also use parallel testing for each UUT. I need to be able to synchronize the parallel test sequences like they where running in normal batchmodel. I also need at some point to synchronize the to parallel sequences for all UUTs.
    I’ve succeeded doing that with the enclosed sequence, but I am not sure it’s the right solution. Would like some comments.
    Attachments:
    BatchTestSeqWithParallelTestSequences.seq ‏72 KB
    BatchTest With ParallelTestSequences.jpg ‏82 KB

    A couple things regarding your issue:
    You should be fine with just the Parallel or Batch model.  Personally, if you don't need to switch out UUTs dynamically then I would go with the Batch model.  Why?  Because then you can use synchronized sections.  Synchronized sections give you the ability to run a particular section of your sequence file (i.e. several or a single step) in Parallel, Sequentially or One Socket Only.  With the parallel model you can kind of get there by using Locks and Queues.  Look in the TestStand Reference Manual under Appendices A and B for more info on the Batch model and synchronized sections.  To access the TestStand Reference Manual go to Start>>All Programs>>National Instruments>><TestStand>>>Documentation>>Manuals.
    Regarding your VIs and how they would handle each socket.  I don't think it's a good idea to make a different VI for each socket.  Just have some sort of case inside the VI that if 3 comes in the set the right wires to populate your switching or COM functions.  For instance: Lets say that Socket 1 is executing and comes to the step to call the com_port.vi.  One of the parameters for that VI could be the socket number.  Inside the VI you set the desired com port to read or write based on that parameter.  You can set the parameter in TestStand by using RunState.TestSockets.MyIndex (that will return the socket you are on). 
    In fact you wouldn't even need the logic in your com_port.vi.  I would assume that one of the parameters to that VI would be a VISA session to your COM ports.  In TestStand you use the LabVIEWIOControl datatype which has property of DeviceName.  If you set that parameter to be '"COM" + Str(RunState.TestSockets.MyIndex)' then you will achieve the same thing as passing COM3 if you were in TestSocket 3.
    Anyhow, this is just a few ideas for you.  Obviously you have to implement what makes sense.
    Hope this helps,
    jigg
    CTA, CLA
    teststandhelp.com
    ~Will work for kudos and/or BBQ~

  • Additional Batch Sequences for Acrobat 9 Pro

    In my downloaded version of Acrobat 9 Pro, there are only a few batch sequences.
    The last time I bought Acrobat on a CD was version 5, and many additional batch sequences came on the CD.  By "additional" I mean that they were not automatically installed when Acrobat was installed, but they could be installed manually.  One could simply copy the additional batch sequences from the CD into the Acrobat installation, after which all of them would be available via the Acrobat interface.
    Is the same true with a CD version of Acrobat 9 -- i.e., has the Acrobat 9 CD additional batch sequences that can be copied into the Acrobat installation?
    If so, is it possible for a user of the downloaded version of Acrobat 9 Pro to obtain those additional batch sequences?
    On my Acrobat 5 CD, the additional batch sequences were in --
    (optical drive letter):\Batch\Sequences
    In my Acrobat 9 Pro installation (under Windows XP Pro), one would copy additional batch sequences to --
    C:\Program Files\Adobe\Acrobat 9.0\Acrobat\Sequences\ENU
    In both Acrobat 5 and Acrobat 9, it appears that the names of all batch sequence files end in the extension .sequ
    I would particularly like to obtain the "List all Bookmarks" batch sequence.  I copied that sequence from the Acrobat 5 CD to the Acrobat 9 installation, and it "sort-of" works.  The main problem is that its list of bookmarks is limited to one page, regardless of the number of bookmarks.  Any bookmarks that would be listed on pages 2, 3 etc. of the list of bookmarks are not listed at all.
    Is it possible for me to download or otherwise obtain the Acrobat 9 "List all Bookmarks" batch sequence?
    Thanks!

    Thank you, try67, for that insight.
    Here is the "List all Bookmarks" batch sequence from the Acrobat 5 CD:
    /* List all Bookmarks */
    /* Recursively work through bookmark tree  */
    function PrintBookmarks(bm, nLevel)
        if (nLevel != 0) { // don't print the root
            bmReport.absIndent=bmTab*(nLevel-1);
            bmReport.writeText(util.printf("%s",bm.name));
        if (bm.children != null)
              for (var i = 0; i < bm.children.length; i++)
                PrintBookmarks(bm.children[i], nLevel + 1);                          
    bmTab = 20;
    bmReport = new Report();
    bmReport.size = 2;
    bmReport.writeText(this.title);
    bmReport.writeText(" ");
    bmReport.size = 1.5;
    bmReport.writeText("Listing of Bookmarks");
    bmReport.writeText(" ");
    bmReport.size = 1;
    PrintBookmarks(this.bookmarkRoot, 0);
    global.bmRep = bmReport;  // make global
    global.wrtDoc = app.setInterval(
        'try {'
        +'       reportDoc = global.bmRep.open("Listing of Bookmarks");'
        +'       console.println("Executed Report.open");'
        +'       app.clearInterval(global.wrtDoc);'
        +'       delete global.wrtDoc;'
        +'       console.println("Executed App.clearInterval");'
        +'       reportDoc.info.title = "Bookmark Listings";'
        +'       reportDoc.info.Author = "A. C. Robat";'
        +'} catch (e) {console.println("Waiting...: " + e);}'
        , 100);
    I am not a programmer, and so would be grateful if you would advise how that sequence should be modified to incorporate your suggestion.
    Thanks!

  • Using "automating batch sequence" query

    Hi,
    I am trying to add text content to an area of the page in a group of pdf files without having to open each file. I am not replacing existing text. After checking,  I could not find a batch sequence to do this in Acrobat v7.1. Could this feature be available in Acrobat v9.?  and/or would I have to use the (acrobat v7.SDK) to create a script and plug in to do this? or if not, in Acrobat v.9, use the SDK to create the script and plugin?  I would appreciate any information.
    thanks,
    je112

    It's not possible to just add running text to a PDF using a batch process or a script. What you can do is insert a field with text and then flatten it.
    This will have a result similar to adding text to the document, but it will not be an integral part of the running text (ie the text you add will not "push" the rest of the text forward).

  • Batch sequence to 'flatten' xfa form to static non-interactive AcroForm

    Hi,
    I'm looking for a way to flatten a bunch of xfa forms in a batch sequence. The result being the exact same as printing to pdf.
    I believe I use to just add optimizer settings in the sequence editor and that would do the trick. But now I'm getting an error saying optimization settings cannot be applied to an xfa form.
    Any help would be much appreciated.
    Thanks.
    Kyle

    Actually George I found a solution. They are dynamic xfa forms. I realized that the pdf printer settings has an option to suppress the save as dialog and default the output flat pdfs to a location of my choosing. I just set the pdf printer as my default printer and run a batch sequence to print the dynamic pdfs.
    It requires a decent system with lots of memory since an instance of Acrobat is opened for every pdf processed but it does the trick!
    I appreciate your response.
    Kyle

Maybe you are looking for

  • Download XML Publisher report through URL

    Hi Gurus, I need to download pdf that which is generated using data template(.xml) and Layout template(.rtf) from XML Publisher through URL by passing required parameter. Could anyone please help me on this. This is one of our client requirement. Its

  • I can't sign OUT of iCloud on my new phone. I have a new email address...

    We got new phones today. My wife and I had the same iCloud account and the friends at Verizon told us to each have one. So I set up my own account. We went to set up our phones and it keeps asking me for the OLD password (2 email addresses ago) and t

  • ANCHOR LINKS NOT WORKING!...STILL :(

    Well another Muse update has come out and to much disappointment the same issues still exist with anchors. They do not work in Safari 6 running Mountain Lion, or iOS. Anchors in iOS have been an issue since the Muse Beta days... so I am now starting

  • PO# field in FAGLL03

    PO and Vendor field can be populated on FAGLL03 through the OBVU transaction(special fields). This is for all documents created post the customization change Does anyone know how can the historic PO fields be updated on FAGLL03?

  • Error starting J2EE

    I have currently installed J2EE 1.3 but have problems starting it... Whent I type j2ee -verbose in the command prompt I receive the following message:- Out of environment space Out of environment space Syntax error Syntax error Syntax error Exception