ScriptSpot

Forum topic · General Scripting

how read TXT in editText

By jmpinero · 2011-12-27

Description

hi, I try show txt file in editText and it is not works.
I try this:

-----------------
rollout test "test"
(

fn readTXT editTextShow =
(
try
(
local inFolder = getOpenFileName type:"notepad (*.txt)| *.txt "
local inFile = openFile inFolder
editTextShow = inFile
)
catch(false)
)

button testbutton "open"
editText editTextShowBox ""
on testbutton pressed do readTXT editTextShowBox.text
)

-----------------

Comments (2)

how read TXT in editText

jos · 2011-12-27

hey jmpinero, you should have something like this..
code speaks for itself.

fn readTXT fileName=()

rollout test "test"
(

button testbutton "open"
editText editTextShowBox ""
on testbutton pressed do
(
local inFolder =""
inFolder = getOpenFileName type:"notepad (*.txt)| *.txt "
editTextShowBox.text = readTXT inFolder
)
)
createDialog test

fn readTXT fileName =
(
inText
local inFile = openFile fileName

if inFile != undefined do
(
inText = readLine inFile
)
close inFile
messagebox( inText as string)
return (inText as string)
)

jmpinero · 2011-12-27

thanks for your reply