Reading line of text from inside of a txt or doc file by a script
Posted: Thu Nov 14, 2013 3:56 pm
Hello all,
I've asked this question to Freddy. But i think he's busy now. so he didn't answer my question yet.
After that, i thought to ask my question to the forum.
I'd like to read a line of text or word from inside of a txt to doc file to manage and direct it from a flow in Switch. Last training in Enfocus, Freddy has told me that i con do it with readLine file class' Member Text I/O functions. And i did something with this function. And i've got something with my poor scripting knowledge. As a result, my script doesn't give me a line of text but it shows the font information from the txt file. i have this result using with log. And you ken see the attached screenshot of my Switch scripter window. and the code itself.
At that point, i need some advice how can get the text inside of a txt file which is written inside of it.
For instance:
if the txt or doc file include the text like this:
Muharrem ALTINTAS
WIT Dünya Bilisim Teknolojileri
Te: +902122702052
I would like to read the first line of the text "Muharrem ALTINTAS" with readLine function.
I wrote this script to do this.
function jobArrived( s : Switch, job : Job )
{
var dosya = job.getPath();
var oku = new File(dosya);
oku.open(File.ReadOnly);
oku.readLine();
var satir = oku.readLine();
s.log(1,satir);
oku.close();
job.sendToSingle(job.getPath());
}
when run this script, info gives me this information: " {fonttblf0fswissfcharset0 Helvetica;} "
I didn't have chance to take the text line that i want to.
I'm sure, i'm missing something in this scripting code but i don't aware of it yet.
Could you share your opinions with me? Or you may advice a different way to have this information.
Here is the screenshot of my Switch Scripter window:
http://img62.imageshack.us/img62/9920/r9l9.jpg
Kind Regards..
I've asked this question to Freddy. But i think he's busy now. so he didn't answer my question yet.
After that, i thought to ask my question to the forum.
I'd like to read a line of text or word from inside of a txt to doc file to manage and direct it from a flow in Switch. Last training in Enfocus, Freddy has told me that i con do it with readLine file class' Member Text I/O functions. And i did something with this function. And i've got something with my poor scripting knowledge. As a result, my script doesn't give me a line of text but it shows the font information from the txt file. i have this result using with log. And you ken see the attached screenshot of my Switch scripter window. and the code itself.
At that point, i need some advice how can get the text inside of a txt file which is written inside of it.
For instance:
if the txt or doc file include the text like this:
Muharrem ALTINTAS
WIT Dünya Bilisim Teknolojileri
Te: +902122702052
I would like to read the first line of the text "Muharrem ALTINTAS" with readLine function.
I wrote this script to do this.
function jobArrived( s : Switch, job : Job )
{
var dosya = job.getPath();
var oku = new File(dosya);
oku.open(File.ReadOnly);
oku.readLine();
var satir = oku.readLine();
s.log(1,satir);
oku.close();
job.sendToSingle(job.getPath());
}
when run this script, info gives me this information: " {fonttblf0fswissfcharset0 Helvetica;} "
I didn't have chance to take the text line that i want to.
I'm sure, i'm missing something in this scripting code but i don't aware of it yet.
Could you share your opinions with me? Or you may advice a different way to have this information.
Here is the screenshot of my Switch Scripter window:
http://img62.imageshack.us/img62/9920/r9l9.jpg
Kind Regards..