How can I get a file path element in XML to work in AI javascript?

Hi all - this is my first post. I'm pretty familiar with javascript, but I'm new to the Adobe scripting environment.
Our client wants Illustrator at startup to load a certain pattern swatch. It works fine when I hard code the pattern file path, but it needs to be user configurable, so I put the file path info in an XML file to be read in at startup. The XML file is read in and the elements are extracted into varibles. When I concatenate the variables to create the file path string and try to open the pattern file, it says file not found.
Here is my source code:
var fileObj = new File("aiConfig.xml");
fileObj.open("r:");
var xmlString = new XML(fileObj.read());
var driveLetter = xmlString.fullPathName.driveLetter.text();
var filePath = xmlString.fullPathName.filePath.text();
var fileName = xmlString.fullPathName.fileName.text();
var fullFilePath = driveLetter + filePath + fileName;
var styled_ai = app.open(new File(fullFilePath));
app.activeDocument = styled_ai;
Here is aiConfig.xml:
<?xml version="1.0" encoding="windows-1252" ?>
<aiConfig>
  <fullPathName>
     <driveLetter>C:</driveLetter>
     <filePath>/Program Files/Adobe/Adobe Illustrator CS4/Presets/en_US/Swatches/Patterns/Decorative/</filePath>
     <fileName>Decorative_Modern.ai</fileName>
    </fullPathName>
</aiConfig>
Any help would be greatly appreciated - this is driving me a little crazy.
Thanks,
Tom

Hi Tomchag,
Your script works fine on MAC OS X & illustrator CS4.
i have change only pathway to aiConfig.xml like this:
var fileObj = new File("/Volumes/LaCie/aiConfig.xml"); //<- path of my external HDD should be D:/ on windows
and the contents in aiConfig.xml to :
<?xml version="1.0" encoding="windows-1252" ?>
<aiConfig>
  <fullPathName>
     <driveLetter></driveLetter>
     <filePath>/Applications/Adobe Illustrator CS4/Presets.localized/fr_FR/Nuancier/</filePath>
     <fileName>VisiBone2.ai</fileName>
    </fullPathName>
</aiConfig>
So.. i notice twice thing:
1) complete file and path for aiConfig.xml
2) i didn't use drive letter (but it's specific to windows)
I hope this post can help you
Cyao, art.chrome

Similar Messages

  • How can I get the file path which located on webapps/MY_APPS ?

    Hi,
    I use tomcat as our servlet container.OS is win2k srv
    my project was put on x:\tomcat\webapps\MY_APPS
    and I could use getServletContext().getRealPath("/") within a servlet to get x:\tomcat\webapps\ROOT\MY_APPS,
      public void doPost(HttpServletRequest request,
                         HttpServletResponse response)
        throws ServletException, IOException
           String myAppsPath = getServletContext().getRealPath("/");
      }but I could not utilize this method within a normal help class
    any suggestion will be welcome.
    thanks in advance.

    try this:
    package com.sample;
    import java.io.File;
    public class SampleClass
      public SampleClass()
       * @param args
      public static void main(String[] args)
        SampleClass sampleClass = new SampleClass();
        File f = new File("SampleClass.class");
        System.out.println(f.getAbsolutePath());
    }

  • How can I get the File, Edit, View, Windows ect to show in Organiser

    While on various tutorials they all show a
    menu of file, edid, view ect in the top left hand corner of the screen, mine shows only a small square box that when clicked give you the option of restore, close minimise ect. How can I get the file edit menu to show. Should have said in Photoshop Elements 9.

    Thanks Barbara that's done the trick

  • How can I get a file to copy all of the files in a directory except itself and the source of the copy function will be the directory the final program is in?

    How can I get a file to copy all of the files in a directory except itself and the source of the copy function will be the directory the final program is in? This application must be in Lab View 8.

    you mean something like this (see below)?
    Now you may have to implement code to check if the destination folder exists and to create it, etc.  But if you use the Front Panel Control to select the destination folder, it should be okay.
    Not the best implementation, mind you but you'll get the idea..
    Message Edited by JoeLabView on 04-18-2007 03:43 PM
    Attachments:
    copy folder contents.PNG ‏10 KB

  • How can I get my files in my ipad 3(using keynotes) to my PC?

    I store my document in my keynote and I want to get it through my PC. How can I get those files?

    Download and Install the Windows Support Software (1st task in Boot Camp).

  • How can i get a file header using this method cl_gui_frontend_services= gui

    Hi Experts,
    How can i get a file header using this method cl_gui_frontend_services=>gui_download
    Thanks
    Basu

    Hi,
    You can use the FM - GUI_DOWNLOAD to specify the headers. It can be done in the following manner -
    TYPES: BEGIN OF ty_head, "Structure for header
                 h(10) TYPE c,
                 END OF ty_head.
    DATA: it_head  TYPE TABLE OF ty_head WITH HEADER LINE.
    "Adding header details
    it_head-h = 'Field1'.
    APPEND it_head.
    it_head-h = 'Field2'.
    APPEND it_head.
    it_head-h = 'Field3'.
    APPEND it_head.
    it_head-h = 'Field4'.
    APPEND it_head.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename                        = p_file
       filetype                        = 'ASC'
       write_field_separator           = 'X'
       header                          = '00'  "<= note this
      TABLES
        data_tab                        = it_tab
       fieldnames                      = it_head[] "<= Pass your header table here
    EXCEPTIONS
       OTHERS                          = 1.
    Hope this helps.
    Regards,
    Himanshu

  • I bought a mac air retina to replace a mac pro. How can I get all files of the back up and copy them to the new mac?

    I bought a mac air retina to replace a mac pro. How can I get all files of the back up and copy them to the new mac?

    Mail window may be in the Full Screen mode.
    Move the mouse pointer to the top right corner of the Mail window and hold it there.
    Menu bar should drop down and click the blue double arrow icon.
    Full Screen toggle shortcut:  control + command + F

  • How can i call this file path into my bsp-html  to display the images?

    Hi
    I have a file path for an image like c:/test_logo.bmp.
    How can i call this file path into my bsp-html  to display the images?
    moosa

    Try this...
    Can i have  sample code in BSP-HTML to display images?

  • How can i open neff files in elements 12

    how can i open neff files in elements 12

    http://helpx.adobe.com/creative-suite/kb/camera-raw-plug-supported-cameras.html
    http://helpx.adobe.com/x-productkb/global/camera-raw-compatible-applications.html
    Chances are you are simply using a brandnew camera and it isn't supported in any version of ACR yet.
    Mylenium

  • How can i get the file on my old PC Laptop to my iMac, how can i get the file on my old PC Laptop to my iMac

    how can I get the files on my old PC Laptop to my Imac

    If you want all of them, see OS X Lion: About Windows Migration Assistant

  • How Do I get a File Path from a FileName?

    Hi there,
    I was wondering how do i get a file path(i.e) directory only from a file name.
    Say i got a file called "C:\Test.txt" is there a method in java that will allow me to only get "C:\"?
    I've tried getPath(), getAbsolutePath() and they all return the directory and the file itself.
    Please Help
    James

    String path = file.getPath();
    String name = file.getName();
    int i=0;
    for(i=0; i< (path.length()-name.lenth() ); i++){
    String temp = path.substring(i, i+name.length());
    if(temp.equals(name) break;
    return path.substring(0,i);

  • How can you get video files to play properly from a Fujifilm X20

    How can I get movie files  from my Fujifilm X20 to play properly in imovie?

    OS (windows Xp) will not let me.
    Why will it not?  What is the error message?  How are you trying to transfer them?
    There are lots of ways of moving files.
    A simple and popular way to copy files and share files amoung your devices. This will depend on you internet connection speed.
    https://www.dropbox.com/
    Using iTures to transfer files:
    http://support.apple.com/kb/HT4094?viewlocale=en_US&locale=en_US
    Files Connect -- The swiss army knife of remote file connect
    https://itunes.apple.com/us/app/files-connect/id404324302?mt=8
    Windows File server
    http://itunes.apple.com/us/app/filebrowser-access-files-on/id364738545?mt=8
    "In education and business users increasingly expect to be able to access their data anytime, anywhere and from any device."
    http://www.minnow.it/
    This thread has good info.
    https://discussions.apple.com/thread/3708341?tstart=0
    How to transfer files from your iPad to your PC with iPad to Computer Transfer
    http://www.iphone-mac.com/how-to-transfer-and-sync-contents-from-ipad-to-pc.html
    Try the combo of:
    Diskaid on your computer and FileAppPro on your iPad
    Good old FTP
    FileApp and FileApp Pro

  • I always have trouble with my mailbox. It is always asking for my passwords but everything has been verified. How can I get it to stop doing it and start working????

    I always have trouble with my mailbox. It is always asking for my passwords but everything has been verified. How can I get it to stop doing it and start working????

    There is only one thing that happens -- the Server does not respond.
    Your mac concludes that you must have entered the wrong password. That may happen once, but then other issues become more likely, and it keeps asking for a new password.
    Sometimes the Server is down for maintenance. Sometimes something is configured wrong. Some services do this on purpose to get you to use WebMail (pick up your Mail with your Browser) so they can show you some ads.

  • I have MAC OS X 10.6.8 (up-to-date). How can I get screen mirroring to my Apple TV to work?  The icon does not appear at top status bar..

    I have MAC OS X 10.6.8 (up-to-date). How can I get screen mirroring to my Apple TV to work?  The icon does not appear at top status bar..

    Welcome to the Apple Support Communities
    See > http://support.apple.com/kb/HT5404 AirPlay Mirroring is compatible with Mid 2011 and newer MacBooks Air, and OS X Mountain Lion.
    As you have Mac OS X Snow Leopard, you haven't got a compatible MacBook Air, so you can't use AirPlay Mirroring. However, you can use a third-party app as AirParrot to mirror the MacBook onto your Apple TV > http://www.airparrot.com

  • How can you get the keypad on a USB keyboard to work in Excel

    How can you get the keypad on a USB keyboard to work in Excel for Mac.  Mouse keys is disabled/unchecked, but cannot get it to work.  Even tried downloading a 'num lock' app and it didn't help.

    Hi Michael-
    I do not have any problem with using shift registers in timed loops.  What version of LabVIEW are you using?  Can you please elaborate on why neither shift registers or local variables meet your needs?  I have attached a VI that saves a previous iteration and then computes and displays the difference.  Let me know if you have problems running it.
    Thanks-
    Tom W
    National Instruments
    Attachments:
    TimedLoop_ShiftReg.vi ‏74 KB

Maybe you are looking for

  • Web-building my site. FIREFOX and NAVIGATOR is great but not SAFARI. Why?

    Hi, I am building my web site http://www.philthesecurityguard.com/ everything works great on FIREFOX and NAVIGATOR but not SAFARI. Example: on my web site, I click on REAL LETTERS in SAFARI and HALF of orange squares appears outside of my letters. FI

  • How to store Video file in Oracle9i database

    Hi I am working on Oracle9i Database. I am using Oracle9i Forms Developer for front end side. I want to Store a video file in a database table. I know that there are some data types like BLOB which support such activities but actually i dont know the

  • Regenrate STACK XML  for EHP5

    Hello Guys! I have issue here, there is difference file loaded while i regenrate the XML with addtional technical usage. How will i knows which files are added today while i regenrate the XML, so that i can download those files instead of downloading

  • Will you be offering Firefox for the Blackberry OS soon?

    I LOVE Firefox and refuse to use anything but...except when I"m on my phone and tablet because I have Blackberry devices. So, please don't tell me you're not planning on a BB version!! BB's may not be the most popular, trendy, hipster thing out there

  • Change the sequence of the tabs

    Experts, I would like to know if there is a way to change the sequence of the tabs. For example, under the Projects' area I can see the tabs in the following sequence:     -    Header, Schedule, Suppliers, Forms, Costs, Accounting. Is it possible to