Sign in to follow this  
Followers 0
NELyon

Text file inside GUI editbox?

14 posts in this topic

Heres what i am trying to get. Is it possible to display the file in variable $input_whatev (say that variable is whatev.txt) is it possible to display whatev.txt in a GUI edit box? The edit box's variable being $edit_1?

Share this post


Link to post
Share on other sites



Guictrlsetdata($edit_1,Fileread("whatev.txt"))

Share this post


Link to post
Share on other sites

oh, i read about fileread and i thought it just returned the number of characters in the file

Share this post


Link to post
Share on other sites

on every topic there is the section called Return Value

Return Value

Success: Returns the binary/string read.

always good to look at :D

Share this post


Link to post
Share on other sites

Adding a load option to your editor?

$sInFile = FileOpenDialog("Select a file to open",@UserProfileDir, "All Files (*.*)")
$sFileText = Fileread($sInFile)

; ...

GUICtrlSetData($Edit1, $sFileText)

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites

whose uses variables for such a thing :D

GUICtrlSetData($Edit_1,Fileread(FileOpenDialog("Select a file to open",@UserProfileDir, "All Files (*.*)")))

just letting people know you can pop functions inside functions , itll execute the inside ones first . Its ok they dont bite or like crush each other or like idk what

Share this post


Link to post
Share on other sites

just letting people know you can pop functions inside functions

True, but what about error checking?

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites

you dont need variables for error checking :D

Share this post


Link to post
Share on other sites

Trust me, I agree with you there and I'm not arguing with you. :D

I write complex 1-line batch files all the time.

It looks like codemyster is working on his editor program, so he might want to re-use that info. (for example, to see if the user is re-opening the same file)


[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites

you can still avoid it, first you do an Iniwrite of the file and simply do an iniread eh yeah gotcha there :D lol im done

Share this post


Link to post
Share on other sites

Who uses files for such a thing? :D

Have a great weekend! lol


[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Skrunge (and thatsgreat): thats what i was trying to do at first but i wasn't sure on the fileopendialog stuff.

EDIT:

ok, i tried to do the same thing with my save part, but i'm getting an error:

FileWrite(GUICtrlRead($Edit_1, Fileread(FilesaveDialog("Select a file to save",@ScriptDir, "All Files (*.*)")))
Edited by codemyster

Share this post


Link to post
Share on other sites

heheh cuz you got it completely mixed up, filesavedialog should go first since it returns the file handle and thats what the first paramater in filewrite is, then should come the Guictrlread and , and you dont need the Fileread

FileWrite(FilesaveDialog("Select a file to save",@ScriptDir, "All Files (*.*)"),GUICtrlRead($Edit_1))

Share this post


Link to post
Share on other sites

ok, the update is done, check out the link in my sig

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  
Followers 0