Reading variables from a text file into a flash projector exe

I am using Flash CS4 and my script is in ActionScript2.
I am developing a flash projector file that runs when a user puts in a cd to guide them through the steps they need to install a program and then kicks off the installer.
I use fscommand to run a utility that reads the users registry to determine the PCs regional settings and then writes this to a text file in the users %temp% directory.
I then use the LoadVariablesNum command to read in the text file and get the variables.
This was working fine when I had the text file stored in a different directory, but when I try and refer to the %temp% directory, I get an Error opening file message.
Is there anyway to get flash to look in the %Temp% directory?
Thanks in advance,
Carol Lutz

Code-tags sometimes cause wonders, I replaced # with *, as the code tags interprets # as comment, which looks odd:
******...*.........To your code: Did you test it step by step, to find out about what is read? You could either use a debugger (e.g., if you have an IDE) or system outs to get a clue. First thing to check would be, if the maze size is read correctly. Further, the following loops look odd:for(int i = 0; i < maze.length; i++) {
    for(int x = 0; x < maze.length; x++) {
        if (input.hasNextLine()) {
            String insert = input.nextLine();
            maze[x] = insert.charAt(x);
}Shouldn't the nextLine test and assignment be in the outer loop? And assignment be to each maze's inner array? Like so:for(int i = 0; i < maze.length; i++) {
    if (input.hasNextLine()) {
        String insert = input.nextLine();
        for(int x = 0; x < insert.size(); x++) {
            maze[i][x] = insert.charAt(x);
}Otherwise, only one character per line is read and storing a character actually should fail.

Similar Messages

  • Reading data from a text file into PAS - Dimension member names truncated

    Hi,
    I created a procedure to dump variables and data into a text file to load into another model. I used a semicolon as a field seperator.
    The data, measures and dimension members are dumped properly into a text file and no dimension member names are truncated .
    However when I read the data into  a measure, and I issue a peek command, dimension meber names are read in truncated
    and remain full names in the text file. Any reason for this? What do I need to do to prevent this from happening?
    THanks.
    Lungile

    Hi Lungile,
    The problem that you're likely having is that you haven't created a file description for the file from which you're reading.  When loading data into Application Server from a text file, you would normally go through three steps:
    1. Enter the ACCESS EXTERNAL subsystem
    2. Specify the name of the file to be read
    3. Specify the format of the file field names, types, widths, and positions.
    If you go into the Application Server help, select "Application Server Help", then "Application Server at the command level", then "Variables and reading in data", and then "Reading an external file", you will have the process of the steps you need to follow outlined for you, including links to the help topic for each command you need to issue.
    So what I think you need to do is use the DESCRIPTION command to specify the names of your fields, their type, and also their width, in order to ensure no truncation of data on the load.
    The same DESCRIPTION statement is required if you want to use your text file as the source of a dimension.
    Hope this helps,
    Robert

  • Reading characters from a text file into a multidimensional array?

    I have an array, maze[][] that is to be filled with characters from a text file. I've got most of the program worked out (i think) but can't test it because I am reading my file incorrectly. However, I'm running into major headaches with this part of the program.
    The text file looks like this: (It is meant to be a maze, 19 is the size of the maze(assumed to be square). is free space, # is block, s is start, x is finish)
    This didn't paste evenly, but thats not a big deal. Just giving an idea.
    19
    5..................
    And my constructor looks like follows, I've tried zillions of things with the input.hasNext() and hasNextLine() to no avail.
    Code:
    //Scanner to read file
    Scanner input = null;
    try{
    input = new Scanner(fileName);
    }catch(RuntimeException e) {
    System.err.println("Couldn't find the file");
    System.exit(0);
    //Set the size of the maze
    while(input.hasNextInt())
    size = input.nextInt();
    //Set Limits on coordinates
    Coordinates.setLimits(size);
    //Set the maze[][] array equal to this size
    maze = new char[size][size];
    //Fill the Array with maze values
    for(int i = 0; i < maze.length; i++)
    for(int x = 0; x < maze.length; x++)
    if(input.hasNextLine())
    String insert = input.nextLine();
    maze[i][x] = insert.charAt(x);
    Any advice would be loved =D

    Code-tags sometimes cause wonders, I replaced # with *, as the code tags interprets # as comment, which looks odd:
    ******...*.........To your code: Did you test it step by step, to find out about what is read? You could either use a debugger (e.g., if you have an IDE) or system outs to get a clue. First thing to check would be, if the maze size is read correctly. Further, the following loops look odd:for(int i = 0; i < maze.length; i++) {
        for(int x = 0; x < maze.length; x++) {
            if (input.hasNextLine()) {
                String insert = input.nextLine();
                maze[x] = insert.charAt(x);
    }Shouldn't the nextLine test and assignment be in the outer loop? And assignment be to each maze's inner array? Like so:for(int i = 0; i < maze.length; i++) {
        if (input.hasNextLine()) {
            String insert = input.nextLine();
            for(int x = 0; x < insert.size(); x++) {
                maze[i][x] = insert.charAt(x);
    }Otherwise, only one character per line is read and storing a character actually should fail.

  • How do you read data from a text file into a JTextArea?

    I'm working on a blogging program and I need to add data from a text file named messages.txt into a JTextArea named messages. How do I go about doing this?

    Student_Coder wrote:
    1) Read the file messages.txt into a String
    2) Initialize messages with the String as the textSwing text components are designed to use Unix-style linefeeds (\n) as line separators. If the text file happens to use a different style, like DOS's carriage-return+linefeed (\r\n), it needs to be converted. The read() method does that, and it saves the info about the line separator style in the Document so the write() method can re-convert it.
    lethalwire wrote:
    They have 2 different ways of importing documents in this link:
    http://java.sun.com/docs/books/tutorial/uiswing/components/editorpane.html
    Neither of those methods applies to JTextAreas.

  • Read words from a text file into an undefined array

    Dear all,
    Does anyone know how to read words in text file, seperated by all types of spaces ("_", "\n", "\t","\r","\f") and put them into a string array to be used later?
    So far I can read the words using the Tokenizer but can't assign to array:
    public class reader
    StringTokenizer tokenizer = new StringTokenizer(input);
    String[ ] array= null;  //unknown size of array
    int i=0;
                   while(tokenizer.hasMoreTokens())
                             array[i] = tokenizer.nextToken();
                             i++;
    Any suggestions welcome!
    thanks in advance!

    Hi
    sorry wrote in a hurry ;) din c the problem clearly
    there are two approaches
    1) best approach for your problem is Vector or ArrayList, these would make life easy for you.
    Always collections are better approach over arrays when the size is dynamic. However in your case the size cant be said to be DYNAMIC. coz the number of words will not grow / shrink during the runtime.. i know that number of words are not fixed but dynamic is something which will grow/shrink during runtime. but still collection is better approach.
    2)dirty approach
    use double dimensional array
    String arr[][] = null;
    then use one tokenizer for StringTokenizer(str,"\n");
    using countTokens on this will give you number of lines.
    use this to initialize array
    arr = new String[lineCount][];
    then iterate from 1 to lineCount and use 1 more tokenizer to get number of words for that line. use this number to initialize the column size for arr[i] like
    arr[i] = new String[wordCount];
    then store the token using nested for loops in this array
    go for the 1st one ;) 2nd one is hedious n time consuming but both will work ;)
    cheers
    amey

  • How to use as3 in flash cs3 to add dynamic text from a text file into a flash file

    let me start out by saying today is my first day of scripting
    in flash.
    I have a text file text.txt
    it contains
    text1=hello world
    can someone please show me how to display this text in a
    flash file
    i have been searching for this for hours and there are
    solutions with flash mx and actionscript 2.0 but i would like to
    see how to do this in as3.
    just a simple frame that loads that file and displays it when
    you test run the program
    much apreciated
    RC

    I'm not up on AS3 yet, but many things are still similar. You
    need to use the LoadVars class to accomplish this, You can find
    information this in Flahs Help>Actionscript>Actionscript
    Language Reference>Actionscript classes.
    rem: the text.txt file and the text.fla file must be in the
    same directory.
    The code will look something like this:

  • Reading data from a text file into a JTextField

    So I am writing a program that will write to and read from a large database. I was hoping to allow a graphical interface for the reading of the data, but I keep getting an error;
    Incompatible Types
    Found: java.lang.string
    Required: javax.swing.JTextField
    Now I know that this means the are incompatible (like trying to give an integer variable a string command) but I can't find any documentation on how to change the String into a JTextField format. I've found several references on how to do the reverse, but with my lack of JAVA knowledge I can't seem to get it to work. (Tried things like getText() and the like, but just end up with more errors).
    *On a side note, is there an easier way to go about reading a file line by line, with each line going into a seperate JTextField, than;
    BufferedReader r;
    try {
    r = new BufferedReader(new FileReader("C:\\temp\\test.txt"));
    while ((thisLine = r.readLine()) != null) {
    array[i] = thisLine;
    i = i + 1
    and then assigning each JTextField it's own array slot?*
    Thank you for your help.

    Try something like this for putting the text in a control:
    import java.awt.Dimension;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JTextArea;
    public class Junk{
      String[] s = {"This is String 1.", "This is String 2.", "This is String 3."};
      Junk(){
      public void makeIt(){
        JFrame j = new JFrame("Forum Junk");
        j.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        JPanel p = new JPanel();
        p.setPreferredSize(new Dimension(300, 200));
        JTextArea jt = new JTextArea();
        p.add(jt);
        j.add(p);
        jt.setText(s[0]);
        jt.append("\n\r"+s[1]);
        jt.append("\n\r"+s[2]);
        j.pack();
        j.setVisible(true);
      public static void main(String[] args) {
        Junk j = new Junk();
        j.makeIt();
    }Depending on your design you may be able to do away with your array and append the text directly to the JTextArray after each line is read.

  • Reading one line from a text file into an array

    i want to read one line from a text file into an array, and then the next line into a different array. both arays are type string...i have this:
    public static void readAndProcessData(FileInputStream stream){
         InputStreamReader iStrReader = new InputStreamReader (stream);
         BufferedReader reader = new BufferedReader (iStrReader);
         String line = "";          
         try{
         int i = 0;
              while (line != null){                 
                   names[i] = reader.readLine();
                   score[i] = reader.readLine();
                   line = reader.readLine();
                   i++;                
              }catch (IOException e){
              System.out.println("Error in file access");
    this section calls it:
    try{                         
         FileInputStream stream = new FileInputStream("ISU.txt");
              HighScore.readAndProcessData(stream);
              stream.close();
              names = HighScore.getNames();
              scores = HighScore.getScores();
         }catch(IOException e){
              System.out.println("Error in accessing file." + e.toString());
    it gives me an array index out of bounds error

    oh wait I see it when I looked at the original quote.
    They array you made called names or the other one is prob too small for the amount of names that you have in the file. Hence as I increases it eventually goes out of bounds of the array so you should probably resize the array if that happens.

  • At end of tether!  Reading in variables from a text file

    Hi all
    My stress factor has gone through the roof because I am trying to read in from a text file (you may have seen some earlir questions about ArrayLists) it's just not working!
    The code is below. The result is that it's reading in all of the car data, none of the motorbike and only the first line for the services. It's odd and it's driving me insane!
    Here's an example of the data it's reading. There are about 7-10 sets of data per type
    <car><reg>AB04CDE</reg><make>Ford</make><model>Fiesta</model><colour>blue</colour><passenger_no>4</passenger_no></car>
    <service><service_no>13570</service_no><reg>J605PLE</reg><date>15:07:2006</date><miles>20000</miles><part_replaced>brake_pads</part_replaced><part_replaced>front_tyres</part_replaced></service>
    <motorbike><reg>TT05EKJ</reg><make>Triumph</make><model>Speedmaster</model><colour>black</colour><load>20.50</load></motorbike>
    Here's the code
    while (moreToRead) {
            String line;
            try {
              line = fileReader.getNextStructure();
    // collect the data from the file
              if (line.indexOf("<car>")> -1){
                // Select/Extract the registration element
                int nStart = line.indexOf("<reg>");
                int nEnd = line.indexOf("</reg>");
                String reg = line.substring(nStart+5,nEnd);
                // Select/Extract the make element
                nStart = line.indexOf("<make>");
                nEnd = line.indexOf("</make>");
                String make = line.substring(nStart+6,nEnd);
                // Select/Extract the model element
                nStart = line.indexOf("<model>");
                nEnd = line.indexOf("</model>");
                String model = line.substring(nStart+7,nEnd);
                // Select/Extract the colour element
                nStart = line.indexOf("<colour>");
                nEnd = line.indexOf("</colour>");
                String colour = line.substring(nStart+8,nEnd);
                // Select/Extract the passenger_no element
                nStart = line.indexOf("<passenger_no>");
                nEnd = line.indexOf("</passenger_no>");
                String passenger_no = line.substring(nStart+14,nEnd);
                //convert string to int
                int passengerInt = Integer.parseInt(passenger_no);
                // declare new object car and assign the variables then add it to the array.
                Car c = new Car (reg, make, model, colour, passengerInt);
                carList.add(c);
      } else if (line.indexOf("<bike>")> -1) {
             // Select/Extract the registration element
             int nStart = line.indexOf("<reg>");
             int nEnd = line.indexOf("</reg>");
             String reg = line.substring(nStart+5,nEnd);
             // Select/Extract the make element
             nStart = line.indexOf("<make>");
             nEnd = line.indexOf("</make>");
             String make = line.substring(nStart+6,nEnd);
             // Select/Extract the model element
             nStart = line.indexOf("<model>");
             nEnd = line.indexOf("</model>");
             String model = line.substring(nStart+7,nEnd);
             // Select/Extract the colour element
             nStart = line.indexOf("<colour>");
             nEnd = line.indexOf("</colour>");
             String colour = line.substring(nStart+8,nEnd);
             // Select/Extract the load element
             nStart = line.indexOf("<load>");
             nEnd = line.indexOf("</load>");
             String load = line.substring(nStart+6,nEnd);
             //convert load string to double
             double bikeLoad = Double.parseDouble(load);
             // declare new object motorbike and assign the variables then add it to the array.
             Motorbike m = new Motorbike (reg, make, model, colour, bikeLoad);
             bikeList.add(m);
      } else  {
        // Select/Extract the service_number element
        int nStart = line.indexOf("<service_no>");
        int nEnd = line.indexOf("</service_no>");
        String service_no = line.substring(nStart+12,nEnd);
        console.println("service = " + service_no);
        nStart = line.indexOf("<reg>");
        nEnd = line.indexOf("</reg>");
        String reg = line.substring(nStart+5,nEnd);
        console.println("service = " + reg);
        nStart = line.indexOf("<date>");
        nEnd = line.indexOf("</date>");
        String date = line.substring(nStart+6,nEnd);
        console.println("service = " + date);
        nStart = line.indexOf("<miles>");
        nEnd = line.indexOf("</miles>");
        String miles = line.substring(nStart+7,nEnd);
        console.println("service = " + miles);
        nStart = line.indexOf("<part_replaced>");
        nEnd = line.indexOf("</part_replaced>");
        String part_replaced = line.substring(nStart+15,nEnd);
        console.println("service = " + part_replaced);
        //convert string to int
        int dateOfService = Integer.parseInt(date);
        //convert string to double
        double milesAtService = Double.parseDouble(miles);
        //convert service no to unique int
        int serviceNo = Integer.parseInt(service_no);
        // declare new object service and assign the variables then add it to the array.
        Service s = new Service (reg, part_replaced, serviceNo, dateOfService, milesAtService);
          serviceList.add(s);
          catch (Exception e) {
            // Run out of data
            moreToRead = false;
    } If anyone can spy anything that could be causing this I love your advice. I simply can't see it.
    Jo

    hi jos,
    we have been asked not to use a parser for this assignment. evil
    tutor i think! lolYour example seems to imply that all the <tag> ... </tag> pairs have
    to occur on a single line; if that is so, you can do some cheap
    programming like this:String getText(String line, String tag) {
       int start= line.indexOf("<"+tag+">");
       int end= line.indexOf("</"+tag+">", start);
       if (start < 0 || end < 0) return null; // no <tag> ... </tag> pair found
       // return the text in between the <tag> ... </tag> tags
       return line.substring(start+tag.length()+2, end);
    }kind regards,
    Jos

  • OMBPlus - TCL - reading variables out of text file

    Hello,
    i want to read out variables from a text file.
    For example to connect
    OMBCONNECT $login/$pass@$host:1522:$service
    and those 4 variables are in a text file.
    i'm a newbie, so it could be a stupid question
    thanks!

    I should point out that, if you are just using this for variable config then there is a far easier way to do this. Put the assignments in a separate .tcl file and then simply use the "source" command to read it. This becomes very handy as you start to build a library of functions that you will want to re-use across multiple scripts. Think of the command "source" to mean "copy that file and paste it into this one right here"
    For example, I have a config file and a library file.
    The config file might look like:
    #file config.tcl
    # GLOBAL VARIABLE DECLARATION SECTION
    #CORPORATE DESIGN REPOSITORY  CONNECTION INFORMATION
    # Login info for the design repository owner
    set OWB_DEG_USER    michael
    set OWB_DEG_PASS    mypassword
    set OWB_DEG_HOST    ourhost.company.net
    set OWB_DEG_PORT    1611
    set OWB_DEG_SRVC    orcl And a library file of functions called omb_library.tcl
    Now, in all my scripts it starts with:
    # File Some_Script.tcl
    #  Get Current Script name (excluding file extension), Directory and time
    set dtstmp     [ clock format [clock seconds] -format {%Y%m%d_%H%M}]
    set scrpt      [ file split [file root [info script]]]
    set scriptDir  [ file dirname [info script]]
    set scriptName [ lindex $scrpt [expr [llength $scrpt]-1]]
    #  Library and config file are in same directory as the script
    set cnfg_lib "$scriptDir/config.tcl"
    set owb_lib  "$scriptDir/omb_library.tcl"
    #  Import Library and config file
    #get config file
    source $cnfg_lib
    #get standard library
    source $owb_lib
    #  Create a subdirectory under the runnign directory, and create a log-file
    #   in that directory based on the script name and timestamp
    set LOG_PATH "$scriptDir/logs"
    file mkdir $LOG_PATH
    set    SPOOLFILE  ""
    append SPOOLFILE $LOG_PATH "/log_"  $scriptName "_" $dtstmp ".txt"With this block I eliminate the need to hardcode directories. As long as my config and library files are located with the script I can deploy them anywhere and they will get read and used.
    Cheers,
    Mike
    Edited by: zeppo on Mar 10, 2010 7:40 AM

  • Read data from a text file, one line at a time.

    I need to read data from a text file, and display each line in a String Indicator on Front Panel. It displays each line, but I get Error 4, End Of Line, unless I enter an extra line of data in the file that I don't need. I tried Read From Text File.vi, made by Nat Instr, and it gave the same error.

    The Read from Text File.vi reads data from a text file line by line until the user stops the VI manually with the Stop button on the front panel, or until an error (such as "Error 4, End of file") occurs. If an error occurs, the Simple Error Handler.vi pops up a dialog that tells you which error occurred.
    The Read from Text File.vi uses a while loop, but if you knew how many lines you wanted to read, you could replace the while loop with a for loop set to read that many lines from the file.
    If you need something more dynamic because the number of lines in your files vary, then you could change the code of the Read from Text File.vi to the expect "Error 4, End of file" and handle it appropriately. This would require unbundling the error cluster that comes fro
    m the Read File function with the Unbundle By Name function, so that you can expose the individual error "status" and error "code" values stored in the cluster. If the value of the error "code" is 4, then you can change the error "status" from true to false, and you can rebundle the cluster with the Bundle by Name function. Setting the error "status" to false instructs the Simple Error Handler to ignore the error. Otherwise, pass the original error cluster to the Simple Error Handler.vi, so that you can see what the error is.
    Of course, if you're not interested in what the errors are, you could just remove the Simple Error Handler.vi, but then you wouldn't see any error messages.
    Best of Luck,
    Dieter
    Dieter Schweiss
    Applications Engineer
    National Instruments

  • Need to read data from a text file

    I need to read data from a text file and create my own hash table out of it. I'm not allowed to use the built in Java class, so how would I go implementing my own reading method and hash table class?

    It's not possible to read from a file without using classes from the core API*. You'll have to get clarification from your instructor as to which classes are and are not allowed.
    [http://java.sun.com/docs/books/tutorial/essential/io/]
    *Unless you write a bunch of JNI code to replicate what the java.io classes are doing.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • SQL Loader-How to insert -ve & date values from flat text file into coloumn

    Question: How to insert -ve & date values from flat text file into coloumns in a table.
    Explanation: In the text file, the negative values are like -10201.30 or 15317.10- and the date values are as DDMMYYYY (like 10052001 for 10th May, 2002).
    How to load such values in columns of database using SQL Loader?
    Please guide.

    Question: How to insert -ve & date values from flat text file into coloumns in a table.
    Explanation: In the text file, the negative values are like -10201.30 or 15317.10- and the date values are as DDMMYYYY (like 10052001 for 10th May, 2002).
    How to load such values in columns of database using SQL Loader?
    Please guide. Try something like
    someDate    DATE 'DDMMYYYY'
    someNumber1      "TO_NUMBER ('s99999999.00')"
    someNumber2      "TO_NUMBER ('99999999.00s')"Good luck,
    Eric Kamradt

  • Reading from a text file into a 2D array

    How do you read from a text file and put it into a 2D array? Or if someone could guide me to where I can find the information?

    This tutorial shows how to read a file:
    http://java.sun.com/docs/books/tutorial/essential/io/scanfor.html
    This tutorial shows how to create arrays with multiple dimensions:
    http://java.sun.com/docs/books/tutorial/java/nutsandbolts/arrays.html

  • How to read some records from a text file into java(not all records)

    hello,
    how to read text files into java. i need only few records from the text file not all records at a time.
    If any one knows plz reply me
    my id is [email protected]

    this snipet reads a text file line by line from line 1 to 3
    try {
                  FileReader fr = new FileReader(directory);
                  BufferedReader br = new BufferedReader(fr);
                  int counter = 0;
                  while ((dbconn = br.readLine()) != null) {
                      switch(counter){
                          case 0:
                            status = dbconn;
                          break;
                          case 1:
                            userName = dbconn;
                          break;
                          case 2:
                            apword = dbconn;
                          break;
                      counter++;
                  br.close();
        }catch(IOException e){
        }

Maybe you are looking for

  • How can I regain 10.8.5 coloring of icon names?

    I've spent years organising files and folders visually based on colors--used against specifically chosen (contrasting) backgrounds. Within specific folders I had been using colors to group certain files, and by using different colors for different gr

  • Cannot resize CS2 objects, please help!

    Hello, I'm new to this forum, hopefully someone here can help me.  I have worked with every other version of Photoshop and have never had this issue.  I just installed (and updated) Photoshop CS2 for Windows.  When I attempt to do a simple resize of

  • Importing issues with Final Cut Pro X. Green flash and twitches while play back

    Hello, I'm having some importing issues with Final Cut Pro X and I can't find any solution whatsoever. Perhaps my importing settings are wrong? Anyways, I've done a lot of recordings on eye TV and HD PVR with some videos that are about 3 hours long.

  • Auto login?

    Is there anyway I can set up to automatically login in whenever I visit the forum. With most other forums I am given the option to add info to the keychain by Safari and then when I revisit the site, even after restarting, I am automatically logged i

  • Managing Two Libraries With Time Capsule

    Hi, I just got a Time Capsule and an iPhone. I already have an iPod. The space on my Hard Disk is running low - mainly due to a large iTunes music selection and large number of photos. My question is this. Is there any way for me to manage two librar