Judge whether the current document is active player?

Hello

Is there an API could judge whether the current document is active player?

Thank you!

PDPerms bits are documented in both the SDK documentation and the actual headers.

Tags: Acrobat

Similar Questions

  • Is it possible to get the name of the folder that contains the current document?

    Hi all!


    I know how to get the name of the active document


    app.activeDocument.name;


    but I was wondering if you could also get the name of the folder that contains the current document. Not sure if this is possible or not, so I thought I'd ask, if so it save me a lot of time.


    Thanks in advance!

    Hi djbgraphicdesign,

    does this work for you?

    if (app.activeDocument.saved){
    alert(app.activeDocument.path.name);
    }
    

    Have fun

  • Reload the current document?

    Running DW8, generate an insertObject() extension; 2 problems that appear to load the current document.

    Problem 1:
    DW keeps the current document as he was instructed, even after make a change to it and record; I have to reload the document (manually) so he could be treated appropriately with extension.

    Here's what happens:
    I have a JavaScript function that reads content of the meta tag in the active document. Between function calls, I change the content of the meta tag and save the file. Done DW always refers to the old content.

    Problem 2:
    The insertObject() function does not run if the document has no recorded or saved my changes.

    Here's what happens:
    My insertObject() function inserts a line of text in the active document. It will run first on the document, when the document has not been changed. Subsequently, it will fail, even if the changes have been saved.

    I tried calling dw.releaseDocument (dom); at the end of each function explicitly, nothing helps.

    When I run the code example for the reference of the Dreamweaver extension, it works as expected.

    Any ideas?

    If you change the metatag in codeview and don't click Design mode before you hit your extension, then the DOM, you get from DW.getDocumentDOM () is out of sync with the code view. We don't automatically sync it because some items insert can dump just a string mode code (or they can use dom.source which is updated). In this case, I think you just need to add:
    dom.synchronizeDocument ();

    Also, I saw in our code that we do not have a releaseDocument so you call were not bad no matter what, but they were not done probably not much either. You should call if you get a lot of french overseas departments and you want to give us a chance to free them, but we do on idle when even if you do not have to worry.

    Hope that helps,
    Chris
    Adobe Dreamweaver engineering

  • use Image catalog script for the current document

    Is it possible to use the script to image catalogue for the current document in which we work instead of leaving the mark of script a new document fees for placed images?

    use,

    //ImageCatalog.jsx
    //An InDesign CS6 JavaScript
    /*
    @@@BUILDINFO@@@ "ImageCatalog.jsx" 3.0.0 15 December 2009
    */
    //Creates an image catalog from the graphic files in a selected folder.
    //Each file can be labeled with the file name, and the labels are placed on
    //a separate layer and formatted using a paragraph style ("label") you can
    //modify to change the appearance of the labels.
    //
    //For more information on InDesign scripting, go to http://www.adobe.com/products/indesign/scripting/index.html
    //Or visit the InDesign Scripting User to User forum at http://www.adobeforums.com .
    //
    //The myExtensions array contains the extensions of the graphic file types you want
    //to include in the catalog. You can remove extensions from or add extensions to this list.
    //myExtensions is a global. Mac OS users should also look at the file types in the myFileFilter function.
    main();
    function main(){
      var myFilteredFiles;
      //Make certain that user interaction (display of dialogs, etc.) is turned on.
      app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
      myExtensions = [".jpg", ".jpeg", ".eps", ".ps", ".pdf", ".tif", ".tiff", ".gif", ".psd", ".ai"]
      //Display the folder browser.
      var myFolder = Folder.selectDialog("Select the folder containing the images", "");
      //Get the path to the folder containing the files you want to place.
      if(myFolder != null){
      if(File.fs == "Macintosh"){
      myFilteredFiles = myMacOSFileFilter(myFolder);
      }
      else{
      myFilteredFiles = myWinOSFileFilter(myFolder);
      }
      if(myFilteredFiles.length != 0){
      myDisplayDialog(myFilteredFiles, myFolder);
      alert("Done!");
      }
      }
    }
    //Windows version of the file filter.
    function myWinOSFileFilter(myFolder){
      var myFiles = new Array;
      var myFilteredFiles = new Array;
      for(myExtensionCounter = 0; myExtensionCounter < myExtensions.length; myExtensionCounter++){
      myExtension = myExtensions[myExtensionCounter];
            myFiles = myFolder.getFiles("*"+ myExtension);
      if(myFiles.length != 0){
      for(var myFileCounter = 0; myFileCounter < myFiles.length; myFileCounter++){
      myFilteredFiles.push(myFiles[myFileCounter]);
      }
      }
      }
      return myFilteredFiles;
    }
    function myMacOSFileFilter(myFolder){
      var myFilteredFiles = myFolder.getFiles(myFileFilter);
      return myFilteredFiles;
    }
    //Mac OS version of file filter
    //Have to provide a separate version because not all Mac OS users use file extensions
    //and/or file extensions are sometimes hidden by the Finder.
    function myFileFilter(myFile){
      var myFileType = myFile.type;
      switch (myFileType){
      case "JPEG":
      case "EPSF":
      case "PICT":
      case "TIFF":
      case "8BPS":
      case "GIFf":
      case "PDF ":
      return true;
      break;
      default:
      for(var myCounter = 0; myCounter-1){
      return true;
      break;
      }
      }
      }
      return false;
    }
    function myDisplayDialog(myFiles, myFolder){
      var myLabelWidth = 112;
      var myStyleNames = myGetParagraphStyleNames(app);
      var myLayerNames = ["Layer 1", "Labels"];
      var myDialog = app.dialogs.add({name:"Image Catalog"});
      with(myDialog.dialogColumns.add()){
      with(dialogRows.add()){
      staticTexts.add({staticLabel:"Information:"});
      }
      with(borderPanels.add()){
      with(dialogColumns.add()){
      with(dialogRows.add()){
      staticTexts.add({staticLabel:"Source Folder:", minWidth:myLabelWidth});
      staticTexts.add({staticLabel:myFolder.path + "/" + myFolder.name});
      }
      with(dialogRows.add()){
      staticTexts.add({staticLabel:"Number of Images:", minWidth:myLabelWidth});
      staticTexts.add({staticLabel:myFiles.length + ""});
      }
      }
      }
      with(dialogRows.add()){
      staticTexts.add({staticLabel:"Options:"});
      }
      with(borderPanels.add()){
      with(dialogColumns.add()){
      with(dialogRows.add()){
      staticTexts.add({staticLabel:"Number of Rows:", minWidth:myLabelWidth});
      var myNumberOfRowsField = integerEditboxes.add({editValue:3});
      }
      with(dialogRows.add()){
      staticTexts.add({staticLabel:"Number of Columns:", minWidth:myLabelWidth});
      var myNumberOfColumnsField = integerEditboxes.add({editValue:3});
      }
      with(dialogRows.add()){
      staticTexts.add({staticLabel:"Horizontal Offset:", minWidth:myLabelWidth});
      var myHorizontalOffsetField = measurementEditboxes.add({editValue:12, editUnits:MeasurementUnits.points});
      }
      with(dialogRows.add()){
      staticTexts.add({staticLabel:"Vertical Offset:", minWidth:myLabelWidth});
      var myVerticalOffsetField = measurementEditboxes.add({editValue:24, editUnits:MeasurementUnits.points});
      }
      with (dialogRows.add()){
      with(dialogColumns.add()){
      staticTexts.add({staticLabel:"Fitting:", minWidth:myLabelWidth});
      }
      with(dialogColumns.add()){
      var myFitProportionalCheckbox = checkboxControls.add({staticLabel:"Proportional", checkedState:true});
      var myFitCenterContentCheckbox = checkboxControls.add({staticLabel:"Center Content", checkedState:true});
      var myFitFrameToContentCheckbox = checkboxControls.add({staticLabel:"Frame to Content", checkedState:true});
      }
      }
      with(dialogRows.add()){
      var myRemoveEmptyFramesCheckbox = checkboxControls.add({staticLabel:"Remove Empty Frames:", checkedState:true});
      }
      }
      }
      with(dialogRows.add()){
      staticTexts.add({staticLabel:""});
      }
      var myLabelsGroup = enablingGroups.add({staticLabel:"Labels", checkedState:true});
      with (myLabelsGroup){
      with(dialogColumns.add()){
      //Label type
      with(dialogRows.add()){
      with(dialogColumns.add()){
      staticTexts.add({staticLabel:"Label Type:", minWidth:myLabelWidth});
      }
      with(dialogColumns.add()){
      var myLabelTypeDropdown = dropdowns.add({stringList:["File name", "File path", "XMP description", "XMP author"], selectedIndex:0});
      }
      }
      //Text frame height
      with(dialogRows.add()){
      with(dialogColumns.add()){
      staticTexts.add({staticLabel:"Label Height:", minWidth:myLabelWidth});
      }
      with(dialogColumns.add()){
      var myLabelHeightField = measurementEditboxes.add({editValue:24, editUnits:MeasurementUnits.points});
      }
      }
      //Text frame offset
      with(dialogRows.add()){
      with(dialogColumns.add()){
      staticTexts.add({staticLabel:"Label Offset:", minWidth:myLabelWidth});
      }
      with(dialogColumns.add()){
      var myLabelOffsetField = measurementEditboxes.add({editValue:0, editUnits:MeasurementUnits.points});
      }
      }
      //Style to apply
      with(dialogRows.add()){
      with(dialogColumns.add()){
      staticTexts.add({staticLabel:"Label Style:", minWidth:myLabelWidth});
      }
      with(dialogColumns.add()){
      var myLabelStyleDropdown = dropdowns.add({stringList:myStyleNames, selectedIndex:0});
      }
      }
      //Layer
      with(dialogRows.add()){
      with(dialogColumns.add()){
      staticTexts.add({staticLabel:"Layer:", minWidth:myLabelWidth});
      }
      with(dialogColumns.add()){
      var myLayerDropdown = dropdowns.add({stringList:myLayerNames, selectedIndex:0});
      }
      }
      }
      }
            var myResult = myDialog.show();
            if(myResult == true){
      var myNumberOfRows = myNumberOfRowsField.editValue;
      var myNumberOfColumns = myNumberOfColumnsField.editValue;
      var myRemoveEmptyFrames = myRemoveEmptyFramesCheckbox.checkedState;
      var myFitProportional = myFitProportionalCheckbox.checkedState;
      var myFitCenterContent = myFitCenterContentCheckbox.checkedState;
      var myFitFrameToContent = myFitFrameToContentCheckbox.checkedState;
      var myHorizontalOffset = myHorizontalOffsetField.editValue;
      var myVerticalOffset = myVerticalOffsetField.editValue;
      var myMakeLabels = myLabelsGroup.checkedState;
      var myLabelType = myLabelTypeDropdown.selectedIndex;
      var myLabelHeight = myLabelHeightField.editValue;
      var myLabelOffset = myLabelOffsetField.editValue;
      var myLabelStyle = myStyleNames[myLabelStyleDropdown.selectedIndex];
      var myLayerName = myLayerNames[myLayerDropdown.selectedIndex];
      myDialog.destroy();
      myMakeImageCatalog(myFiles, myNumberOfRows, myNumberOfColumns, myRemoveEmptyFrames, myFitProportional, myFitCenterContent, myFitFrameToContent, myHorizontalOffset, myVerticalOffset, myMakeLabels, myLabelType, myLabelHeight, myLabelOffset, myLabelStyle,  myLayerName);
            }
      else{
      myDialog.destroy();
      }
      }
    }
    function myGetParagraphStyleNames(myDocument){
      var myStyleNames = new Array;
      var myAddLabelStyle = true;
      for(var myCounter = 0; myCounter < myDocument.paragraphStyles.length; myCounter++){
      myStyleNames.push(myDocument.paragraphStyles.item(myCounter).name);
      if (myDocument.paragraphStyles.item(myCounter).name == "Labels"){
      myAddLabelStyle = false;
      }
      }
      if(myAddLabelStyle == true){
      myStyleNames.push("Labels");
      }
      return myStyleNames;
    }
    function myMakeImageCatalog(myFiles, myNumberOfRows, myNumberOfColumns, myRemoveEmptyFrames, myFitProportional, myFitCenterContent, myFitFrameToContent, myHorizontalOffset, myVerticalOffset, myMakeLabels, myLabelType, myLabelHeight, myLabelOffset, myLabelStyle,  myLayerName){
      var myPage, myFile, myCounter, myX1, myY1, myX2, myY2, myRectangle, myLabelStyle, myLabelLayer;
      var myParagraphStyle, myError;
      var myFramesPerPage = myNumberOfRows * myNumberOfColumns;
      var myDocument = app.activeDocument;
      myDocument.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.points;
      myDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.points;
      var myDocumentPreferences = myDocument.documentPreferences;
      var myNumberOfFrames = myFiles.length;
      var myNumberOfPages = Math.round(myNumberOfFrames / myFramesPerPage);
      if ((myNumberOfPages * myFramesPerPage) < myNumberOfFrames){
      myNumberOfPages++;
      }
      //If myMakeLabels is true, then add the label style and layer if they do not already exist.
      if(myMakeLabels == true){
      try{
      myLabelLayer = myDocument.layers.item(myLayerName);
      //if the layer does not exist, trying to get the layer name will cause an error.
      myLabelLayer.name;
      }
      catch (myError){
      myLabelLayer = myDocument.layers.add({name:myLayerName});
      }
      //If the paragraph style does not exist, create it.
      try{
      myParagraphStyle = myDocument.paragraphStyles.item(myLabelStyle);
      myParagraphStyle.name;
      }
      catch(myError){
      myDocument.paragraphStyles.add({name:myLabelStyle});
      }
      }
      myDocumentPreferences.pagesPerDocument = myNumberOfPages;
      myDocumentPreferences.facingPages = false;
      var myPage = myDocument.pages.item(0);
      var myMarginPreferences = myPage.marginPreferences;
      var myLeftMargin = myMarginPreferences.left;
      var myTopMargin = myMarginPreferences.top;
      var myRightMargin = myMarginPreferences.right;
      var myBottomMargin = myMarginPreferences.bottom;
      var myLiveWidth = (myDocumentPreferences.pageWidth - (myLeftMargin + myRightMargin)) + myHorizontalOffset
      var myLiveHeight = myDocumentPreferences.pageHeight - (myTopMargin + myBottomMargin)
      var myColumnWidth = myLiveWidth / myNumberOfColumns
      var myFrameWidth = myColumnWidth - myHorizontalOffset
      var myRowHeight = (myLiveHeight / myNumberOfRows)
      var myFrameHeight = myRowHeight - myVerticalOffset
      var myPages = myDocument.pages;
      // Construct the frames in reverse order. Don't laugh--this will
      // save us time later (when we place the graphics).
      for (myCounter = myDocument.pages.length-1; myCounter >= 0; myCounter--){
      myPage = myPages.item(myCounter);
      for (var myRowCounter = myNumberOfRows; myRowCounter >= 1; myRowCounter--){
      myY1 = myTopMargin + (myRowHeight * (myRowCounter-1));
      myY2 = myY1 + myFrameHeight;
      for (var myColumnCounter = myNumberOfColumns; myColumnCounter >= 1; myColumnCounter--){
      myX1 = myLeftMargin + (myColumnWidth * (myColumnCounter-1));
      myX2 = myX1 + myFrameWidth;
      myRectangle = myPage.rectangles.add(myDocument.layers.item(-1), undefined, undefined, {geometricBounds:[myY1, myX1, myY2, myX2], strokeWeight:0, strokeColor:myDocument.swatches.item("None")});
      }
      }
      }
      // Because we constructed the frames in reverse order, rectangle 1
      // is the first rectangle on page 1, so we can simply iterate through
      // the rectangles, placing a file in each one in turn. myFiles = myFolder.Files;
      for (myCounter = 0; myCounter < myNumberOfFrames; myCounter++){
      myFile = myFiles[myCounter];
      myRectangle = myDocument.rectangles.item(myCounter);
      myRectangle.place(File(myFile));
      myRectangle.label = myFile.fsName.toString();
      //Apply fitting options as specified.
      if(myFitProportional){
      myRectangle.fit(FitOptions.proportionally);
      }
      if(myFitCenterContent){
      myRectangle.fit(FitOptions.centerContent);
      }
      if(myFitFrameToContent){
      myRectangle.fit(FitOptions.frameToContent);
      }
      //Add the label, if necessary.
      if(myMakeLabels == true){
      myAddLabel(myRectangle, myLabelType, myLabelHeight, myLabelOffset, myLabelStyle, myLayerName);
      }
      }
      if (myRemoveEmptyFrames == 1){
      for (var myCounter = myDocument.rectangles.length-1; myCounter >= 0;myCounter--){
      if (myDocument.rectangles.item(myCounter).contentType == ContentType.unassigned){
      myDocument.rectangles.item(myCounter).remove();
      }
      else{
      //As soon as you encounter a rectangle with content, exit the loop.
      break;
      }
      }
      }
    }
    //Function that adds the label.
    function myAddLabel(myFrame, myLabelType, myLabelHeight, myLabelOffset, myLabelStyleName, myLayerName){
      var myDocument = app.documents.item(0);
      var myLabel;
      var myLabelStyle = myDocument.paragraphStyles.item(myLabelStyleName);
      var myLabelLayer = myDocument.layers.item(myLayerName);
      var myLink =myFrame.graphics.item(0).itemLink;
      //Label type defines the text that goes in the label.
      switch(myLabelType){
      //File name
      case 0:
      myLabel = myLink.name;
      break;
      //File path
      case 1:
      myLabel = myLink.filePath;
      break;
      //XMP description
      case 2:
      try{
      myLabel = myLink.linkXmp.description;
      if(myLabel.replace(/^\s*$/gi, "")==""){
      throw myError;
      }
      }
      catch(myError){
      myLabel = "No description available.";
      }
      break;
      //XMP author
      case 3:
      try{
      myLabel = myLink.linkXmp.author
      if(myLabel.replace(/^\s*$/gi, "")==""){
      throw myError;
      }
      }
      catch(myError){
      myLabel = "No author available.";
      }
      break;
      }
      var myX1 = myFrame.geometricBounds[1];
      var myY1 = myFrame.geometricBounds[2] + myLabelOffset;
      var myX2 = myFrame.geometricBounds[3];
      var myY2 = myY1 + myLabelHeight;
      var myTextFrame = myFrame.parent.textFrames.add(myLabelLayer, undefined, undefined,{geometricBounds:[myY1, myX1, myY2, myX2], contents:myLabel});
      myTextFrame.textFramePreferences.firstBaselineOffset = FirstBaseline.leadingOffset;
      myTextFrame.parentStory.texts.item(0).appliedParagraphStyle = myLabelStyle;
    }
    
  • How to determine whether the current operating system is windows, or MAC?

    How to determine whether the current operating system is windows, or MAC?

    CSparrow wrote:

    operatingSystem var = $.getenv ("OS");

    operatingSystem = operatingSystem.toString ();

    alert (operatingSystem);

    It gives me Windows NT Windows 10

    With the help of:

    alert($.os);
    

    works for me.

    (result: Windows/64 10.0)

    and the Silly-V code

    Folder.FS

    gives you the name of the operating system

  • How to split the merged cells in the current document

    Hi experts

    How to script a separation all the merged cells in the current document?

    Thank you

    Respect of

    John

    something like:
    app.activeDocument.stories.everyItem ().tables.everyItem ().cells.everyItem () .unmerge () should work (not tested)

  • Get the path to the current document. Automation plugin

    How to get the path to the current document? (C++ Plugin)

    I used headset and getter - but I do not see that information.

    I understand that there is something in the opposite direction of:

    FullPathToAlias ('... filename.psd ', aliasValue);

    error = sPSActionDescriptor-> PutAlias (someDesc, keyFileReference, aliasValue);

    But how to someDesc so there is a lot of open document

    I'm sorry.

    the answer is:

    logfilename Char [MAX_PATH];

    Manage aliases.

    error = PIUGetInfo (classDocument, keyFileReference, & alias, NULL);

    AliasToFullPath (alias, & filename [0], MAX_PATH);

  • How can I check the color profile for the current document?

    I would like to create a script that checks the color profile of the current document and it compares a string, for example "sRGB IEC61966 - 2.1. My studio is a script that performs various functions to make sure that all the layers are visible/unlocked, check the Eparses points, etc., and we want to add a control to the color profile because we support a large number of files and this setting is overlooked a lot.

    It's alright if this value is not writable by the script (we can just pop up an alert informing the user that they need to change it), but I can't find where to read this setting! We are currently working on Macs, with JavaScript, but no helping hand in the right direction would be great.

    Thank you!

    He appears only in the PDF and HAVE options record and only as a Boolean value true or false. It doesn't seem to be available to scripts.

  • How can we get the path of the current document?

    Hello

    I want to store the path of the current document file in a string, I tried the AIDocumentSuite, and

    AIAPI AIErr(* AIDocumentSuite::GetDocumentFileSpecification) (ai::FilePath & file).

    His ended in prameter conversion error (c 2664). Can someone guide me to get the current path.

    Thanks in advance

    Farida kaid

    file ai::FilePath.

    Error AIErr is sDocument-> GetDocumentFileSpecification (line);.

    If (error! = kNoError) {}

    There was a problem
    }

  • Photoshop script to copy all the layers of close PSD to open the current document

    Hi, I have very limited capacity script so this task is above my pay grade

    I'm looking for a script to read and copy all the layers in a PSD saved file and copy them into the current active document. The two documents have the same size and I need to be able to change text layers after copying. Anyone has any advice or examples of how I might be able to do this?

    Thank you in advance for any help you can offer.

    Kind regards

    Marcus

    Try the script in entry below. You must open the destination file, and you must put in the path and name where your source file. It will not choose a layer from background from the source file.

    #target photoshop
    var sFile = new File('~/desktop/template.psd');//change path to template file
    var doc = activeDocument;
    var sDoc = open(sFile);
    
    var idselectAllLayers = stringIDToTypeID( "selectAllLayers" );
        var desc2 = new ActionDescriptor();
        var idnull = charIDToTypeID( "null" );
            var ref1 = new ActionReference();
            var idLyr = charIDToTypeID( "Lyr " );
            var idOrdn = charIDToTypeID( "Ordn" );
            var idTrgt = charIDToTypeID( "Trgt" );
            ref1.putEnumerated( idLyr, idOrdn, idTrgt );
        desc2.putReference( idnull, ref1 );
    executeAction( idselectAllLayers, desc2, DialogModes.NO );
    
    var idDplc = charIDToTypeID( "Dplc" );
        var desc5 = new ActionDescriptor();
        var idnull = charIDToTypeID( "null" );
            var ref2 = new ActionReference();
            var idLyr = charIDToTypeID( "Lyr " );
            var idOrdn = charIDToTypeID( "Ordn" );
            var idTrgt = charIDToTypeID( "Trgt" );
            ref2.putEnumerated( idLyr, idOrdn, idTrgt );
        desc5.putReference( idnull, ref2 );
        var idT = charIDToTypeID( "T  " );
            var ref3 = new ActionReference();
            var idDcmn = charIDToTypeID( "Dcmn" );
            ref3.putName( idDcmn, doc.name );
        desc5.putReference( idT, ref3 );
        var idVrsn = charIDToTypeID( "Vrsn" );
        desc5.putInteger( idVrsn, 5 );
        var idIdnt = charIDToTypeID( "Idnt" );
            var list1 = new ActionList();
            list1.putInteger( 3 );
            list1.putInteger( 4 );
        desc5.putList( idIdnt, list1 );
    executeAction( idDplc, desc5, DialogModes.NO );
    
  • The current versions of Flash Player will not work on my Windows 7 computer

    When I install a later version of Flash Player, it won't play the videos.  Here is what I get on YouTube https://dl.dropbox.com/u/6246962/0002.png .   I then went back to an earlier version.  When running the previous version of Firefox nags me constantly need to be updated.  This has happened for a year or two.   I run Firefox on Windows 7.  The last version that works is 11.1.102.55

    Of course, the question is how to do a current version of Flash Player work?

    It worked.  Thank you

  • Get the error not defined for the current document in the script

    I get a "error number: 2" "error string: myDoc is not defined" in my script.

    I modified a few scripts so that they cross my entire book and open each section (document) in my book, and run the code for each section.ext

    The code runs great and opens and closes the sections where it does not add links to text, but once, it opens a document and view text that you CAN add links, it generates this error.  Here is my code:

    main();
    exit();
    
    function main() {
        var myBook = app.activeBook,
                myDocs = myBook.bookContents.everyItem().getElements(),
                myDoc,
                myHyperlinkStyle,
                myCount = 0;
    
        for (var i=0; i< myDocs.length; i++) {
            myDoc = app.open(File("\\\\computerOnNetwork\\c$\\Folder\\" + myDocs[i].name));
            myHyperlinkStyle = myDoc.characterStyles.item("linkstyle");
    
            try {
                var script = app.activeScript;
            } catch(err) {
                var script = File(err.fileName);
            }
            var myScriptFolderPath = script.path;
            var myFindChangeFile = new File(myScriptFolderPath + "/SearchTextAndUrls.txt"); //mac path for users desktop //File.openDialog("Choose the file containing the tab separated list"); 
            //alert(myFindChangeFile)
            myFindChangeFile = File(myFindChangeFile);
            var myResult = myFindChangeFile.open("r", undefined, undefined);
            if(myResult == true){
                app.findTextPreferences = NothingEnum.nothing;
                app.changeTextPreferences = NothingEnum.nothing;
                //Loop through the find/change operations.
                do {
                    //read 1 line into myLine
                    myLine = myFindChangeFile.readln();
                    myFindChangeArray = myLine.split("\t");
    
                    //The first field in the line is the value to find 
                    myFindVal = myFindChangeArray[0];
    
                    // second is the url
                    myFindUrl = myFindChangeArray[1];
    
                    doSearchAndReplace(myFindVal, myFindUrl, app.activeDocument);
    
                } while(myFindChangeFile.eof == false);
                    myFindChangeFile.close();
                    // reset search
                    app.findTextPreferences = NothingEnum.nothing;
                    app.changeTextPreferences = NothingEnum.nothing;
            }
            alert("Done! " + myCount + " hyperlinks have been added.");
    
            myDoc.close();
        }
    }
    
    function doSearchAndReplace(stringfind, urlstring, searchin) {
        app.findTextPreferences.findWhat = stringfind;
    
        //Set the find options.
        app.findChangeTextOptions.caseSensitive = false;
        app.findChangeTextOptions.includeFootnotes = false;
        app.findChangeTextOptions.includeHiddenLayers = false;
        app.findChangeTextOptions.includeLockedLayersForFind = false;
        app.findChangeTextOptions.includeLockedStoriesForFind = false;
        app.findChangeTextOptions.includeMasterPages = false;
        app.findChangeTextOptions.wholeWord = false;
    
        var myFoundItems = searchin.findText();
    
        for (i = 0; i < myFoundItems.length; i++) {
            var myHyperlinkDestination = myMakeURLHyperlinkDestination(urlstring);
            myMakeHyperlink(myFoundItems[i], myHyperlinkDestination);
            myFoundItems[i].applyCharacterStyle(myHyperlinkStyle, false);
            myCount++
        }
    }
    
    function myMakeHyperlink(myFoundItem, myHyperlinkDestination){
        try {
            var myHyperlinkTextSource = myDoc.hyperlinkTextSources.add(myFoundItem);
            var myHyperlink = myDoc.hyperlinks.add(myHyperlinkTextSource, myHyperlinkDestination);
            myHyperlink.visible = false;
        }
        catch(myError){
        }
    }
    
    function myMakeURLHyperlinkDestination(myURL){
        //If the hyperlink destination already exists, use it;
        //if it doesn't, then create it.
        try{
            var myHyperlinkDestination = myDoc.hyperlinkURLDestinations.item(myURL);
            myHyperlinkDestination.name;
        }
        catch(myError){
            myHyperlinkDestination = myDoc.hyperlinkURLDestinations.add(myURL);
        }
        myHyperlinkDestination.name = myURL;
    
        //Set other hyperlink properties here, if necessary.
        return myHyperlinkDestination;
    }
    

    Any help is greatly appreciated!

    That ends up being my fixed/final code:

    main();
    exit();
    
    function main() {
        var myBook = app.activeBook,
                myDocs = myBook.bookContents.everyItem().getElements(),
                myDoc,
                myHyperlinkStyle;
    
        for (var i=0; i< myDocs.length; i++) {
            myDoc = app.open(File("\\\\computerOnNetwork\\c$\\Folder\\" + myDocs[i].name));
            myHyperlinkStyle = myDoc.characterStyles.item("linkstyle");
    
            try {
                var script = app.activeScript;
            } catch(err) {
                var script = File(err.fileName);
            }
            var myScriptFolderPath = script.path;
            var myFindChangeFile = new File(myScriptFolderPath + "/SearchTextAndUrls.txt"); //mac path for users desktop //File.openDialog("Choose the file containing the tab separated list");
            //alert(myFindChangeFile)
            myFindChangeFile = File(myFindChangeFile);
            var myResult = myFindChangeFile.open("r", undefined, undefined);
            if(myResult == true){
                app.findTextPreferences = NothingEnum.nothing;
                app.changeTextPreferences = NothingEnum.nothing;
                //Loop through the find/change operations.
                do {
                    //read 1 line into myLine
                    myLine = myFindChangeFile.readln();
                    myFindChangeArray = myLine.split("\t");
    
                    //The first field in the line is the value to find
                    myFindVal = myFindChangeArray[0];
    
                    // second is the url
                    myFindUrl = myFindChangeArray[1];
    
                    doSearchAndReplace(myFindVal, myFindUrl, app.activeDocument, myDoc, myHyperlinkStyle);
    
                } while(myFindChangeFile.eof == false);
                    myFindChangeFile.close();
                    // reset search
                    app.findTextPreferences = NothingEnum.nothing;
                    app.changeTextPreferences = NothingEnum.nothing;
            }
            alert("Done! Hyperlinks have been added.");
    
            myDoc.close();
        }
    }
    
    function doSearchAndReplace(stringfind, urlstring, searchin, myDoc, myHyperlinkStyle) {
        app.findTextPreferences.findWhat = stringfind;
    
        //Set the find options.
        app.findChangeTextOptions.caseSensitive = false;
        app.findChangeTextOptions.includeFootnotes = false;
        app.findChangeTextOptions.includeHiddenLayers = false;
        app.findChangeTextOptions.includeLockedLayersForFind = false;
        app.findChangeTextOptions.includeLockedStoriesForFind = false;
        app.findChangeTextOptions.includeMasterPages = false;
        app.findChangeTextOptions.wholeWord = false;
    
        var myFoundItems = searchin.findText();
    
        for (i = 0; i < myFoundItems.length; i++) {
            var myHyperlinkDestination = myMakeURLHyperlinkDestination(urlstring, myDoc);
            myMakeHyperlink(myFoundItems[i], myHyperlinkDestination, myDoc);
            myFoundItems[i].applyCharacterStyle(myHyperlinkStyle, false);
        }
    }
    
    function myMakeHyperlink(myFoundItem, myHyperlinkDestination, myDoc){
        try {
            var myHyperlinkTextSource = myDoc.hyperlinkTextSources.add(myFoundItem);
            var myHyperlink = myDoc.hyperlinks.add(myHyperlinkTextSource, myHyperlinkDestination);
            myHyperlink.visible = false;
        }
        catch(myError){
        }
    }
    
    function myMakeURLHyperlinkDestination(myURL, myDoc){
        //If the hyperlink destination already exists, use it;
        //if it doesn't, then create it.
        try{
            var myHyperlinkDestination = myDoc.hyperlinkURLDestinations.item(myURL);
            myHyperlinkDestination.name;
        }
        catch(myError){
            myHyperlinkDestination = myDoc.hyperlinkURLDestinations.add(myURL);
        }
        myHyperlinkDestination.name = myURL;
    
        //Set other hyperlink properties here, if necessary.
        return myHyperlinkDestination;
    }
    
  • How can I save current document in my Player plugin?

    I tried PDDocSave - compiler fails.

    Overview of the API said - it is available in PRo or STD

    OK - Reader can not record unless the file is compatible player.

  • Flash Player has stopped working. I have the current Firefox and Flash Player. Unloading and reinstalled, same thing. I spent hours and hours trying to fix

    Watch a video on youtube and went to a daily on forge Empires. I couldn't connect to forge Empires, but the video has stopped and I could not connect. FlashDrive stopped 3 days ago or not worked since. Everything is up-to-date. I uninstalled and reinstalled, I have same uniinstalled and downgraded, still does not work. Never had any problems with it before

    I posted the answer on another thread - basically, I'm having the same problem and I did everything everyone suggested and it still does not - but I also find that my lawnmower for Polyvore is also is no longer works on Firefox - in fact, it starts to work and then just - stops every hour every time. I downloaded a new lawn mower and still the same problem - the two problems (Flash and polyvore) started at the same time - worked well before and both work very well on IE - which I hate to say that I may just have to-if anyone has this problem and managed to fix it please tell me how - I want to stay with Mozilla.

  • JavaScript: How do you pass the currently active doc to a dialogue in a menu item?

    I use Adobe Acrobat 11.0 Standard on Windows 7, and I have a problem with the menu item that I create.  The menu item calls a dialog box that prompts the user to select a page in the active document.  The problem is, I can't find a way to send the currently active document in the dialog box.  I went through the rest of the documentation, did some research on Google and here in the Adobe forums, but do not have whatever it is turned upward.  The AcroJS API gives the following solution (which is under app/methods/execDialog):

    This function attaches the Doc object to the dialog box, then past the dialog box to the app.execDialog method. The dialog4 object and this function may be at the level of the document.

    function dotheDialog (dialog, doc)

    {

    Dialog.doc = doc;

    retn var = app.execDialog (dialog)

    }

    Finally, the following script can be run an action of mouse-to the top, for example.

    dotheDialog (dialog4, this);

    I did this exact thing, but in the dialog box, the value of this.numPages still comes out as indefinite, indicating that the current document has not yet been adopted.  My own code looks like this:

    function dotheDialog (dialogue, thisDoc) {}

    Dialog.doc = thisDoc;

    retn var = app.execDialog (dialog);

    }

    app.addMenuItem({)

    cName: 'Testbox Dialogue. "

    cParent: "change."

    cExec: "dotheDialog (templateDialogue, this);"

    });

    where templateDialogue is the name of my own dialog, rather than dialog4.  I'm not sure of what concerns the variable retn that they declare in the documentation, but I have tried with and without this part, and it doesn't seem to make a difference.  Does anyone know how to do this?

    The reference to the document is a property of the dialog box, so that you access the inside like this:

    This.doc

    And if you want to access the number of pages, like this:

    this.doc.numPages

Maybe you are looking for