Get Current File Location in ADOBE form

Hi All
I need to get the location and file name of current file upon http submit in the form.
How can we get current file location in abobe form.
I am trying to use JavaScript var path = window.location.pathname;
Also tried app.activeDocument.path property. But this does not work either.
Any inputs will be really helpful
Thanks
Kaushal

Hi Suhail,
You can query the runtime on this, and these are some examples on how to get this:
You will need to find the correct location:
select location_name
from all_rt_locations
where location_type = 'File System'
You will also need the path:
select PARAMETER_VALUE from ALL_RT_LOCATION_PARAMETERS
where location_name = 'SRC_FILES_LOC'
and PARAMETER_NAME = 'RootPath'
Do NOTE that the location type and RootPath things are case sensitive.
For the file name..., I think you will have to dig around in the mapping. I don't have an exact example but this is in the direction you will need to be looking if you want to select this from the repository:
-- This script selects all mappings, its operators and the binding to the repository objects
-- You can use this to assess the impact of a change to a repository object to your mappings
-- The script will ask for a parameter specifying the project name. Note that this is case sensitive
set pages 999
col PROJECT format a20
col MODULE format a20
col MAPPING format a25
col OPERATOR format a20
col OP_TYPE format a15
col REP_OBJECT format a30
select mod.project_name PROJECT
, map.information_system_name MODULE
, map.map_name MAPPING
, cmp.map_component_name OPERATOR
, cmp.operator_type OP_TYPE
, nvl(cmp.data_entity_name
, '-- No Value --'
) REP_OBJECT
from all_iv_xform_maps map
, all_iv_modules mod
, all_iv_xform_map_components cmp
where mod.information_system_id = map.information_system_id
and map.map_id = cmp.map_id
and mod.project_name = '&Project'
order by 1,2,3,4
Hope that this is something that you can take and solve your problem with...
JP

Similar Messages

  • Getting special character while saving adobe form from portal

    Hi All,
    I am getting Special character while saving adobe form. I am using webdynpro java application, in which I am using download file UI element.We are facing this issue after support packs were implemented in staging system.
    Kindly advise.
    Regards
    Shashwat

    Hi,
    We have ABAP system as backend system seperately and Single sign on is configured.
    when we access the portal with domain name line http://hostname.domain/52000/irj/portal, we are able to access the adobe form which is develope on abap system without any issue.
    but our issue started when we are trying to access portal only with hostname as http://hostname:52000/irj/portal
    we are able to login to portal but when we are trying to open the adobe form we are getting error
    No switch to HTTPS occurred, so it is not secure to send a password
    Since you have configured SSL, I assume that this configuration is done with fully qualified hotsname. Hence the certificate is generated based on this hostname.
    Now when you access your portal without typing fully qualified hostname, system is unable to locate a relevant certificate. Hence it lands up with a message "No switch to HTTPS occurred, so it is not secure to send a password"
    Hope this answers your query
    Regards,
    Deepak Kori

  • HI Iam trying to get into my account in Adobe Form Central and when i click on sign in..not working

    HI Iam trying to get into my account in Adobe Form Central and when i click on sign in...the screen shows " this page cannot be displayed" is there a problem with the site?

    I just found that Amazon web services does have a network issue with one of their instances that is affecting some regions around the east coast, this could be affecting your ability to sign into FormsCentral.  They will likely have that back up soon and assuming that could be the issue it should be fixed shortly.
    Thanks,
    Josh

  • Get current file of Photoshop.

    All I want to do is from with in photoshop (the user applescript folder) is run this script but rather than select a file, use the open file on photoshop and process (there maybe others open so it would need to get the current document and file name)
    Many Thanks
    Matt
    property type_list : {"8BPS"}
    property extension_list : {"psd"}
    script o
              property theseNames : {}
    end script
    set thefile to (choose file) as text --> the file path
    tell application "Finder" to set TheName to (name of file thefile) --> the name
    set the1stLetter to the first character of TheName --> the first letter
    set the2ndLetter to the second character of TheName --> the first letter
    set brandInitial to {the1stLetter, the2ndLetter} as text
    if brandInitial is equal to "BH" then ¬
              set brandName to "BRAND"
    if brandInitial is equal to "AL" then ¬
              set brandName to "BRand"
    set weekNumber to ""
    display dialog "Please enter the week number:" default answer weekNumber
    set weekNumber to text returned of result
    try
              if weekNumber = "" then error
              set theWeekNumber to theWeekNumber as number
    on error
              set thePrefix to "INVALID ENTRY! "
    end try
    --Folder location Setup
    set this_local_folder to "Images:2012-2013"
    set localWeekFolder to my getFolderPath("WK" & weekNumber, this_local_folder)
    set localBrandFolder to my getFolderPath(brandName, localWeekFolder)
    set localBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", localBrandFolder)
    set localBrandFolder_High_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_HR", localBrandFolder)
    set localBrandFolder_PSD to my getFolderPath(brandName & "_WK" & weekNumber & "_PSD", localBrandFolder)
    set this_Network_folder to "DCKGEN:Brands:Zoom:Brand - Zoom:Upload Photos:2013:"
    set networkWeekFolder to my getFolderPath("Week" & weekNumber, this_Network_folder)
    set networkBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", networkWeekFolder)
    --all files for website
    set website_images to "DCKGEN:Website_Images:"
    --set up names to destination folders and create over Network for FTP collection (based on a mounted drive)
    set this_ftp_folder to "Impulse:"
    set ftpWeekFolder to my getFolderPath("Week" & weekNumber, this_ftp_folder)
    set ftpBrandFolder to my getFolderPath(brandName, ftpWeekFolder)
    set ftpBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", ftpBrandFolder)
    set ftpBrandFolder_High_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_HR", ftpBrandFolder)
    --set theFolder to eachItem as string -- I think this is the line that could be causing the problem.
    --taking the folder identify which process it must follow.
    if brandName is equal to "BRAND" then
              tell application "Adobe Photoshop CS5.1"
      -- I remove the command activate, Photoshop stay in background
                        set ruler units of settings to pixel units
                        try
      open (alias thefile) showing dialogs never
                                  set origName to name of current document
                                  set myOptions to {class:JPEG save options, quality:12}
                                  set myPSDOptions to {class:Photoshop save options, embed color profile:true, save layers:true}
                                  tell current document
      --If the quick mask mode has been left on then delete the channel Quick Mask
                                            if (quick mask mode) then delete channel ¬
                                                      "Quick Mask"
      --If the Layer is incorrectly labeled with Original Layer it needs renaming to original Image
                                            if (exists layer "Original Layer") then ¬
                                                      tell layer "Original Layer" to set name to "Original Image"
      save in (localBrandFolder_PSD & origName) as Photoshop format with options myPSDOptions without copying
                                            (delete layer "Original Image") flatten
      resize image resolution 300 resample method none
      --sharpen image
      filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
      save in (localBrandFolder_High_Res & name) as JPEG with options myOptions without copying
      --get file path, return path of the JPEG file, work with (without copying)
      -- (with copying) : it return path of PSD file
                                            set newFile to file path --( return path of type alias )
      -- duplicate file using the Finder  -->on duplicateFile(..)
                                            my duplicateFile(newFile, {ftpBrandFolder_High_Res})
      --Prepare for Low RES by resetting image history
                                            set current history state to history state 3
      flatten
      resize image width 1348
      resize image resolution 300 resample method none
      filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
      --add save to lowResFolder with same options
      save in (localBrandFolder_Low_Res & name) as JPEG with options myOptions without copying
                                            set newFile to file path
                                            set newFile2 to newFile as string -- for testing end of name
                                            if newFile2 ends with "_2.jpg" or newFile2 ends with "_3.jpg" then -- exclude website_images
                                                      my duplicateFile(newFile, {networkBrandFolder_Low_Res, ftpBrandFolder_Low_Res})
                                            else
                                                      my duplicateFile(newFile, {networkBrandFolder_Low_Res, ftpBrandFolder_Low_Res, website_images})
                                            end if
      close saving no
                                  end tell
                        end try
              end tell
      --End BH
    end if
    --then the next etc.
    on duplicateFile(tFile, foldersPath) -- tFile is an alias, foldersPath is a list of folder
              tell application "Finder" to repeat with folderPath in foldersPath
                        with timeout of 200 seconds -- adjust it,  error if the copy  is longer that 200 seconds
      duplicate tFile to folder folderPath with replacing
                        end timeout
              end repeat
    end duplicateFile
    on getFolderPath(tName, folderPath)
              tell application "Finder" to tell folder folderPath
                        if not (exists folder tName) then
                                  return (make new folder at it with properties {name:tName}) as string
                        else
                                  return (folder tName) as string
                        end if
              end tell
    end getFolderPath

    Ok,  there is improvement, the script gets the path without error.
    Test this script in the editor., don't use your script.
    tell application "Adobe Photoshop CS5.1"
          set thefile to (file path of current document) --> get the file path (an alias)
    end tell
    set thefile to thefile as string
    tell application "Finder" to set TheName to (name of file thefile) --> the name
    set the1stLetter to the first character of TheName --> the first letter
    set the2ndLetter to the second character of TheName --> the first letter
    set brandInitial to {the1stLetter, the2ndLetter} as text
    if brandInitial is equal to "BH" then ¬
          set brandName to "BRAND"
    if brandInitial is equal to "AL" then ¬
          set brandName to "BRand"
    set weekNumber to ""
    display dialog "Please enter the week number:" default answer weekNumber
    set weekNumber to text returned of result
    try
          if weekNumber = "" then error
          set theWeekNumber to theWeekNumber as number
    on error
          set thePrefix to "INVALID ENTRY! "
    end try
    --Folder location Setup
    set this_local_folder to "Images:2012-2013"
    set localWeekFolder to my getFolderPath("WK" & weekNumber, this_local_folder)
    set localBrandFolder to my getFolderPath(brandName, localWeekFolder)
    set localBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", localBrandFolder)
    set localBrandFolder_High_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_HR", localBrandFolder)
    set localBrandFolder_PSD to my getFolderPath(brandName & "_WK" & weekNumber & "_PSD", localBrandFolder)
    set this_Network_folder to "DCKGEN:Brands:Zoom:Brand - Zoom:Upload Photos:2013:"
    set networkWeekFolder to my getFolderPath("Week" & weekNumber, this_Network_folder)
    set networkBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", networkWeekFolder)
    --all files for website
    set website_images to "DCKGEN:Website_Images:"
    --set up names to destination folders and create over Network for FTP collection (based on a mounted drive)
    set this_ftp_folder to "Impulse:"
    set ftpWeekFolder to my getFolderPath("Week" & weekNumber, this_ftp_folder)
    set ftpBrandFolder to my getFolderPath(brandName, ftpWeekFolder)
    set ftpBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", ftpBrandFolder)
    set ftpBrandFolder_High_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_HR", ftpBrandFolder)
    --set theFolder to eachItem as string -- I think this is the line that could be causing the problem.
    --taking the folder identify which process it must follow.
    if brandName is equal to "BRAND" then
          tell application "Adobe Photoshop CS2" --5.1"
                -- I remove the command activate, Photoshop stay in background
                set ruler units of settings to pixel units
                try
                      set myOptions to {class:JPEG save options, quality:12}
                      set myPSDOptions to {class:Photoshop save options, embed color profile:true, save layers:true}
                      tell (my getDocByPath(thefile))
                            set origName to name
                            --If the quick mask mode has been left on then delete the channel Quick Mask
                            if (quick mask mode) then delete channel ¬
                                  "Quick Mask"
                            --If the Layer is incorrectly labeled with Original Layer it needs renaming to original Image
                            if (exists layer "Original Layer") then ¬
                                  tell layer "Original Layer" to set name to "Original Image"
                            save in (localBrandFolder_PSD & origName) as Photoshop format with options myPSDOptions without copying
                            (delete layer "Original Image") flatten
                            resize image resolution 300 resample method none
                            --sharpen image
                            filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
                            save in (localBrandFolder_High_Res & name) as JPEG with options myOptions without copying
                            --get file path, return path of the JPEG file, work with (without copying)
                            -- (with copying) : it return path of PSD file
                            set newFile to file path --( return path of type alias )
                            -- duplicate file using the Finder  -->on duplicateFile(..)
                            my duplicateFile(newFile, {ftpBrandFolder_High_Res})
                            --Prepare for Low RES by resetting image history
                            set current history state to history state 3
                            flatten
                            resize image width 1348
                            resize image resolution 300 resample method none
                            filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
                            --add save to lowResFolder with same options
                            save in (localBrandFolder_Low_Res & name) as JPEG with options myOptions without copying
                       set newFile to file path --( return path of type alias )
                                                              set newFile2 to newFile as string -- for testing end of name
                            if newFile2 ends with "_2.jpg" or newFile2 ends with "_3.jpg" then -- exclude website_images
                                  my duplicateFile(newFile, {networkBrandFolder_Low_Res, ftpBrandFolder_Low_Res})
                            else
                                  my duplicateFile(newFile, {networkBrandFolder_Low_Res, ftpBrandFolder_Low_Res, website_images})
                            end if
                            close saving no
                      end tell
                end try
          end tell
          --End BH
    end if
    --then the next etc.
    on duplicateFile(tFile, foldersPath) -- tFile is an alias, foldersPath is a list of folder
          tell application "Finder" to repeat with folderPath in foldersPath
                with timeout of 200 seconds -- adjust it,  error if the copy  is longer that 200 seconds
                      duplicate tFile to folder folderPath with replacing
                end timeout
          end repeat
    end duplicateFile
    on getFolderPath(tName, folderPath)
          tell application "Finder" to tell folder folderPath
                if not (exists folder tName) then
                      return (make new folder at it with properties {name:tName}) as string
                else
                      return (folder tName) as string
                end if
          end tell
    end getFolderPath
    on getDocByPath(tFile)
          set f to tFile as alias
          tell application "Adobe Photoshop CS5.1"
                repeat with i in (get documents)
                      if file path of i is f then return contents of i --return the doc
                end repeat
          end tell
    end getDocByPath
    If there is an error, give me the selected text in the editor and the error
    Message was edited by: Jacques Rioux

  • Change in File Name of Adobe Form

    Hi Gurus,
                     I have a requirement..such that i had a text field in the Form.I need to get the text field value as file name,when iam saving the adobe form...is that posssible..???

    Hi Loris,
    its not possible to save the XMLFormsItem with a fixed name. Every time you are creating a new item, there is a unique id generated which is used as "real" item name.
    This mechanism avoids conflicts with other items stored in that folder.
    Regards
    --Matthias

  • Vb script to get fields name of SAP adobe forms

    hi
    is there any way to get and set fields of SAP adobe forms embedded in SAP portal

    I think when I tried to process each PC name from text file against registry key value, above code not working. As per my knowledge some issue in loop. Do I need to add FOR EACH feature? 
    Please help to correct it. Thanks in advance.
    Your code contains numerous errors. Furthermore you make things difficult for yourself by giving similar names to the objects used for your input and output. If you are a systems administrator then your best bet is to make an effort to learn the language
    instead of grabbing a few code fragments from here and there and hoping that somehow they will work.
    Try the cleaned up code below for this particular project. Note the consistent code indentation. It helps you enormously when trying to understand the structure of the code. Remember also that you must fully qualify all file paths. Writing to "Destination.txt"
    will cause endless confusion because you never know for sure where this file will reside.
     Const HKEY_CURRENT_USER = &H80000001
     Set oFSO = CreateObject("Scripting.FileSystemObject")
     sKeyPath = "Environment"
     sValueName = "LSFORCEHOST"
     sFile = "D:\Test.txt"
     If oFSO.FileExists(sFile) Then
       Set oInput = oFSO.OpenTextFile(sFile, 1)
       Do While Not oInput.AtEndOfStream
         sComputer = oInput.ReadLine
         If Trim(sComputer) <> "" Then
           Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _
             & sComputer & "\root\default:StdRegProv")
           oReg.GetStringValue HKEY_CURRENT_USER,sKeyPath,sValueName,sValue
           Set oOutput = oFSO.OpenTextFile("D:\destination.txt",8, True)
           oOutput.WriteLine sValue
           oOutput.Close
        End If
      Loop
      oInput.Close
    End If

  • How to create word file similar to adobe form in sfp Tcode?

    Hello guys,
    Is there any way to create ms-word file similar to the Adobe forms that we are creating in SFP?
    As I have been given one webdynpro application,the requirements are in webdynpro the word file should get display with data and this data shold also be editable in the word document.
    And also the data which are going to be display in the word file will be processed in the webdynproapplication as well.
    Is there any functionality to do this?
    If anyone knows then please tell me how can I do?

    thank you resolved

  • How to get current file position information in JAVA ?

    Hello,
    I would like to know if someone knows how to get and set current file position information in JAVA ?
    In C I use fgetpos and fsetpos.
    Thanks

    Instead of using a standard java.io.File, use java.io.RandomAccessFile
    This is a great class - you can get the file pointer (getFilePointer()), and set it (seek(long pos) )
    that will do all you need I presume - works the same a file handle in C.
    james

  • Drag and Drop or file attachment in Adobe Forms Central

    Is there a particular form or field type in Adobe Forms Central that would allow a user to "attach" or drag and drop a file to a form...say a blueprint?

    Hi,
    Yes. FormsCentral HTML forms support a File Attachment field. The following page provides an overview:
    https://www.acrobat.com/formscentral/en/library/attachments.html
    Regards,
    Brian

  • Get number of pages of adobe form before printing

    Dear Experts,
    I want to get number of pages adobe form will print before printing the form.
    Please suggest.

    Hello Sagar,
         Without executing the generated Function Module, it is not possible to get the page count of a form in driver program because the generated FM itself is responsible to execute the whole layout and determine the number of pages in the PDF output. The below screenshot shows the number of pages in the structure /1BCDWB/FORMOUTPUT of generated FM after the generated FM is executed successfully.
    I really don't know why you need the number of pages before calling the generated FM. But if you still need it, then you might need to call the whole FM cycle twice( FP_JOB_OPEN , Generated FM, and FP_JOB_CLOSE ).
    1) First time while calling the FM FP_JOB_OPEN, you need to modify the contents of SFPOUTPUTPARAMS structure. Send the blank values in fields GETPDF, REQNEW and REQIMM, and send the "X" in fields NOPREVIEW, NOPRINT and NOARCHIVE and 000 in field COPIES.
    The reason for doing this is, we do not want actual PDF output. We only want to determine the number of pages.
    2) Now execute the generated FM . You will get the number of pages in the structure /1BCDWB/FORMOUTPUT-PAGES as shown in screenshot above.
    3) Now call the FM FP_JOB_CLOSE as usual.
    4) Again call the FM FP_JOB_OPEN. This time you again need to modify the contents of SFPOUTPUTPARAMS structure reversely. Send the "X" in fields GETPDF, REQNEW and REQIMM, and send the blank values in fields NOPREVIEW, NOPRINT and NOARCHIVE and 001 in field COPIES.
    This time we need the actual PDF output.
    5) Now do the required processing with previously fetched number of pages before calling the generated FM.
    6) Now call the FM FP_JOB_CLOSE as usual.

  • Attach files to the adobe form : offline

    <u>Hi all,</u>
    <b>NW04S
    SPS8
    We have the above mentioned.</b>
    My requirement is to create an interactive form, that should have the ability to attach files offline. This means that the user of the form will have no access to the SAP system and should be able to attach supporting documents with the help of the adobe form itself, only.
    How can this be done?
    Is there any solution available to this or we still have to wait for forthcoming support packages?
    <u>Regards.</u>
    <i>Ali</i>

    In Web Dynpro for Java, this function will be available with SPS 10, on the ABAP side it will probably not be available before SPS 12.
    For SPS schedules of SAP NetWeaver, go to <a href="http://service.sap.com/ocs-schedules">http://service.sap.com/ocs-schedules</a> > Basis, ABA, R/3 Support Package Schedule
    Best regards,
    Markus Meisl
    SAP NetWeaver Product Management

  • Get PDF file from a Portal Form or Report

    Hello All and thanks for your help in advance.
    I am developing a portal application with a requirement to retrieve from our Oracle iFS document repository PDF a PDF file based on entered forms criteria or as a result from a return from a QBE report.
    Will someone please provide guidance on this. It would be most appreciated.

    Hi,
    There are a few options:
    You could have a button in the form with the following Javascript
    in the Click event have   app.openDoc("/c/temp/myDoc.pdf"); // check Acrobat Javascript reference for full options
    I think that there is a security issue with this method and therefore the PDF would need to be certified and the script run in a privileged context.
    OR
    You could include the static form on the last page(s) of your dynamic form. Set the presence of these page(s) to hidden in the Object / Field tab. Then within your dynamic form pages have a button "Show Static Form" with the following Javascript:
    in the mouseDown event have   form1.pSTATIC.presence = "visible"; //This will make the static page visible
    in the Click event have  xfa.host.currentPage = pSTATIC.thisPage.rawValue - 1; //This will jump the user to the static page
    Lastly you could have a print button on the static form page, which will only print that page. Place an invisible numericField (called thisPage) on the static page with the following Javascript:in the Layout: Ready event have   this.rawValue = xfa.layout.page(this); //This flags the page number of the static form, which may vary because of the dynamic nature of the form
    Then the print button would reference that page number, in the click event have:
    xfa.host.print(1,(thisPage.rawValue -1).toString(), (thisPage.rawValue -1).toString(), 0, 1, 0, 0, 0); //Prints static page only
    form1.pSTATIC.presence = "hidden"; //Automatically hides the static page after printing
    xfa.host.currentPage = "0"; //Jumps the user back to page 1
    I know the second option may appear more involved. But it does keep both the static and dynamic versions together in one PDF. Also if there are some fields that can be predetermined, then they can be filled in to the static form before printing (or they can be assigned to the corresponding fields in the dynamic form using the global binding).
    Good luck,
    Niall

  • Changing "x" location in adobe forms

    Hi, I am trying to move a textfield based on an event in adobe forms. I coded it as
    TextField1.x = TextField1.x + 20
    I guess "TextField1.x" returns a String and hence it pretty much concatenates the string and makes it like "92.5mm20". Need some help in understanding how to change the "x" property.
    Also, is it possible to include some graphics/animation using external javascript graphics libraries. It would be great if you guys could point me towards a page/tutorial that gives some infor in it? Thanks.

    It appears you have the text string "92.5mm" as the contents, value, of "testField1.x" and this value is a character string because there are characters that are not numeric, a sign, or deli meter. JavaScript is then assuming you are concatenating the contents with the value of "20". You need to either only enter a valid number into "TextField1.x" or strip out the non-numeric values. You may also need to use the 'Number()' constrictor.

  • Getting complete file path in Adobe Interactive Form

    Hi All,
    I have a requirement where I have a field ZPATH1 on Adobe Interactive Form. I am putting a BROWSE button and writing following JavaScript on CLICK event on this button for populating the chosen file path into field ZPATH1.
    *Start of JavaScript
    var sFile;
    event.target.importDataObject(sFile);
    var oFile;
    oFile = event.target.getDataObject(sFile);
    this.parent.parent.Sub_Form_Fields_Mass.ZPATH1.rawValue = oFile.path;
    *End of JavaScript
    1. event.target.importDataObject(sFile) --> Giving me the pop up to select the file.
    2. this.parent.parent.Sub_Form_Fields_Mass.ZPATH1.rawValue = oFile.path; --> Putting the oFile path in field ZPATH1 on the form.
    3. This way is only giving me the selected FILE NAME whereas I need the complete path.
    I have tried below way also:
    this.parent.parent.Sub_Form_Fields_Mass.ZPATH1.rawValue = even.target.path;
    This function returns me the complete path but in URL form. It does not give me the presentation server path.
    Please suggest me how to get the complete path of presentation server to the file.
    Appreciation would be honored in form of points!!!
    Regards,
    Ashish

    please post it here for quick response
    and also search in adobe forums also for java script related.
    http://www.adobe.com/support/forums/index.html

  • Saving documents via Scripts: Get current file name and set save path/file type

    I am writing a script that will:
    -Make all layers invisible
    -Make a layer named "background" visible
    -Delete all the invisible layers
    -Save the docment as an EPS file (leaving the original document untouched)
    I am new to scripts and so have based my script by copying code from other scripts.
    Here is my code:
    var doc = app.activeDocument;
    var name = doc.name;
    var hide = function (){ // hide all layers (based on http://forums.adobe.com/thread/644267)
         var L=doc.layers.length;
         for (j=0;j<L;j++){  doc.layers[j].visible=false; }
    hide();
    // loop through all layers
    for (var i = 0; i < doc.layers.length; i++) {
                  // Create the illusrtratorSaveOptions object to set the AI options
        var saveOpts = new IllustratorSaveOptions();
        // Setting IllustratorSaveOptions properties.
        saveOpts.embedLinkedFiles = true;
        saveOpts.fontSubsetThreshold = 0.0
        saveOpts.pdfCompatible = true
    //Set up Variable to access layer name
              var currentLayer = app.activeDocument.layers[i];
    // Loop through the layers and make the back ground layer visible
              if (currentLayer.name == "Background") {
                        docName = name + currentLayer.name+".eps";
                        currentLayer.visible = true;
    // Delete Invisible Layers (based on http://www.cartotalk.com/index.php?showtopic=7491)
    var myDoc=app.activeDocument;
    var layerCount=myDoc.layers.length;
    for (var ii = layerCount - 1; ii >= 0; ii--) {
        var currentLayer = myDoc.layers[ii];
        currentLayer.locked = false;
        var subCount = currentLayer.layers.length;
        for (var ss =subCount -1; ss >= 0; ss--){
            var subLayer = currentLayer.layers[ss];
            subLayer.locked = false;
            if (subLayer.visible == false){
                subLayer.visible = true;
                subLayer.remove();
        if (currentLayer.visible == false){
            currentLayer.visible = true;
            currentLayer.remove();
    // Save Out Document with New Name
    var saveName = new File ( doc.path + "/" + docName );
    doc.saveAs( saveName, saveOpts );
    Everything works fine except:
    1) It saves the document with the name AdobeIllustratorBackground as opposed to the name of the document
    Also, I am not sure how to tell the script to save as EPS and to specify the save location.
    Could some one give me some pointers?          Thanks!

    Thanks! I changed my code to this:
    var title = doc.name;
    var title = title.substring(0, title.length - 3);
    And it now works! (The substring thing removes the .ai extenion).
    However, how do I get it to save it as an EPS? (I found this script that  saves as PNG, but I am not sure how to adapt it to EPS).
    Also, how do I set the file output path?
    Thanks for any help that can be offered.

Maybe you are looking for