Jump to content
Sign in to follow this  

Opening File Into A Input Box

Recommended Posts


hi just started playing with Autoit and have had lots of fun with the wonderful

examples and have made a small GUI with a number of tabs, and in those tabs

i have put a INPUT box. Now when i select File Open then I use Fileopen Dialog

then read the file and and using the GuiCtrlSetData i set the data to the controlId

for the input box however it does not put the new lines onto a new line but inserts

control characters (i expect) on one line. I tried the string replace but to no avail

any and all help is appreciated :)

GuiCtrlCreateTab(0, 90, 530, 380)


$tabtext=GuiCtrlCreateInput("i am writing here", 20, 160, 480, 250)



While 1

$msg = GUIGetMsg()


Case $msg = $GUI_EVENT_CLOSE Or $msg = $cancelbutton


Case $msg = $fileitem

$file = FileOpenDialog("Choose file...",'C:\Documents and Settings\me\My Documents',"All (*.*)")

If @error <> 1 Then GuiCtrlCreateMenuItem ($file,$recentfilesmenu)

; Check if file opened for reading OK

If $file = -1 Then

Msgjava script:emoticon(":mellow:", "smid_4")

:'(Box(0, "Error", "Unable to open file.")




$contents = FileRead($file,FileGetSize($file))

$contents = StringReplace($contents, "|", @CRLF,0)

GuiCtrlSetData($tabtext, $contents)



Share this post

Link to post
Share on other sites

try using guictrlcreateedit instead of the input (i think it only handles 1 line)

this should work

SUperb worked first time, thanks heaps :):mellow::)

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.