How to search "ActiveDocs" in folder-level script

I am trying to perform a search in an Acrobat folder-level javascript like this:
     function timerCallback() {
          app.beginPriv();
          search.query(searchText, "ActiveDoc");
          app.endPriv();
     app.beginPriv();
     app.openDoc(path_to_my_doc);
     app.endPriv();
     app.setTimeOut("timerCallback()", 5000);
I use the setTimeOut function to make sure that the document has had enough time to open before I start the search.  The problem is that I get this error:
          GeneralError: Operation failed.
          Search.query:24:Folder-level:App:SearchScript.js
          No active document
It seems like I can't "see" active documents from a folder-level script.  Is there any way around this?
Thanks

A folder-level script can be used for two things:
- Execute commands relevant to the application as a whole, NOT dependent of
any specific document (e.g. adding new menu items).
- Create functions which should be available to any document or script that
might need them (e.g. formatting a string in a certain way).
What you're trying to do is neither here nor there. If you want to be able
to search existing documents, you can use a folder-level function, but then
you need to call it from somewhere else, like a menu item or a toolbar
button.

Similar Messages

  • Folder level script? How can I use field value as a pdf filename in save as dialog box

    I read somewhere that if you use a folder level script, you can do things like save a pdf with a specific filename - possibly based on a field name.
    How would one set up a folder level script?
    How do you execute a script from the PDF?
    What code would you use to change the PDF name to the contents of the fFieldName text field?
    Or, is this really just impossible to do?

    The article is interesting.  It suggests you place code like this:
    // Page Replacement Function
    var ReplaceLastPage = app.trustedFunction( function(cPath) {
    app.beginPriv();
    this.replacePages(this.numPages-1, cPath); app.endPriv();
    In the trusted folder.  What is the path of the trusted function(s) that get automatically loaded into Acrobat?
    I assume in the example above, function(cPath) is a function inside of the PDF...

  • File System in Folder Level Script

    Is it possible to access the File System in a Folder Level Script. For example I want to check if a certain file exists in the folder containing active document & load info from that file in a dialog box.
    Thanks in advance

    But I don't want to add any content, bloat to the doc.
    I may just try to write a legit plug-in, since I have a little experiance writing C++ plug-ins for InDesign. But I wold like to just confirm that this functionality does not exist in Acrobat with scripting (due to sandboxing etc).
    Thanks

  • Import Text Data to text fields with folder level script

    I am using Adobe 9 professional and have a folder level javascript to import text into existing fields of a pdf.
    There are multiple fields with multiple rows of data to be imported.
    The folder level script is not working (but there are no errors in the console showing when run)
    I have manually tested opening the text file with the following code in the console and the text file opens and populates the text fields, so the text file must be correct:
    this.importTextData();
    The following code is the folder level script which is not working:
    function mailmergeFunction()
    // Import the first row of data from "Mailmerge.txt"
    this.importTextData("/h/mail merge/Jo Smith's Things/Mailmerge.txt", 0)
    if (typeof cnt == "undefined") cnt = 0;
    this.importTextData("/h/mail merge/Jo Smith's Things/Mailmerge.txt", cnt++ % 4)
    app.trustedFunction(mailmergeFunction);
    app.addToolButton({cName: "Mail merge",cExec: "mailmergeFunction()",cTooltext: "Mail Merge",cEnable: true,nPos: 14});
    If anyone can please provide some assistance, it will be most appreciated thanks.

    Working fine now, changed the location of the file path - could have been something to do with having an apostrophe.
    function mailmergeFunction()
    app.beginPriv()
    // Import the first row of data from "Mailmerge.txt"
    this.importTextData("/h/mail merge/Mailmerge.txt", 0)
    if (typeof cnt == "undefined") cnt = 0;
    this.importTextData("/h/mail merge/Mailmerge.txt", cnt++ % 4)
    app.endPriv()
    app.trustedFunction(mailmergeFunction);
    app.addToolButton({cName: "Mail merge",cExec: "mailmergeFunction()",cTooltext: "Mail Merge",cEnable: true,nPos: 14});
    Thank you for your assistance George, much appreciate your help.

  • Is it possible to install folder level script automatically by any other application ?

    I want to install  folder level javascript through flex application .is it possible to do this or by any other technology.
    1 way to do is to copy file using file stream of that application but as directory for folder level javascript is protected one therefore file operation give i/o error
    any other solution .

    I do not think any Adobe product will allow you to do this for obvious reasons. '
    You can use any installer program the will perform the installation for users if the users decide to allow your request.

  • How to search for known folder and business areain Discoverer Administrator

    Hi ,
    I am new to Discoverer. I am supporting a report developed by someone else. I can see that the report is based on some folder in Discoverer Desktop. I would like to know details behind the folder. I tried logging through Disco Administrator but I could not locate this folder.
    Is there any search capability in Discoverer Admin to locate folder of business area?
    Trupti

    Hi,
    Yes, you can go to the administrator "Tools -> Manage folders" (CTRL+M) and search by the second tab ("By Folder").
    Tamir

  • Folder level javascript.

    how can i use getNthPageWord methode from folder level script.

    function SaveXml() {
    myFun = app.trustedFunction( function()
        app.beginPriv();
    if(this != 'undefined')
        try
           for(i=0;i<70;i++)
              var arr= new Array();
              arr=this.getPageNthWord(2,i);
              console.println(arr);
        app.endPriv();
              catch(e){
              console.println("error");
    }else
         console.println("undefined");
              console.show();
    and i am calling savexml methode in cExec: property of addToolButton.but it is not working please tell where i am making mistake.

  • App level vs. user level scripts error

    I am working on a trusted function to save a LiveCycle (pdf) file based on a field name. Upon research I have read that I am supposed to find the “app” and “user” folder level scripts. To find these scripts I should run the following script in the Acrobat Javascript debugger.
    app.getPath("app", "javascript");
    /C/Program Files/Adobe/Acrobat 10.0/Acrobat/JavaScripts
    app.getPath("user", "javascript");
    GeneralError: Operation failed.
    App.getPath:1:Console undefined:Exec
    2
    This was easy to do, however I received an error on the second script (“user”), and I am not sure if this effects placement of my trusted function. Does this error change where I place my trusted function? I am under the beleif the trusted function goes in the "app" folder lever.
    I have Acrobat X Pro and LiveCycle Designer ES2.
    Links: http://livedocs.adobe.com/acrobat_sdk/9/Acrobat9_HTMLHelp/wwhelp/wwhimpl/common/html/wwhel p.htm?context=Acrobat9_HTMLHelp&file=JS_Dev_Contexts.73.4.html

    See if this helps: http://acrobatninja.blogspot.com/2011/09/acrobat-1011-javascript-changes.html
    In other words, you may have to first create the folder manually. The script will work whether you place is in the app folder or the user folder. The difference is code placed in the app folder will be available to all users, while code placed in the user folder will just be available to that user.

  • Need help with folder level javascript to automate "save button" on a fillable form

    I have been racking my brain for the past 6 hours trying to get a simple save button to work.
    Background: I am using Acrobat Pro 11 to create a save button on a fillable form. My intent is for the end users (my team of 3, whos computers I have access to) to be able to fill out the form, click save, and have the filename appended with date and other info and saved to a local folder on their machine.
    I am attempting to take the default form name i.e. Support Call Log.pdf and have three of the feilds within the form generate a new file name. --> Support Call Log_Brad_121_2015
    End users will fill out the form using adobe viwer X.
    Instead of putting the code that I have tried, modified, and tried again and again. I would like to ask for a fresh start and then see if I can locate my error after. I need to know what to put in my folder level script, line for line.
    I also need to know the correct syntax and format to establish a new file name with the extracted feild data, saved to the same exact file path as the original document.
    Any and all help will be greatly appreciated, I am about to go crazy!!!

    Didn't let me do it, invalid. So, here is what I have now changed my button code to:
    //get field value
    var fv1 = getField("Technician:").value;
    var fv2 = getField("Date Received:").value;
    var fv3 = getField("Unit Number:").value;
    // Split Path into an array so it is easy to work with
    var aMyPath = this.path.split("/");
    // Remove old file name
    aMyPath.pop();
    var NewFileName = "Support Call Log" + "_" + fv1 + "_" + fv2 + "_" + fv3 + ".pdf";
    NewFileName = NewFileName.replace(/[\s\!\?\<\>\'\"\*\/\\\=\?\^\`\{\}\|\~]+/g, "_");
    aMyPath.push(NewFileName);
    //save
    mySaveAs(this,aMyPath.join("/"));
    Im still getting the error dialogue box, and nothing shows in my javascript debugger window when I click the button. Seems to be something goofy with my Folder level script:
    var mySaveAs = app.trustedFunction(
         function(oDoc, cPath, cFlName)
              cPath = cPath.replace(/([^/})$/, "$1/");
              try{
                   oDoc.saveas(cPath + cFlName);
                   catch(e){
                                  app.alert("Error During Save");

  • Adding a watermark from App-Level script

    Hello all,
      I've have a folder-level script that puts a button on the toolbar.  This button calls a function that will insert watermarks and append several PDF documents to the current one.  I've hit a roadblock with this.addWatermarkFromFile(). When the function is called an error is thrown that states the following:
    TypeError: this.addWatermarkFromFile is not a function.
      Pasting a few lines from the function into the console and executing from there works… but it always bombs when executed from a function.
      The documentation states it requires priveleged functionality, which I provided.  My function looks like this:
    function generateReport()
        app.beginPriv();
        this.addWatermarkFromFile(
            cDIPath:     strPathReportFront,
            nSourcePage: 0,
            nStart:      intPageReportFront,
            nEnd:        intPageReportFront
      //CODE CLIPPED FOR SAMPLE PURPOSE
      app.endPriv();
    app.trustedFunction(generateReport);
    Anyone know where I'm going wrong?

    App-level scripts have no knowledge of your document, therefore you can't
    use the "this" object like you do elsewhere.
    You have to pass a reference to the document as a parameter, and then use it
    in your function to call addWatermarkFromFile().

  • Folder level Javascript disabled for a user

    Hi Gurus,
    I created a folder level JS, it works fine on all computer here exept on one. On one computer, the javascript's in the pdf are working but the function called in the folder level script is not executed. (when it works on all the others). The script is in the right folder and the pdf works on other computers. Do I have to enable something in the preferences of acrobat reader 9.1. I checked the settings for JS in edit/preference and they are the same as for the others.
    Thanks for your help guys.

    All the script does it to generate a mail with the mailto function. The Preferences-JavaScript are set as on my pc. So it must be something else. If I email the pdf to my pc, it works, so the pdf form is fine, the script is the same as on my pc.
    --- En date de : Mer 2.9.09, try67 <[email protected]> a écrit :
    De: try67 <[email protected]>
    Objet: Folder level Javascript disabled for a user
    À: "antony clark" <[email protected]>
    Date: Mercredi 2 Septembre 2009, 13h35
    That's why I recommended to make a
    test script, to make sure folder-level
    scripts are working on this machine.
    There's no setting to specifically allow folder-level
    scripts. If they are
    properly placed and JS is enabled then they will launch.
    However, if your script inserts menu items you should make
    sure that this
    option is checked under Preferences-JavaScript, the second
    check-box from
    the top. You should probably check all 4 boxes, just in
    case.
    >

  • How do I use search/find to search for a folder name

    I can successfully use Spotlight and Search in Finder and Mail to find files and emails based on their titles and contents, but how to I use the search functions to find a FOLDER by its name, that I have somehere in my nests of folders - so I can then look inside that folder for what I am looking for.
    The search results never seem to show up any folder names?

    I do have several levels of nested email folders and several hundred folders created over the years. So I was hoping to be able to search for a folder's name, and be taken to it to see it and all of its contents.
    The best I seem to be able to do is search for a word that I hope I remember is in one of the emails in that folder, and then find that email in the search results list - but that list still doesn't tell me where the folder in the nested heirarchy that is my mailbox

  • Searching for a folder in document library doesn't work properly if the folder is at the root level.

    Hi,
    I have a folder named FS0 on my sharepoint 2013 site. The folder is the first level folder under
    Default Document library (Shared Documents). When I search for FS0 on the sharepoint site, the search result give a link to home.aspx and not the folder. If I search for any folder that is a second level folder in the library, I get a search result that takes
    me inside the folder on clicking it. In my case, I search for a folder named FS1 which directly under FS0. The search result takes me inside FS1 in this case. How can I make the search result display proper links for root level folders also?<o:p></o:p>
    Thanks
    Pranava

    Hi Pranava,
    I couldn't reproduce this issue, when I create root folder FS0 in "Shared Documents" and start a full crawl, I click the FS0 link from search results page, it will open the FS0 folder as well as folder under FS0.
    Please right-click the FS0 name hyperlink (e.g. mine is http://sp/Shared%20Documents/FS0) and paste in IE browser see if it could be accessed successfully.
    Also test if other Shared Documents have this issue in other site collection or web applications, if not, run a full crawl may do a trick (please reset search index if only full crawl still doesn't work).
    Thanks
    Daniel Yang
    TechNet Community Support

  • Acrobat X Standard User: How can I view PDF metadata from a folder level?

    Hello All,
    This is my first post to this community. I would not be surprised if the answer to my question can be found in a simple search or tutorial. However, I assure you that I have been searching, clicking, reading and even attempting to install new software all morning and have only succeeded in further confusing myself.
    I'm running Adobe Acrobat X Standard on a Windows 7 machine. My job includes the management of legal documents of conveyance. All conveyance instruments have a set of unique identifiers such as the county where the deed was filed, the book and page where it is filed, the type of instrument, and the date it was filed. Historically I have tried to jam all of this information and more into the file name of a pdf. For example: "105_Bk109-Pg188_Assignment_05251950" is the name of a file that I have open right now that indicates an Assignment filed in Crockett County, Texas (code 105) at Book 109, Page 188 and recorded on May 25, 1950. I typically work in folders that contain around a hundred similar documents with all of the fields I have described varying. My objective is to begin moving this information into the metadata or properties of the individual PDFs AND then be able to view those fields in Windows Explorer from the folder level. As I understand it, this is not possible. When I began searching for an alternative solution, I found several references to Adobe Bridge and attempted to install it. The installation failed, but more importantly I am not interested in becoming a CC user as I don't feel like it is necessary for what I am trying to accomplish. I'm not working with HD photos or video.
    So my question is this: Is there a way (that doesn't involve purchasing and learning Adobe Bridge) that I can modify the attributes/metadata/properties of a pdf, and then see the modifications in a folder viewer without opening the pdf? Thanks in advance for your help.

    Thanks for responding. I suspected that my understanding of metadata was incomplete or inaccurate. As I understand it, the metadata for any given pdf can be found by first opening the pdf; clicking File -> Properties, which opens a dialog box titled "Document Properties". The first tab in the dialog box is "Description" and includes the fields File, Title, Author, Subject, and Keywords. The values for these fields are what I'm referring to as metadata. Additionally, from the Document Properties dialog box, clicking on the "Custom" tab allows you to create custom properties and values, which I also considered to be metadata. I have manipulated these fields for a certain pdf as shown in the two screenshots below:
    After making this changes, I saved the pdf and closed it. I then navigated to the folder where the pdf is stored using Windows Explorer. As you can in the following screen shot of WE, that the pdf I have made the changes to is the first in the list. The Windows Explorer columns include: Title, Pages, Author, and Subjects, but their values are all blank and fail to show what I have assigned them in the PDF properties (or what I thought was metadata). As for my custom fields, Windows does not give me any kind of option to display those. Windows inability to display something as simple as the number of pages in the PDF is completely baffling to me.
    My objective is to be able to modify the standard document properties of a PDF with usable information, those being Title , Author, Subject, and Keywords. I would also like to be able to create the custom properties with additional useful information. I would then like to be able to use a file manager, to view the contents of a folder full of pdfs, similar to the screenshot above, and see the properties and custom field values that i have assigned to the pdfs in columns of the list of pdfs. Windows Explorer is the only file manager I have ever used. It's possible that the solution to my problem could be as simple as changing file managers. It may be that what I'm after is not possible at. Any suggestions would be greatly appreciated. Thanks.

  • How to search a folder or a repository without using index service

    Hi,
                   I want to get a count of all feedbacks (stored under /collaboration/feedback) created on a particular date. Since there are many sub folders, I am not able to use ICollection.
    How can I read a folder or a repository without using IndexService.
    Thanks in advance
    Vidya

    Hi SRIVIDHYA RAGHUNATH
    I dont understand how can't use ICollection. What you want can be do it coding. The TREX and the Index search it works just to search on content.
    I think what you have to do if Iterate on a IResource Object  and the see if it is a file or a folder and keepp iterating, then when is a file, convert to an objects where you can get the feedback and count it.
    Hope its help
    Bye.

Maybe you are looking for