Jump to content

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)

GuiCtrlCreateTabItem("tab1")

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

GuiCtrlCreateTabItem("")

GuiSetState()

While 1

$msg = GUIGetMsg()

Select

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

ExitLoop

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.")

Exit

EndIf

FileOpen($file,0)

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

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

GuiCtrlSetData($tabtext, $contents)

EndSelect

WEnd

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...