Sign in to follow this  
Followers 0
Lukepro2315

Export / Iport text to file

10 posts in this topic

Hi guyz, im quite newbie + im not english speaking person, so as first excuse my english or stupidity. :D

So i need to ask someone, how can i by pressing GUI button, transfer text, that ill make in "GUICtrlCreateEdit" lane to ".txt" file, and than if its possible to import it back to script? For very easy example
 

$whatneedstobeexported = GUICtrlCreateEdit( "This text need to be exported to txt file when export button is pressed ")

$export = GUICtrlCreateButton("Export")

$import = GUICtrlCreateButton("Import")

;------------------------------------------------

While 1

Case $Export
FileWrite (export.txt, "" & $whatneedstobeexported)

Case $Import

---somehow read content of that export.txt and write it back to $whatneedstobeexported = GUICtrlCreateEdit---

EndSwitch
WEnd

 

I hope u understand what i want. :D Simply i need somehow STORE / RECALL (yeah thats the key thing) data from that "GUICtrlCreateEdit".

I know this script dont work - its written more than simple, and i need same simple (but working of course) answer how to do that. :D
So can anyone help me plz? (I havent found anywhere any hlp file or something, about "how to do that")
Thx

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Have a look at these functions:

FileOpen
FileWrite
FileRead
GUICtrlSetData
GUICtrlRead
Edited by MikahS

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Share this post


Link to post
Share on other sites

HI

Case $Import

 $filetext = FileRead(export.txt)

GUICtrlSetData($whatneedstobeexported,$filetext)

Share this post


Link to post
Share on other sites

HI

Case $Import

 $filetext = FileRead(export.txt)

GUICtrlSetData($whatneedstobeexported,$filetext)

Thx. :) Thats what i need to import. :)

Go to try that

Share this post


Link to post
Share on other sites

 

Have a look at these functions:

FileOpen
FileWrite
FileRead
GUICtrlSetData
GUICtrlRead

I did, but lot of them havent worked as i expected. :/

When i maded that scripty and tryed it, it created that export file, but allways when button was pressed, it exported only "66" numbers and i dont know why. :D

Share this post


Link to post
Share on other sites

HI

Case $Import

 $filetext = FileRead(export.txt)

GUICtrlSetData($whatneedstobeexported,$filetext)

 

Not worky - unknown function name ^^ (im in hurry at work, so maybe it was mine mistake...ill check it later) ^^

Share this post


Link to post
Share on other sites

I did, but lot of them havent worked as i expected. :/

When i maded that scripty and tryed it, it created that export file, but allways when button was pressed, it exported only "66" numbers and i dont know why. :D

66 is the controlID from creating the edit, which you have stored in $whatneedstobeexported. You need to read the value with the function I suggested GUICtrlRead() like so:

FileWrite("export.txt", GUICtrlRead($whatneedstobeexported))

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Share this post


Link to post
Share on other sites

 

66 is the controlID from creating the edit, which you have stored in $whatneedstobeexported. You need to read the value with the function I suggested GUICtrlRead() like so:

FileWrite("export.txt", GUICtrlRead($whatneedstobeexported))

Amazing. It works. :) THats exactly what i needed. Thx man. :)

Share this post


Link to post
Share on other sites

Not worky - unknown function name ^^ (im in hurry at work, so maybe it was mine mistake...ill check it later) ^^

Oh it works...i forgot on " " in there. My stupidity. Thx guys, my script is completed thx to u. :)

1 person likes this

Share this post


Link to post
Share on other sites

My pleasure. ;)


Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

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