scripts in calculation in a pdf file

Hi all

I was wondering if someone could help me. I need to create/put in a script that calculates the percentage change between two fields. I know how to do it on the calculator (second less first number divided by the first variation of the second first number = number) but I don't know all the syntax and abbreviations.

Also, I have to put something in the script that would be to leave this field blank if no values have been put in the two first fields? Just try to think of everything that I need.

Thanks much for any help.

You can do this by using this generic code (simply adjust the field names to match those of your file):

var a = this.getField("Field A").valueAsString;
var b = this.getField("Field B").valueAsString;
if (a=="" || b=="" || Number(a)==0) event.value = "";
else event.value = (Number(b)-Number(a))/Number(a);

Tags: Acrobat

Similar Questions

  • Script that export two separate PDF files of paper with two pages AND change the name of the file, the number two of the PDF

    OBS: Script InDesign CS3:

    I have a document with two pages but a file name!

    I need a script which

    1 export the two pages in format PDF separated two - so NOT a single PDF file with two pages but two PDF files

    2. the first PDF file must have the same name as the document - for example .indd13ESW110020216TC0-> ESW110020216TC013.pdf

    3. the second PDF file will be added to the last number - so .indd14ESW110020216TC0-> ESW110020216TC014.pdf

    Is it possible to integrate this script:

    var doc = app.activeDocument;  
    var _PDFfile = new File('\\\\testserver\\' + app.activeDocument.name.replace (/\.indd$/, '.pdf'));  
      
    var _PDFExportPreset = app.pdfExportPresets.item('MyPdfSetting');   
    if (_PDFExportPreset == null){  
       alert('PDF Export Presets not found');  
       exit();  
        }    
        app.pdfExportPreferences.pageRange = PageRange.ALL_PAGES;                      
        doc.exportFile(ExportFormat.pdfType, _PDFfile, false,_PDFExportPreset);  
    

    Hello

    Try this...

  • Does anyone know how to fix a problem of calculation in a pdf file that is a financial spreadsheet?

    Currently I have a financial spreadsheet I had to create for my work.  One of the cells does not calculate correctly.  I need for the cell to use calculation Total - Total balance = balance.  I used abbreviations in the cell itself to the formula so I know this isn't the problem.  The poor figures will calculate in the cell.  I find that I have to delete the wrong number, and then in another cell.  Once I click in another cell that will fill out the right balance.  I would be fine with that, but my boss is not ok with having to perform additional steps.  Can someone help me?

    It sounds like a problem of calculation of field command. Access the form Edit mode - calculation order of field tasks - more - and make sure that the field of the Balance is under the other two fields in the list.

  • Scripting 'Save PSD to PDF with password security' and 'Open a PDF file with password security' issue.

    Hello!

    I am now building an extension for Photoshop. The script (jsx) should save the document as Photoshop PDF secured with a password. The IPL is the same all the time and is defined in the script. Then, the script is to open the PDF file with that same password. I need this to protect the PDF of the opening by a user, so that only the script has access to the file.

    I googled a lot. I saw a similar topic on this community date in 2012. He did not respond. With one comment saying that savings with a password appears to be possible via GUI and not a script.

    Nothing has changed since 2012?

    P.S. .requireDocumentPassword and Illustrator .documentPassword do not work in PS and ScriptListener gives still nothing :-/

    ScriptListener always gives nothing

    Which probably means the task is not (yet) possible to achieve with Photoshop scripts.

    The Photoshop DOM and I seem to have weaknesses or omissions that I consider more relevant, but if you consider the matter as essential you can post a feature request to

    Community customer Photoshop family

  • Save Indd Filename with the name of any PDF file

    Hi all, I'm not much more than a programmer, so this may seem like an incredibly easy problem for most of you, but it's confusing to me. I'm under Indesign 5.5, and I have a javascript that I hacked together who will have to intervene once PDF on a page to the specific spacing. I want the script to do next is to insert the name of the PDF file in a textbox somewhere on that and then you page prompts to save the indesign file with the default filename the name of the placed pdf file.

    Kel if the file name of the PDF file on this page is "TDC-smith - 1.pdf", the text "TDC-smith-1"appears in a text box on this page and then the indesign file would save with a file name by default of "TDC-smith-1 fr.indd". Who is?

    Thank you!

    Loic thanks for your help. You helped me to be part of the solution. In the end if I was able to find a more simple solution, based on a few other scripts I dug up, which did exactly what I needed. It is not quite as elegant as it should (there no controls or alerts if the script requirements), but it does the job well enough.

    Basically, it creates just a variable for the filename and the filepath of the first chart that it finds in the document. It then uses a replacement text script to remove the name of the PDF extension and exchange the text in a text box that contains "Default Text", also adding a variable that I use earlier in the script to indicate how many PDF files have been strengthened. Finally, it saves the document in the same folder as the PDF file using the MyImagePath variable, also the number of PDFs variable by the name of file.

    I hope that someone finds it useful!

    myDoc var = app.activeDocument;

    var myImage = myDoc.allGraphics;

    find the file name and path of the PDF in the document

    for (var i = 0; myImage.length > i; i ++) {}

    App.Select (myImage [i]);

    var MyImageName is myImage [i].itemLink.name;.

    var MyImagePath is myImage [i].itemLink.filePath;.

    }

    replace the text box that contains "Default Text" by "filename-number of labels variable-up."

    replaceText ("Default Text", MyImageName + '-' + myNumberOfLabels + 'up');

    replaceText (".pdf", "");

    function replaceText (input, output)

    {

    app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;

    app.findTextPreferences.findWhat = entry;

    app.changeTextPreferences.changeTo = output;

    app.activeDocument.changeText ();

    app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;

    }

    Save the file co-operate in the same directory as PDF, with the same name of PDF + variable indicating the number of labels stepping

    ;

    saveFile = File (MyImagePath.replace(/.pdf$/, ") +"-"+ myNumberOfLabels +"up"+".indd");

    app.activeDocument.save (saveFile);

    }

  • my pdf file attaches more to e-mail by using a script in microsoft access. is there a setting that blocks it?

    So I need to know if there are some settings that need to be changed that interfere with this script or the way my system handles PDF files. I'd like to support, but I don't seem to be able to get past and a human machine questions!

    I found the answer is not adobe, there is a security update that does not allow a file to be written to the c:\ drive. Had to change the code.

  • How to integrate the police Segoe Script in a saved pdf file?

    When I save a file .psd in .PDF (with Photoshop elements 12), two of the three fonts do appear fine in the .pdf file, but not the third (Segoe Script).  I open the PDF with Adobe Reader XI.

    How to integrate the police Segoe Script in the .pdf file?   (Depending on the printer, it must be there.)

    Thank you.

    Yes you will not be able to use either the distorted text.

    (these kinds of properties do not appear in this font)

    If you want to tilt the text as it would be for the italicized text, you can use Image > transform > Skew.

  • A script that will count the total number of pages into multiple PDF files in a batch file?

    Is there a script I can use ExtendScript Toolkit that will count the total number of pages into multiple PDF files in a batch file?

    In another discussion I showed a JavaScript that you can use to write the number of pages to the console in a batch sequence. You would do exactly the same thing in Action, so the action would consist of a simple JavaScript (more tools > run JavaScript) which includes the code.

  • Have a lot of script transformation that may expose the text in files and convert to pdf files

    Suppose I have a folder that contains files have 100,

    I would like to create large lines of text inside each files,.

    and then convert it into pdf files,

    How can I do?

    y does it have that a java script can do?

    you do just that,

    -Open

    -the textual elements of loop

    -make the contours

    -Save to PDF

    -Repeat

    If you are not familiar with the scripts, try to save an Action, it can work.

  • Script to remove the first few characters of a PDF file name?

    I know it should be easy, but I'm not a coder and don't have many opportunities to write scripts.  I hope it's like a second request two anyone out there.  All I want to do is point a script in a PDF file that will review the file name, cut the first two characters of the file name and save the original file again.  I need to do this about 400 PDF documents on a recurring basis, hence the need for a script.  Thus, for example, if I have a C:/temp/myFile.pdf file, I would the script to rename the file to just "file.pdf".

    Any help would be greatly appreciated.

    JBF

    Use this code in your action (note that this will not work if your file name)

    contains the comma):

    var filePath = this.path.replace(this.documentFileName,"");

    var NouveauNomFichier = this.documentFileName.substring (2);

    this.saveAs (filePath + newFileName);

  • Open a new File() by Script and set the Type of PDF file fails...

    Hi all

    I created a script to download PDFs from a server and store them in an Indesign Document. Everything works fine except Indesign doesn't not recocnize file Type when you try to place the pdf file and get an error that the downloaded PDF file cannot be due to the filter of the unknown.

    This is because the file type is apparently set to TEXT (creator is CARO) event if I write the file with

    myFile.open ('w', 'PDF', "CARO");

    No idea how

    -get Indesign all the file type of a file newly generated in PDF format

    or

    -Change the Type of file later

    or

    -tell Indesign what filter to use when you place this file?

    Thanks for your help

    BTW: Indesign CS5 (7.0.4), OS X 10.6.8

    UH... but you might be better off placing both '\0\0\0\0' and leave the treatment kick file extension.

  • The value of PDF file printed via the script name

    Hi people!

    I have a little problem with the generation of a PDF file. First my Workflow:

    I have an InDesign document with 6 pages. This document is merged with a databasefile containing 100 records. After it is merged, we need to generate a PDF file. This PDF file is opened in acrobat. In the document, I am looking for one ID for each record so I can split the document to 100 files (each with 6 pages) and name by the ID that I found.

    The Acrobat script is finished and functional. I thought: the InDesign script is over, too. But I was wrong-. -.

    I merged the databasefile with the document and it has exported to PDF. But after export, we noticed that the Acrobat script isn't finding the adressheader where ID is in. The script only noticed the text after this header. The result is, as get-Acrobat always 'null' as ID

    If print us the PDF with our PDFprinter, the header could be read by our script of Acrobat. I don't know why this is... But now, I changed the script to print the files through our PDF printer. Unfortunately I can not set a name for my exported file - do you know if it is possible to print PDF files without asking for confirmation after each other as well as with a via script name?

    Here you can see the old writing for InDesign and after her, the sript Acrobat. Maybe I made a mistake by generating my PDFexport and have no need to use the printer?

    INDESIGN SCRIPT:

    /**
    * invite filebrowser and stores the name and path of the file in variable
    */
    var sourceDocument = File.openDialog ("Bitte Indesign-Dokument Park", "*.indd", false);

    /**
    * stores the only prefix of file name to use as the new file name
    */
    newName var = sourceDocument.name.substr (0, sourceDocument.name.length - 5);

    /**
    stores in folder where the file is stored
    */
    var dbSourceFolder = sourceDocument.parent + "/"; "

    /**
    * guests for databasefile, where production is expected to begin
    */
    var dbstartfile = File.openDialog ("Start-Datenbankdatei of Bitte Park", "*.txt", false);

    /**
    * Gets databasefile basename
    */
    var dbstartfilename = dbstartfile.name.slice (0, dbstartfile.name.search(/_Teil+/));

    /**
    * Gets number of first databasefile
    */
    var i = dbstartfile.name.slice (dbstartfile.name.search(/_Teil+/) + 5) .slice (0, -4);

    /**
    * generates the path and name of the first databasefile to use
    */
    var dbSource = dbstartfile;

    /**
    * set PDF preset to generate PDFS
    */
    var PDFPreset = app.pdfExportPresets.item ("GAG - PDF");

    /**
    * stop throwing alerts
    */
    app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;

    message will be thrown if databasefile is not existing
    If (dbSource.exists == false) {}
    reboot to launch alerts
    app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL;
    Alert ("File" + dbSourceFolder + dbprefix + "_Teil" + i + ".txt konnte nicht werden found! \n\rBitte starten Sie den procedure Rubis und Sie die right Datenbankdatei one enter.");
    }
    another process begins
    else {}
    even if (dbSource.exists == true) {}
    Opens the document indesign source without displaying
    mergeDocument = app.open (File (sourceDocument), false);
    defines what databasefile should be used for data merging
    mergeDocument.dataMergeProperties.selectDataSource (File (dbSource));
    starts the file database and the indesign document merging
    mergeDocument.dataMergeProperties.mergeRecords ();
    document generated in PDF export
    app.activeDocument.exportFile (ExportFormat.pdfType, File(sourceDocument.parent+"/"+newName+"_Teil"+i+".pdf"), false, PDFPreset);
    farm open indesign document
    mergeDocument.close (SaveOptions.no);
    i ++ ;

    change the name of the database file to get the next file
    dbSource = File(dbSource.parent+"/"+dbstartfilename+"_Teil"+i+".txt");
    }
    }
    reboot to launch alerts
    app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL;
    Alert ("PDF-Generierung sky!");

    SCRIPT ACROBAT:


    /**
    * Path where files should be saved
    * Special characters like spaces must be preceded of--------.
    * If you want to change the folder, use the following form:
    * ' / DriveLetter/foldername /... /LastFolderName/.
    * Be careful not to forget the / before and after the location
    */
    filepath var = "/ c/pdf_split_test / ';

    /**
    * Number of display pages - do not hesitate to change
    */

    pageType = app.prompt var ("Please die Seitenzahl der presentations one gewunschte.", "");
    Alert (PAGETYPE);

    /**
    to search for regular expression
    */

    var idNumber = / 08\d\d\d\d\-\d\d\d\-\d\d\d\d\d-\d\d\d-\d\d/g;

    /**
    * If possible this function gets the number sought as string
    *
    @param string of revenge that is to be found in the document
    * @return null if rematch is not found or a string if the rematch is
    */

    function ExtractFromDocument (reMatch) {}
    try {}
    var Out = new Object();
    for (var i = 0; i < 1; i ++)
    {
    numWords = this.getPageNumWords (i);
    var PageText = ' ';
    for (var j = 0; j < 30; j ++) {}
    var Word = this.getPageNthWord (i, j, false);
    PageText += Word;
    }
    var strMatches = PageText.match (reMatch);
    If (strMatches == null) continue;
    }
    Return strMatches;
    } catch (e)
    {
    App.Alert ("processing error:" + e)
    }
    }

    /**
    * tries to load given filename (excerpt number)
    *
    @param string file name of the file that should be checked
    @param n number of iterate when checking files
    * @return true if the file exists or false otherwise
    */

    function checkIfFileExists (filename, n) {}
    var existingDoc = false;
    try {}
    If (n == 0) {}
    var checkDoc = app.openDoc(filepath+filename+"-000.pdf");
    } else {}
    var checkDoc = app.openDoc(filepath+filename+"-000_"+n+".pdf");
    }
    checkDoc.closeDoc ();
    existingDoc = true;
    } catch (e) {}
    }
    If (existingDoc == true) {}
    n = n + 1;
    n = checkIfFileExists (filename, n);
    }
    return n;
    }

    var pageAmount = this.numPages;
    for (i = 0; I < pageAmount; i + pageType) {}
    var filename = ExtractFromDocument (idNumber);
    fileExistence = checkIfFileExists (filename, 0);
    If (fileExistence! = 0) {}

    this.extractPages ({nEnd:(pageType-1), cPath: filepath + filename + "-000_" + fileExistence + ".pdf"});
    } else {}
    this.extractPages ({nEnd:(pageType-1), cPath: filepath + filename + ""-000.pdf ""});
    }
    this.deletePages ({nStart:0, nEnd: pageType-1});
    }

    Hello

    I have a little problem with the generation of a PDF file. First my Workflow:

    I have an InDesign document with 6 pages. This document is merged with a databasefile containing 100 records. After it is merged, we need to generate a PDF file. This PDF file is opened in acrobat. In the document, I am looking for one ID for each record so I can split the document to 100 files (each with 6 pages) and name by the ID that I found.

    Why you are not exporting 6 pages PDF directly from InDesign?

    Robin

    www.adobescripts.co.UK

  • Scripting inDesign: Generate a PDF file

    Hello

    I have a bug with my script. Everything is OK:

    The script imports the xml file into my Indesign file and the new generated file (.indd) is correct...

    But this script generates PDF files with only 2 pages.

    You know the correct code to generate large PDF files?

    This is my script:

    var myTemplate is File.openDialog ("select a template");.

    myFolder var is Folder.selectDialog ("choose a folder to treat");.


    myDocs var = myFolder.getFiles ("*.xml");

    for (i = 0; i < myDocs.length; i ++) {}

    Open the template:

    var newDoc = app.open (myTemplate);


    Import XML:

    var myXMLImportPreferences = newDoc.xmlImportPreferences;

    myXMLImportPreferences.allowTransform = false;

    myXMLImportPreferences.createLinkToXML = false;

    myXMLImportPreferences.ignoreUnmatchedIncoming = false;

    myXMLImportPreferences.importCALSTables = false;

    myXMLImportPreferences.importTextIntoTables = false;

    myXMLImportPreferences.importToSelected = false;

    myXMLImportPreferences.removeUnmatchedExisting = true;

    myXMLImportPreferences.ignoreWhitespace = true;

    myXMLImportPreferences.repeatTextElements = true;

    newDoc.importXML (myDocs [i]);

    Add the additional document-specific treatment steps here


    Save:

    var NouveauNomFichier = myFolder.absoluteURI + ' / ' +. [i] myDocs name.replace (/ xml /, 'pdf');

    app.activeDocument.exportFile (ExportFormat.pdfType, File (newFileName), false);


    var NouveauNomFichier = myFolder.absoluteURI + ' / ' +. [i] myDocs name.replace (/ xml /, "indd");

    newDoc.save (new file (newFileName));

    app.activeDocument.close ();

    }

    Thank you

    Hey!

    Try to add before you export it in PDF format:

    app.pdfExportPreferences.pageRange = PageRange.ALL_PAGES;
    

    --

    tomaxxi

    http://indisnip.WordPress.com/

  • Need a script for InDesing culture pdf files

    Hello

    I have over 200 pages pdf file. I need to place pages in InDesign, jump the 4 sides about 20mm in InDesign. I did place using the script. I need to crop all pages, including at - it a script for the same... ?

    Thanks in advance.

    Hello

    You can try with the code below:

    var myDoc = app.activeDocument;
    var myGraphics = myDoc.allGraphics;
    for (var a = 0; a
    

    But make sure that your rule should be in mm.

    This is Zanelli script to put pdf in Indesign.

    Shonky

  • script to get the flow of bytes of the PDF file

    Hello

    Y at - it a script that can get the stream of bytes to the current PDF document?

    I use a PDF form in offline mode in the application. At the click of a button, a process of LC is invoked via webservice allows you to store the PDF file to the server. Y at - it a script by which the doc PDF itself could be converted into a bytestream and then sent to the Web service so that the PDF file can be rebuilt it?

    Thank you

    Muniyaraj

    You call a LiveCycle orchestration? If Yes, then you would define a string as an input parameter (make sure you so there is no time limit). Then when you call the function, the string contains the content encoded in base64 in your PDF. You must enter this in a document variable so in a setValue operation you can assign it to a VAR of document using this function:

    getDocFromBase64

    (java.lang.String)

    Paul

Maybe you are looking for

  • Satellite Pro A300 PSAJ5E - BIOS V3.90 - need full file name

    Hello Could you please tell me the original BIOS file name * V3.90* for Satellite Pro A300, short model No.: PSAJ5E for Vista x 64. A big thank you to you all,. Best regardsOperating system

  • Why my iPad password changed automatically?

    Hello. Recently, I changed my password iPhone 6 from 4 to 6 digits and today my iPad password also changed, but I have no change on the iPad, and now to activate touch ID I am required to enter a 6-digit code which I have created... I've tried that I

  • Computer will not update-It has 7 updates failed

    Original title : Will not update... When you stop it says 7 update...... each time so its not updated My computor says its not updated... I ran the fix - it and it still says I have 7 updates that failed...

  • How to remove a shortcut from the start menu

    HelloI have a problem with to unpin the shortcut on the start menu. When I click with the right button on the shortcut and select "Remove from this list", the shortcut is removed manually. But when I try to use the following script to remove the shor

  • LG Wireless adapter upward adjustment to work with the WRT54G Router

    My parents recently bought a TV high definition LG and they got a wireless adapter to LG for it (YEAR-WF100). My brother was able to insall, but when trying to connect to the router, we get an error message saying DHCP must be enabled. From what I se