OMBPlus - TCL - reading variables out of text file
HelloI want to read a text file variables.
For example to connect
OMBCONNECT $login/$pass@$host:1522:$service
and these 4 variables in a text file.
I'm a newbie, so this might be a stupid question
Thank you!
use
OMBCC ' / / $i / / $I
It's the double slash
Published by: Katia on March 10, 2010 09:17
Published by: Katia on March 10, 2010 09:21
Tags: Business Intelligence
Similar Questions
-
Problem with loading Variables from a text file
Hello
I'm quite a novice when it comes to scripts and I am struggling to achieve something quite simple. I want to have an external text file that will allow me to control the number of timeout that I reference in my code below. I need to be able to change this variable by editing a simple text file.
var myTimer:Timer = new Timer(60000,1);
I want to change the 60000 and 1.
I followed what looks like a nice clean approach to this tutorial: http://www.designscripting.com/2012/01/as3-flash-loading-variables-from-a-text-file/
However, when I'm stuck is how to reference my variable imported into the code. I tried 'name1' but it does not work. I get ' 1067: Implicit coercion of a value of a numeric type to a type unrelated string.' error '
I'm an output:
HTTP status = 0
Data loaded
Name1: undefined
{name2: 1}
http://screencast.com/t/gwD09jovIrb4
I use CS5 and AS3.
Thank you
Dan
I see nothing wrong with what you show, and when I try I get the following output...
HTTP status = 0
Data loaded
Name1: 6000
name2: 1
The only thing I suspect for the moment is the data file itself. I can reproduce the problem if I insert white space before this string, then make sure that the text string is not preceded by anything whatsoever.
-
Dumping Variables in the text file, separate from the TS report
Hi all
I know that I can probably do this in TestStand using LabView, however, which is not a luxury that I have.
What I'm trying to do is, when a failure occurs, empty a specific set of information in a separate (probably text file) log file share the standard test report. For example, I could be followed by some tampons or test State of the equipment in stationglobals, when a test fails, I want to empty the part of the overall station in a different newspaper, once again, apart from test report, is it possible?
Looks like the closest thing to research through TS and the support forums, I found is to use ActiveX calls to maybe MS Word or Excel and generate something there? I was expecting something a little simpler?
Kind regards
Mike
Hi Mike,.
Try this:
Write, method
Syntax
PropertyObject. Write (pathchaine, objectName, RWoptions)
Goal
Writes the content of an object in the file specified by pathchaine and associate it with the name specified by ObjectName with the object in the file.
Remarks
If you call this method on an object alias, TestStand generates the stream using the object to which the alias refers. This method does not include the Subproperty alias objects in the stream. See IsAliasObject for more information on the alias objects.
Parameters
pathchaine String
[In] Pass the path of the file to which to write the data of the object.
objectName String
[In] Pass the name to associate with the object.
RWoptions Both
[In] Pass 0 to specify the default behavior, or pass one or more constants of ReadWriteOptions . Use the bitwise OR operator to specify multiple read/write options.
For example, to make a statement in a sequence with local variables, and run:
Locals.Write (C:\\temp\\Locals.txt","Locals",0" ")
This will generate a text file containing the values of the local variables. You can use it on any object, but you will probably need to ask with the options to get what you want.
I hope this helps.
-Jack
-
How I got out a text file to the word?
I hear the voices in the Panel. I don't know how to run the text file for the engine. What (where?) is the command to make it work?
Hello
Check out the following link.
Hear text read aloud with Narrator
http://Windows.Microsoft.com/en-us/Windows7/hear-text-read-aloud-with-Narrator
-
Hi, until now, I used the default encoding for reading and writing text files, but I discovered it causes question marks trying to read or write the non-English characters, so I'm trying to change my code to use:
inputstramreader and OutputStreamWriter inputreader and outputwriter, I have used before.
However, I discovered the onlyworks linereader with InputStreamand not with inputstreamreader.
also bufferedread is not available in api.
It looks something like this:
View linereader takes inputstream and not inputstreamreader.
fc = (FileConnection) Connector.open(targetFolder + "file.txt", Connector.READ_WRITE); InputStream is = fc.openInputStream(); InputStreamReader reader = new InputStreamReader(is, "UTF-8"); String line = null; LineReader lineReader = new LineReader(is); try { lineReader.readLine(); // skip header line line = new String(lineReader.readLine()); // get line from file }
so the question is, I have to manually write a function to read a line in the file? or is it an another workaround?
You need to specify the encoding of the byte array and do not rely on the default encoding when you create a string to a byte array.
Use this:
line = new String(lineReader.readLine(), "UTF-8"));
-
Read/write to DB text file
Hello
What is the effective way of reading the text file and write to the DB table.
Forms Builder (10.2.0.3.0) - version
DB 10 g 2
Rgds
sexyHello
TEXT_IO is a software package, integrated forms. Webutil has too (but it's CLIENT_TEXT_IO, which can be read from the client computer), in which, plain TEXT_IO reads the file from the server computer.
As I said before, it depends on the number of records / size of the file. If he records little (say a few hundred), then you can go for TEXT_IO. However, if the size of the file is very high / you have more records (say thousands / millions), then SQL Loader is the best bet.
If you are worried about the performance (i.e. If you have more records to be inserted), you can create a batch script (which loads the data into tables using SQL Loader) and call the command script using the HOST of shapes command.
You can see the SQL Loader manual (which I gave the link before), for orders / check the syntax of the file etc and create a command script. Probably, if you're looking for the PL/SQL forum / forum SQL Loader, you will get more ideas and samples.
HTH.
Arun-
-
load the e-mail address variable of the text file anyone?
I have the code below, attached to a movieclip that I try to use to call for an email address of a text file. The idea is that the text file can be changed by a luddite, and the recipient's email address has changed in the flash file... but I do not too well...!
The best I've done is undefined e-mail or garbage.
any help gratefully received. Thank you.
___________________________________
on {(overview)
this.gotoAndPlay (2);
}
on (release) {}
loadText = function() {}
loadText = new LoadVars();
loadText.load ("email.txt");
loadText.onLoad = function() {}
emailAddress = this.eAddress;
}
}
submit.onRelease = function() {}
getURL("mailto:"+emailAddress);
}
}
on {(deployment)
this.gotoAndPlay (1);
Do not leave space before and after "=" symbol
Here's the Simple function loading -
Hi, using Cp 8.01.
I would like to read the textual data to a text or XML file into a variable in order to display a message (using a form) on my project of Cp can I do this without using Javascript?
Thank you.
You need JS.
-
How to read and write a text file to the folder of the user preferences?
I'm trying to code for the user to record the plug-in, the first time that the user opens Acrobat after you have installed the plug-in. I want to write a file of registration of preference of the user folder access later to check that they are already registered.
Is there an easy way to do this? I wrote the code to access the preference of the user folder to search for the file, but I have not been able to code for the write file. All I've found is how to write a PDF file.
Any suggestions?
Gregory
ASFileRead/ASFileWrite
-
Reading data from a text (JS CS3) file tabs-delimited
Hi - I'm working on a script to read data from a text file and use in a dialog box. But I hit a wall.
I used a script from a previous post that defines a variable text document when the user script he chooses from a drop-down list.
var myDialog = app.dialogs.add({name:"Map",canCancel:true});)
{with (MyDialog)}{with (dialogColumns.Add ())}
{with (borderPanels.Add ())}
staticTexts.add ({staticLabel: "choose the location :"});})
{with (dialogColumns.Add ())}
var file = File("~/Desktop/myPlacesfile.txt");leader. Open ("r");
var str = file.read ();
leader. Close();
var myPlaceList = str.split (/ [\r\n] + /);
var myPlaceMenu = dropdowns.add ({stringList:myPlaceList, selectedIndex:0});})
}
}}}
Ditto var = myDialog.show ();
if(myResult == true) {}
If (myPlaceMenu.selectedIndex == 0) {}
myPlace var = ' - undefined ";
} else {}
myPlace var = myPlaceList [myPlaceMenu.selectedIndex];
Alert (myPlace);
}myDialog.destroy ();
}That's what I do now:
The text file is in this format:
Value1 value2 [TAB]
Value1 value2 [TAB]
Value1 value2 [TAB]
I need to have the drop down dialog box show only the value 1, and after that the user selects, the script returns only the value 2. (The alert is just there to test - I'm doing something else with the variable).
Is there a way to view the first part of a tab-delimited line in the menu drop down and return the second half as a variable?
Any help would be greatly appreciated.
Thank you
One of the possibilities is that it. Create a table to the left of the values of the tab of the dialog box. Then create an object that you use it as a table of correspondence. Roughly as follows:
same thing as what you have
leader. Open ("r");
var str = file.read ();
leader. Close();
var array = str.split (/ [\r\n] + /);'pairs' are the table of correspondence
pair of var = {};
as before, 'myPlaceList' will be used for the menu drop-down
var myPlaceList = [];var v;
for (var i = 0; i)< array.length;="">
{
v = table [i] .split ('\t');
pairs [v [0]] = v [1];
myPlaceList.push (v [0]);
}Add the drop-down list as before:
var myPlaceMenu = dropdowns.add ({stringList:myPlaceList, selectedIndex:0});})
the table of 'pairs' correspondence is used as follows: pairs ['value1'] returns 'value2 '.
so in your script that would be:
myPlace var pairs = [myPlaceList [myPlaceMenu.selectedIndex]];
Peter
-
I did a code that reads values in the text file. Now I want to produce a chart that can watch the number of items in the files (x axis) and the values in the text file (y-axis).
-
Reading a text file and store it in a table, guard return 0.
Hello, I have an application where I need to read the speed and rate of a text file. For this application, I use a myRIO NEITHER and I want to save the text file on the drive the myRIO aboard in the tmp folder. I simplified my request to isolate the possible problem and I will attach a sample text file and my VI is used.
Overview:
I use a myRIO project because in my real application I myRIO VI of PWM and encoder. I noticed that my problem goes away when just open the main VI and run the application in LabView. My problem then that chairs the VI on a project myRIO folder.
To address the issue:
My question is, when running the VI of the hand of a project myRIO folder everything works as it is supposed to, but when you open the text file in my Subvi, it returns 0, as if nothing is in the text file. Now if I open the VI outside myRIO se project file it works just assumed that when X = 1, it opens the text file written data in a table and then close the text file. I can't understand why he reads nothing in the text file executing the main VI of a project of myRIO and when I use run to highlight one can see it opens the text file and then returns nothing. The text "test" file must be placed in the tmp folder on board the myRIO to validate my way.
Is there a way to fix this?
I assume because I use a myRIO project I can't access the file text, or because of how LabView?
Any help is appreciated, thanks in advance!
You don't have your son wired error upward. You're files showing error functions?
What context are you running VI when you are within the project and what context from outside the project?
My suspicion is that in one case, you run on your PC, the other on the cRIO. Your file exists only on one device or the other. And also that when you change your PC for the cRIO, your file path must change. It's very strange that your watch VI access you the disk R:\. I bet that the R:\ car n does not exist on your cRIO.
-
Can not read the text file: 7 error file not found
Hello
I read a (header.txt) text file that is placed in the same directory as the vi. I use winXP & Labview 8.6. The VI reported an error:
Error 7 open/create/replace the file in OpenTextFile.vi.
However, I copied the path of the file at the end of the error message and pasted into the address bar of IE, and I found that IE can open the file.
Why does this work?
Thank you
Ryan
Never mind. I solved it. I fed the wrong file name in the diagram.
-
I´d as read a SD card text file and display the contents.
The content of the file:
Archer 1 Archer 2 Archer 3 Archer 4
my code:
try { FileConnection con = (FileConnection) javax.microedition.io.Connector.open("file:///SDCard/test.txt"); if(con.exists()) { InputStream input = con.openInputStream(); StringBuffer buffer = new StringBuffer(); while(input.read() != -1) { buffer.append(input.read()); } showMessage("OutPut: "+buffer.toString()); } } catch (IOException e) { showMessage("Es ist ein Fehler aufgetreten."); }
And the output is:
11410411449101141041145010114104114511011410411452
What should be changed?
The problem is that you read the file in bytes and the StringBuffer does not accept the bytes as something that you can add. Therefore, it is interpretting the byte value read from the InputStream as an integer.
Here are two quick fixes on top of my head, I have not tested this code. One reads the InputStream using an InputStreamReader that can give you the contents of the file as an array of char that can be added directly to the StringBuffer. The second way still reads the file as bytes but then uses the StringUtilities class to add the array of bytes to the StringBuffer.
try { FileConnection con = (FileConnection) javax.microedition.io.Connector.open("file:///SDCard/test.txt"); if(con.exists()) { InputStream input = con.openInputStream(); InputStreamReader reader = new InputStreamReader(input); StringBuffer buffer = new StringBuffer(); char[] charBuffer = new char[1024 * 8]; int lengthRead; while ((lengthRead = reader.read(charBuffer, 0, charBuffer.length)) > 0) { buffer.append(charBuffer, 0, lengthRead); } showMessage("OutPut: "+buffer.toString()); } } catch (IOException e) { showMessage("Es ist ein Fehler aufgetreten."); } try { FileConnection con = (FileConnection) javax.microedition.io.Connector.open("file:///SDCard/test.txt"); if(con.exists()) { InputStream input = con.openInputStream(); StringBuffer buffer = new StringBuffer(); byte[] byteBuffer = new byte[1024 * 8]; int lengthRead; while ((lengthRead = input.read(byteBuffer, 0, byteBuffer.length)) > 0) { StringUtilities.append(buffer, byteBuffer, 0, lengthRead); } showMessage("OutPut: "+buffer.toString()); } } catch (IOException e) { showMessage("Es ist ein Fehler aufgetreten."); }
-
Nobody knows how to output to a text file.
I have a timestamp and when a key is pressed at the last level I want to output a Boolean variable in a text file, preferably to the desktop
It is a simple .swf that I created.
OK, I've managed to do:
var file:FileReference = new FileReference(); Create a filereference object
var flag: Boolean = false; Create the variable
function taketheticket(event:MouseEvent):void
{
trace ("change is" + flag); prints the value of change
leader. Save (flag, "result.text"); saves the value of the indicator in a text file named result.text
gotoAndStop (8); go to the section 8 and stop
}
When the above method is exectuted it allows you to select a particular destination.
Maybe you are looking for
-
Impossible to print the Chinese fonts PCL, always print Korean
Dear support I tried to print the Chinese police of PCL commands It prints only Korean, regardless of what font type I attributed I've already classified under the code in < esc > (18 < esc > (s1pXXv0s0b17007T my printer is M602n, it comes with disk
-
Compilation failed due to an error of Xilinx.
I've recently updated since LV2014 until 2015, and an FPGA VI who previously compiled successfully is no longer made. My goal is a 7951R and I use a module e/s of 6584. A few minutes in the compilation process, I get the below error. I found the Whit
-
How can I make sure windows fit on desktop screen
Windows appear larger than the desktop and I can't access the buttons on the edge
-
Hello, I'm doing a count down on top a Bitmap image. I use graphics.draw (),However, this ended up writing the text on text, no matter what I do.Example: when the second = 3, the image will be 3 shotWhen the second = 2, the image will be 2 on top 3 d
-
We are replacing our UPS unit in one of our data centres whicih currently houses one of our UCS, everything should be stopped there, so I was wondering what is the process to properly close the UCS. We have the following on this particular area: 1. c