Jump to content

Text in editbox save as a txt file


Recommended Posts

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]

Link to comment
Share on other sites

#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

Link to comment
Share on other sites

#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]

Link to comment
Share on other sites

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]

Link to comment
Share on other sites

#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?
Link to comment
Share on other sites

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]

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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

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]

Link to comment
Share on other sites

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]

Link to comment
Share on other sites

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!
Link to comment
Share on other sites

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]

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