Jump to content
Sign in to follow this  
tobi2006

Text in editbox save as a txt file

Recommended Posts

tobi2006

How can I save the text, that I typed in the editbox, as a txt file? :)

Share this post


Link to post
Share on other sites
November

How can I save the text, that I typed in the editbox, as a txt file? :)

Hi,

See in help file about:

GUICtrlRead

FileWrite or FileWriteLine

Cheers :D


Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Share this post


Link to post
Share on other sites
James

#include <GUIConstants.au3>

$sGui = GUICreate("FileWrite Text", 634, 450, -1, -1)
$Edit = GUICtrlCreateEdit("", 0, 0, 633, 401, BitOR($ES_AUTOHSCROLL,$ES_WANTRETURN,$WS_VSCROLL))
GUICtrlSetData(-1, "TYPE IN HERE THEN PRESS SAVE. I WILL SAVE TO C:\test.txt!")
$Save = GUICtrlCreateButton("Save", 208, 408, 177, 41, 0)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Save
            $Txt = GuiCtrlRead($Edit)
            FileWrite("C:\test.txt", $Txt) 
    EndSwitch
WEnd

See you,

James

Share this post


Link to post
Share on other sites
November

#include <GUIConstants.au3>

$sGui = GUICreate("FileWrite Text", 634, 450, -1, -1)
$Edit = GUICtrlCreateEdit("", 0, 0, 633, 401, BitOR($ES_AUTOHSCROLL,$ES_WANTRETURN,$WS_VSCROLL))
GUICtrlSetData(-1, "TYPE IN HERE THEN PRESS SAVE. I WILL SAVE TO C:\test.txt!")
$Save = GUICtrlCreateButton("Save", 208, 408, 177, 41, 0)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Save
            $Txt = GuiCtrlRead($Edit)
            FileWrite("C:\test.txt", $Txt) 
    EndSwitch
WEnd

See you,

James

hey Secure_ICT,

Let them do some research :D

hehehehe

nice example as usual!

Cheers m8 :)


Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Share this post


Link to post
Share on other sites
tobi2006

Hi,

See in help file about:

GUICtrlRead

FileWrite or FileWriteLine

Cheers :)

But then it saves Line 1, Line 2, ... in a txt file and not the text I typed in the editbox!

Share this post


Link to post
Share on other sites
November

But then it saves Line 1, Line 2, ... in a txt file and not the text I typed in the editbox!

Hi m8,

use this :

FileOpen ( "filename", mode )

1 = Write mode (append to end of file)

Cheers


Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Share this post


Link to post
Share on other sites
tobi2006

#include <GUIConstants.au3>

$sGui = GUICreate("FileWrite Text", 634, 450, -1, -1)
$Edit = GUICtrlCreateEdit("", 0, 0, 633, 401, BitOR($ES_AUTOHSCROLL,$ES_WANTRETURN,$WS_VSCROLL))
GUICtrlSetData(-1, "TYPE IN HERE THEN PRESS SAVE. I WILL SAVE TO C:\test.txt!")
$Save = GUICtrlCreateButton("Save", 208, 408, 177, 41, 0)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Save
            $Txt = GuiCtrlRead($Edit)
            FileWrite("C:\test.txt", $Txt) 
    EndSwitch
WEnd

See you,

James

I want to give the txt file a name! How?

Share this post


Link to post
Share on other sites
November

Replace the C:\text.txt with the name that you want to give it.

Hehehe

Or :

$filetochange = "c:\test.txt"

FileWrite($filetochange, $Txt)

Just give a bigger idea of what can be done!

Cheers


Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Share this post


Link to post
Share on other sites
James

Yeah, basically what November said allows you to define it somewhere for easier usage. And if you have a big script. So adding his bit, the example would be.

#include <GUIConstants.au3>

$filename = "C:\FILENAME.txt" ; Change the location and name of the file here

$sGui = GUICreate("FileWrite Text", 634, 450, -1, -1)
$Edit = GUICtrlCreateEdit("", 0, 0, 633, 401, BitOR($ES_AUTOHSCROLL,$ES_WANTRETURN,$WS_VSCROLL))
GUICtrlSetData(-1, "TYPE IN HERE THEN PRESS SAVE. I WILL SAVE TO C:\test.txt!")
$Save = GUICtrlCreateButton("Save", 208, 408, 177, 41, 0)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Save
            $Txt = GuiCtrlRead($Edit)
            FileWrite($filename, $Txt) 
    EndSwitch
WEnd

There you go.

Share this post


Link to post
Share on other sites
tobi2006

Yeah, basically what November said allows you to define it somewhere for easier usage. And if you have a big script. So adding his bit, the example would be.

#include <GUIConstants.au3>

$filename = "C:\FILENAME.txt" ; Change the location and name of the file here

$sGui = GUICreate("FileWrite Text", 634, 450, -1, -1)
$Edit = GUICtrlCreateEdit("", 0, 0, 633, 401, BitOR($ES_AUTOHSCROLL,$ES_WANTRETURN,$WS_VSCROLL))
GUICtrlSetData(-1, "TYPE IN HERE THEN PRESS SAVE. I WILL SAVE TO C:\test.txt!")
$Save = GUICtrlCreateButton("Save", 208, 408, 177, 41, 0)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Save
            $Txt = GuiCtrlRead($Edit)
            FileWrite($filename, $Txt) 
    EndSwitch
WEnd

There you go.

I want to use the FileSaveDialog to chose the name for the txt file.

Share this post


Link to post
Share on other sites
James

Well why dont you use the HelpFile? If you cant find anything then ask.

By the way, I have done it. So if you cant find anything or get it to work. Then ask. It is very simple, just a case of FileSaveDialog and Changing the FileWrite to what the FileSaveDialog is called.

Edited by Secure_ICT

Share this post


Link to post
Share on other sites
November

Hi,

Using Secure_ICT code:

#include <GUIConstants.au3>

$sGui = GUICreate("FileWrite Text", 634, 450, -1, -1)
$Edit = GUICtrlCreateEdit("", 0, 0, 633, 401, BitOR($ES_AUTOHSCROLL,$ES_WANTRETURN,$WS_VSCROLL))
GUICtrlSetData(-1, "TYPE IN HERE THEN PRESS SAVE. I WILL SAVE TO C:\test.txt!")
$Save = GUICtrlCreateButton("Save", 208, 408, 177, 41, 0)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Save
            $savedialog = FileSaveDialog("Select file to write", "", "*.txt");Selects txt file to write
            $Txt = GuiCtrlRead($Edit)
            FileWrite($savedialog, $Txt) 
    EndSwitch
WEnd

Cheers


Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Share this post


Link to post
Share on other sites
November

November.. Give him a chance to research!

LOL

My bad...

CODE REMOVED :D

LOOOOLLLOOOOL

I think i carried away the help :D

Bad November :)


Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Share this post


Link to post
Share on other sites
tobi2006

Hi,

Using Secure_ICT code:

#include <GUIConstants.au3>

$sGui = GUICreate("FileWrite Text", 634, 450, -1, -1)
$Edit = GUICtrlCreateEdit("", 0, 0, 633, 401, BitOR($ES_AUTOHSCROLL,$ES_WANTRETURN,$WS_VSCROLL))
GUICtrlSetData(-1, "TYPE IN HERE THEN PRESS SAVE. I WILL SAVE TO C:\test.txt!")
$Save = GUICtrlCreateButton("Save", 208, 408, 177, 41, 0)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Save
            $savedialog = FileSaveDialog("Select file to write", "", "*.txt");Selects txt file to write
            $Txt = GuiCtrlRead($Edit)
            FileWrite($savedialog, $Txt) 
    EndSwitch
WEnd

Cheers

It doesn't work!

Share this post


Link to post
Share on other sites
November

Have you tried fixing it?

Hint: FileSaveDialog

I didnt said anything :)

Just watching :D

Cheers


Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

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  

×