A basic question/problem with array element as undefined

Hello everybody,
thank you for looking at my problem. I'm very new to scripting and javaScript and I've encountered a strange problem. I'm always trying to solve all my problem myself, with documentation (it help to learn) or in the last instance with help of google. But in this case I am stuck. I'm sure its something very simple and elementary.
Here I have a code which simply loads a text file (txt), loads the content of the file in to a "var content". This text file contents a font family name, each name on a separate line, like:
Albertus
Antenna
Antique
Arial
Arimo
Avant
Barber1
Barber2
Barber3
Barber4
Birch
Blackoak ...etc
Now, I loop trough the content variable, extract each letter and add it to the "fontList[i]" array. If the character is a line break the fontList[i] array adds another element (i = i + 1); That's how I separate every single name into its own array element;
The problem which I am having is, when I loop trough the fontList array and $.writeln(fontList[i]) the result in the console is:
undefinedAlbertus
undefinedAntenna
undefinedAntique
undefinedArial ...etc.
I seriously don't get it, where the undefined is coming from? As far as I have tested each digit being added into the array element, I can't see anything out of ordinary.
Here is my code:
#target illustrator
var doc = app.documents.add();
//open file
var myFile = new File ("c:/ScriptFiles/installedFonts-Families.txt");
var openFile = myFile.open("r");
//check if open
if(openFile == true){
    $.writeln("The file has loaded")}
else {$.writeln("The file did not load, check the name or the path");}
//load the file content into a variable
var content = myFile.read();
myFile.close();
var ch;
var x = 0;
var fontList = [];
for (var i = 0; i < content.length; i++) {
    ch = content.charAt (i);
        if((ch) !== (String.fromCharCode(10))) {
            fontList[x] += ch;
        else {
            x ++;
for ( i = 0; i < fontList.length; i++) {
   $.writeln(fontList[i]);
doc.close (SaveOptions.DONOTSAVECHANGES);
Thank you for any help or explanation. If you have any advice on how to improve my practices or any hint, please feel free to say. Thank you

CarlosCantos wrote an amazing script a while back (2013) that may help you in your endeavor. Below is his code, I had nothing to do with this other then give him praise and I hope it doesn't offend him since it was pasted on the forums here.
This has helped me do something similar to what your doing.
Thanks again CarlosCanto
// script.name = fontList.jsx;
// script.description = creates a document and makes a list of all fonts seen by Illustrator;
// script.requirements = none; // runs on CS4 and newer;
// script.parent = CarlosCanto // 02/17/2013;
// script.elegant = false;
#target illustrator
var edgeSpacing = 10;
var columnSpacing = 195;
var docPreset = new DocumentPreset;
docPreset.width = 800;
docPreset.height = 600;
var idoc = documents.addDocument(DocumentColorSpace.CMYK, docPreset);
var x = edgeSpacing;
var yyy = (idoc.height - edgeSpacing);
var fontCount = textFonts.length;
var col = 1;
var ABcount = 1;
for(var i=0; i<fontCount; i++) {
    sFontName = textFonts[i].name;
    var itext = idoc.textFrames.add();
    itext.textRange.characterAttributes.size = 12;
    itext.contents = sFontName;
    //$.writeln(yyy);
    itext.top = yyy;
    itext.left = x;
    itext.textRange.characterAttributes.textFont = textFonts.getByName(textFonts[i].name);
    // check wether the text frame will go off the bottom edge of the document
    if( (yyy-=(itext.height)) <= 20 ) {
        yyy = (idoc.height - edgeSpacing);
        x += columnSpacing;
        col++;
        if (col>4) {
            var ab = idoc.artboards[ABcount-1].artboardRect;
            var abtop = ab[1];
            var ableft = ab[0];
            var abright = ab[2];
            var abbottom = ab[3];
            var ntop = abtop;
            var nleft = abright+edgeSpacing;
            var nbottom = abbottom;
            var nright = abright-ableft+nleft;
            var abRect = [nleft, ntop, nright, nbottom];
            var newAb = idoc.artboards.add(abRect);
            x = nleft+edgeSpacing;
            ABcount++;
            col=1;
    //else yyy-=(itext.height);

Similar Messages

  • Basic question - Problems with basic query - Mask = INSIDE

    Greetings,
    I'm doing a basic query on Oracle 10g Spatial, is to determine the intersection between two layers (one point called "Calidad1") and other polygons, called "Parishes")
    For issuing the following query based on the documentation of oracle:
    "select C1.ID, C1.SECUENCIA,
    P. COD_ENTIDAD, P. STATE
    Cod_county P., P. TOWNSHIP,
    P. COD_PARROQUIA, P. PARISH
    from CALIDAD1 c1,
    PARISHES p
    where sdo_relate (c1.geoloc, p.geoloc, 'mask = INSIDE querytype = WINDOW') = 'TRUE'
    order by C1.ID;
    When I run the query, no errors but extends too long (more than 10 minutes) and no end, I have to cancel.
    Canceling shows me the following error:
    "ORA-13268: error obtaining dimension from USER_SDO_GEOM_METADATA
    ORA-06512: at "MDSYS.MD", line 1723
    ORA-06512: at "MDSYS.MDERR", line 8
    ORA-06512: at "MDSYS.SDO_3GL", line 89 "
    This query is very basic and the data volume is small, a conclusion: I must be skipping a step or activity.
    Can you guide a little to resolve this situation and get the query that I need?
    Thanks to all

    First, try this query with the ordered hint and also note the change in the FROM clause.
    select /*+ ordered */ C1.ID, C1.SECUENCIA,
    P. COD_ENTIDAD, P. STATE
    Cod_county P., P. TOWNSHIP,
    P. COD_PARROQUIA, P. PARISH
    from PARISHES p,
    CALIDAD1 c1,
    where sdo_relate (c1.geoloc, p.geoloc, 'mask = INSIDE querytype = WINDOW') = 'TRUE'
    order by C1.ID;
    See if this is using the index as expected. If not try this:
    select /*+ ordered index(p name_of_the_spatial_index_on_the_PARISH_Table) */
    C1.ID, C1.SECUENCIA,
    P. COD_ENTIDAD, P. STATE
    Cod_county P., P. TOWNSHIP,
    P. COD_PARROQUIA, P. PARISH
    from PARISHES p,
    CALIDAD1 c1,
    where sdo_relate (c1.geoloc, p.geoloc, 'mask = INSIDE querytype = WINDOW') = 'TRUE'
    order by C1.ID;
    siva

  • Problem with Photoshop Elements Printing

    I have been using Photoshop Elements for a couple of years now and know it pretty well.  Today while attempting to print, a strange problem came up:  After going through the protocol to make a print, just before the image prints PE does a very fast auto correction that basically ruins all the color correction I have made on the image.  How do I disable this function?

    Hi and thanks for your reply. I checked the settings under "Print", "More Options", then "Color Management" and it only has "Print Space", none of the three options that you said I should have.  Am I looking in the wrong place?
    Date: Mon, 3 Sep 2012 11:14:57 -0600
    From: [email protected]
    To: [email protected]
    Subject: Problem with Photoshop Elements Printing
        Re: Problem with Photoshop Elements Printing
        created by 99jon in Photoshop Elements - View the full discussion
      Check your color management by clicking More Options in the print dialog There are basically three options:1) Printer Manages Color2) Elements Manages color3) No color Management Make sure everything is consistent e.g. if you choose Elements manages color make sure color management is switched off in the print driver. 
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/4669848#4669848
         To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/4669848#4669848. In the Actions box on the right, click the Stop Email Notifications link.
         Start a new discussion in Photoshop Elements by email or at Adobe Forums
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • Problem with premiere elements 4.0

    i am having
    problem
    with premiere elements 4.0. it keeps on crashing and when i put pictures on the timeline it comes up black. when i try to preview it either it shows black or sometimes the picture but i cant see it to delete if i wanted to. also it gave me a message something like that adbe is running low on memory and i should be caution

    This is aimed at Premiere Pro, but may help
    Work through all of the steps (ideas) listed at http://ppro.wikia.com/wiki/Troubleshooting
    If your problem isn't fixed after you follow all of the steps, report back with ALL OF THE DETAILS asked for in the FINALLY section, the questions at the end of the troubleshooting link... most especially the codec used... see Question 1

  • Problems with ps elements 10 on imac

    hi,
    i just downloaded the programm yesterday from the app store onto my imac. i want to use it as an extention to my aperture 3.
    I have the following questions/problems:
    + starting the programm takes at least 2 minutes, is this normal? I use an Imac Quadcore I7 with 12 gb onboard
    + the preferences: i can only extend the used memory up to 3gb, although i have 12 gb on board?
    + I can not store the preferences, when I shut the programm down, it tells me I do not have the legitimation to store the preferences?!
    + panorama foto work is mostly running out of memory?! 12gb on board
    Please can anybody help me?
    Thanks
    mikle

    No, it does not work on the other account. Problem is still/again the same. In the new account it works perfekt.
    Von meinem iPad gesendet
    Am 08.01.2012 um 22:16 schrieb "Barbara B." <[email protected]>:
    Re: problems with ps elements 10 on imac
    created by Barbara B. in Photoshop Elements - View the full discussion
    If it works in the new account it should hopefully work in your other account, so just log out of that one and go back to the old one and see if it does.
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/4125222#4125222
    To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/4125222#4125222. In the Actions box on the right, click the Stop Email Notifications link.
    Start a new discussion in Photoshop Elements by email or at Adobe Forums
    For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • Problem with installing Elements - from noob

    I have problems with installing Elements, it gives my an unknown mistake - I already have CS4 up and running, could this be the case?

    Chances are not very good that pse 4 will run on os x 10 6.8 unless you were upgrading from an earlier mac version that already had pse 4 installed.
    as per this:
    http://forums.adobe.com/message/4474236#4474236

  • Y have problems with Photoshop Elements 12  Bug after reinstallation complet  Impossible working ??

    Morning !
    We have many problems with PHOTOSHOP ELEMENTS 12 ?
    After installation on MAC OS X   YOSEMITE  .
    S O S !!

    Exporter vers photoshop do you receive any specific error messages?  In what way is Photoshop Elements 12 not working?

  • Problems with Photoshop Elements 11

    I have a problem with Photoshop Elements 11, which i bought last week. Installing was completed according the instructions. When I started to use the program my one year old HP-computer with Windows 8.1 informed that there a failure in the Photoshop program and the did not open.

    attach a screenshot of the error message.

  • JDeveloper Extension Problem with Navigator Elements

    Hi,
    I have a problem with the elements of the JDev Navigator.
    At IDE startup I want to set an overlay for the elements on the active project.
    This function is implemented in the Subversion Extension too.
    How can I access the elements of an active project in the navigator?
    It is not a problem to set an overlay with the ContextMenuListener.
    Thank you for your help.
    Greetings,
    Benjamin Oelenberg

    Please take a look at the Extension SDK sample projects. There is a sample that does exactly this.
    Install the Extension SDK from the Help --> Check for Updates dialog and after restart, say yes to installing the sample projects.

  • I recently upgraded our iMac to Yosemite OS and now have a problem with Photoshop Elements 11:  the move tool selects an image or text layer, but then I try to drag the selection somewhere else on the page and it snaps back to the original location, howev

    I recently upgraded our iMac to Yosemite OS and now have a problem with Photoshop Elements 11:  the move tool selects an image or text layer, but then I try to drag the selection somewhere else on the page and it snaps back to the original location, however the arrows will move it OK.  Also I cannot drag the selection to another photo in the photo bin as before.

    Hi,
    Please refer: http://helpx.adobe.com/photoshop-elements/kb/pse-stops-responding-yosemite.html
    Thanks,
    Anwesha

  • Problem with align element.

    Hi everybody,
    i have a problem with align element on my page. I explain:
    i have used into a panel page a panel group to align my element horizontal, but when i set the vertical-align on top, the element are align in middle.
    Now is......
    text text text text text text
    text text text text text text
    text text text text text text
    text text text text text text tablelayout
    text text text text text text
    text text text text text text
    text text text text text text
    But i wont........
    text text text text text text tablelayout
    text text text text text text
    text text text text text text
    text text text text text text
    text text text text text text
    text text text text text text
    text text text text text text
    Thanks.

    Have you tried using a panelHorizontal instead of a panelGroup?
    The components are automatically laid out horizontally and it has a Valign property that you can set to top.

  • [svn] 3216: Fix for MXMLG-228, a visibility problem with graphic elements.

    Revision: 3216
    Author: [email protected]
    Date: 2008-09-15 18:13:11 -0700 (Mon, 15 Sep 2008)
    Log Message:
    Fix for MXMLG-228, a visibility problem with graphic elements. This is a quick fix that may force extra display objects when toggling visibility. We should investigate alternate solutions if performance is a problem.
    Bugs: MXMLG-228
    Reviewer: Deepa
    QA: Please check for performance problems when toggling visibility of a large number of graphic elements.
    Ticket Links:
    http://bugs.adobe.com/jira/browse/MXMLG-228
    http://bugs.adobe.com/jira/browse/MXMLG-228
    Modified Paths:
    flex/sdk/trunk/frameworks/projects/flex4/src/flex/graphics/graphicsClasses/GraphicElement .as

    Hello Antonio;
    After many, many test I discovered that the problem, at least in my case it is caused by the new ACR 4.5. Please read the Thread that I post under Camera Raw. I include the link below.
    I also open two Bug Reports about this, but as usual Adobe (and other Software Companies) will never take responsability for this, until one day they release a new version with "enhancements".
    PSE6 Organizer Crash with ACR 4.5 (Vista Only?)
    http://www.adobeforums.com/webx/.3bb6a869.59b60d3e

  • I have elements 11 and I did the 30 day trial of elements 12. When the trial expired it caused problems with my elements 11. Nothing opens correctly, some not at all and I can't get help?

    Please help me. I am so disappointed in Adobe. I was planning on upgrading to 12 after the trial period but was unsure still. The problem I am having now is that my PSE 11 Organizer is off the grid. When I right click on a file and go to "open With", it only offers me the option to use Premiere Elements and not Photoshop. I found the .exe@ file for Photoshop Elements 11 and created a shortcut to my task bar in order to get to it. That won't work on my organizer though. Should I just uninstall and reinstall the whole thing? I'm on Windows 8.1. I refuse to upgrade to 12 after being refused any support considering it was the trial they encouraged me to try that caused my problem.If I have to reinstall everything with it impact the projects I've created?

    wesb
    What computer operating system is involved in the Premiere Elements 11 and 13 issues? Same computer or different ones? Are you installing from purchased download installation files or from purchased installation disc? Does Premiere Elements 11 work completely on this computer whereas 13 will not?
    Let us go through the typical drill so as to take nothing for granted.
    1. Does the problem exist with or without the antivirus and firewall(s) disabled? Are you working with an individual home computer or in a
    school or company network?
    2. Are you running the program as Administrator and is there any "domain" account involved?
    3. Is your video card/graphics card up to date according to the web site of the manufacturer of the card?
    4. Do you have the latest version of QuickTime installed on the computer with Premiere Elements?
    Let us start by ruling in or out any of the above, and then we can decide what next.
    Any questions or need clarification, please do not hesitate to ask.
    Thank you.
    ATR

  • Best way to iniitialize a queue with array elements

    Hi Guys
    I'm looking for a bit of performance optimization..  
    I'm developing a noise measurement application using LV8.6 and Win Xp /Win 7.
    To put it very simple I have a loop that samples, and a loop that does the math. data is shipped in a queue, producer / consumer style.
    So far so good.. Question is - is there a specific and more optimized way to declare this queue?
    I was wondering if declaring the queue with an initialized array element of a fixed size (the number of samples pr. read from the sound card will be known at runtime) would produce a queue that would be less heavy on dynamic allocation of memory compared to a queue obtained using a simple control no values.
    I've attached a screen dump to maybe make the question more obvious..
    I've been thru the "clear as mud" thread, as recommended in other threads that covers this topic - but i gets very high tech, and I kind of lost my way in it.. So looking for a more simple "you should use solution #x, because..."
    Thank you in advance. 
    Solved!
    Go to Solution.

    I believe (but am not sure) RT FIFOs will allocate this memory for you ahead of time. But, remember they are not deterministic on windows. You need to wire an array constant of the correct size into the FIFO read function also to avoid memory allocation, which is easy to overlook. It's worth looking into, if nothing else, assuming you have RT functions available. WIth this method, the queue size needs to be set, and you run the risk of overflowing and losing elements if not handled correctly. 
    Just throwing other options out there.
    CLA, LabVIEW Versions 2010-2013

  • Problems with Premier Elements 7 Opening Earlier Projects

    I have used Premier Elements 3 to create many 15-60 minute videos, most built from Photoshop Elements slide shows imported into Premier, and most with DVD output designed. After installing Version 7, I attempted to open these projects which it is supposed to do. A minority will open fine. The balance either cause the error "The project cannot be loaded - it may be damaged or contain outdated elements".
    Does anyone else have these types of problems? I have tried all of the various methods outlined in the KB, like deleting preferences, etc., removing and re-installing, booting with nothing else loaded, etc. Nothing has any impact. I have talked to Adobe support and they are clueless and just walk me through the usual install/uninstall, etc. can anyone help? I have an enormous investment in time in these 3.0 videos and I bought Version 7 to upgrade and now it does not work! Thanks.

    Just a thought....
    How are you opening the Premiere Elements 3 project in Premiere Elements 7?
    According to the Adobe party line Premiere Elements 7 PDF, you can open projects created in earlier versions of Premiere Elements in Premiere Elements 7, but you cannot open projects created in Premiere Elements 7 in earlier versions.
    Do you have Premiere Elements 3 and 7 on the same computer at this time?
    The Adobe suggestions is, if problems in this regard and instead of right clicking the project file in its saved location, then:
    1. open the project from with Premiere Elements 7
    or
    2. right click the project file in its saved location and name Premiere Elements 7 as the Open With program
    Check it out to see if I have interpreted this info correctly
    http://help.adobe.com/en_US/PremiereElements/7.0/WSB51FF526-3E14-430c-B388-FD0B747547E9.ht ml

Maybe you are looking for

  • ITunes could not copy "" to the iPhone "" because an unknown error occorred (-50).

    This is a very annoying problem. I've followed everything by the books and cannot figure it out. I'm getting the warning     iTunes could not copy "[Song Name]" to the iPhone "[Phone Name]" because an unknown error occorred (-50)   and don't know wha

  • Problem with BAPI_DOCUMENT_CREATE2

    HI, I am creating document using  FM BAPI_DOCUMENT_CREATE2. In IDES, i am able to create with new status. But i am getting an error message as 'The status set requires a previous status'. What could be the problem? is it due to the additional pacthes

  • Formatting portable HD to be used by Mac & PC

    Hello, hope someone may be able to help me. I am a photographer and I need to load up an external portable lacie hard drive with photos (tiffs and jpegs) from my Mac Intel (Snow Leopard). The client has to be able to download them all onto his PC. I

  • Calendar Plug-in

    Hi, I want to use the calendar plug-in from this website http://www.jqueryscript.net/time-clock/jQuery-Ajax-enabled-Month-Calendar-Plugin-with-Boot strap-Zabuto-Calendar.html I have downloaded the plug-in and followed the instructions...but i didn't

  • Problems with mount and unmount of network shares

    Hi, I use an Apple script to mount four network shares during startup of an OS 10.4.4 Powerbook. Unfortunately it seems that Tiger can't always mount them all. Sometimes it only mounts three of them, but pressing Command + K indicates that the fourth