Sign in to follow this  
Followers 0
bobheart

Could I Ask One More Fav And All Be Cool .

30 posts in this topic

I have this now so I can write from the words that are in the au3 but would like it to read from the input box and save it to the text.txt file . and i can read it to a massage box but would like it to go in to the input box . could someone be so kind as to do the code for me and all be out of your hair I just want to get this done then i can use it to do anything else I want to do as thats the thing I don't understand and man I have look and look at the help file and I just don't get it .

;Generated with AutoBuilder 0.3

Opt("GUICoordMode", 1)
Opt("GUINotifyMode", 1)

GuiCreate("Small Notes", 480,272,10,10,0x04CF0000)
$button_1 = GUISetControl("button", "Read", 340,230, 80,20)
$button_2 = GUISetControl("button", "Save", 220,230, 80,20)
$edit_1 = GUISetControl("edit", "Edit 1", 30,20, 410,180)
$date_1 = GUISetControl("date", "Date 1", 20,220, 190,20)

GuiShow()

While 1
    sleep(100)
    $msg = GuiMsg(0)
    Select
    Case $msg = -3
  Exit
    Case $msg = $button_1
    $file = FileOpen("test.txt", 0)

; Check if file opened for reading OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

; Read in 1 character at a time until the EOF is reached
While 1
    $chars = FileRead($file, 100000)
    If @error = -1 Then ExitLoop
    MsgBox(0, "Char read:", $chars)
Wend
;;
FileClose($file)
;;
Case $msg = $button_2
    $file = FileOpen("test.txt", 1)

; Check if file opened for writing OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf
FileWrite($file, "Line1")
FileWrite($file, "Still Line1" & @CRLF)
FileWrite($file, "Line2")
FileClose($file)
    ;;;
    Case $msg = $edit_1
    ;;;
    Case $msg = $date_1
    ;;;
    EndSelect
WEnd
Exit

What the window looks like if you need to see it ?

Posted Image

Thank you if you can help me out here ..

Share this post


Link to post
Share on other sites



I did get one thing done see . :D

But it was just links in the system so was not to hard .

Posted Image

Share this post


Link to post
Share on other sites

If you need to read what is inside the edit_1 control

just issue a $text=GuiRead($edit_1) when you click save

i.e. in the case $msg=$Button_2

:D

Share this post


Link to post
Share on other sites

I got this ?

---------------------------

AutoIt Error

---------------------------

Line 46 (File "E:\Programs\AutoIt3\Examples\English\newer scripts\small_notes2.au3"):

$text=GuiRead($edit_1)

$text=GuiRead(^ ERROR

Error: Variable used without being declared.

---------------------------

OK

---------------------------

Share this post


Link to post
Share on other sites

Still working on this if anyone could help me out with this .

Share this post


Link to post
Share on other sites

Still working on this if anyone could help me out with this .

The error is not from the script shown in yopur first post ... right ??

Line 46 = FileWrite($file, "Line1") in that script...


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

This is the script I'm working on .

;Generated with AutoBuilder 0.3

Opt("GUICoordMode", 1)
Opt("GUINotifyMode", 1)

GuiCreate("MyGUI", 490,272,10,10,0x04CF0000)
$input_1 = GUISetControl("input", "Input 2", 30,20, 410,190)
$date_1 = GUISetControl("date", "Date 1", 20,220, 190,20)
$button_1 = GUISetControl("button", "Open", 240,220, 70,20)
$button_2 = GUISetControl("button", "Save", 360,220, 70,20)

GuiShow()
While 1
    sleep(100)
    $msg = GuiMsg(0)
    Select
    Case $msg = -3
  Exit
    Case $msg = $input_1
    
    ;;;
    Case $msg = $date_1
    ;;;
    Case $msg = $button_1
    $file = FileOpen("test.txt", 0)

; Check if file opened for reading OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf
;; Read in 1 character at a time until the EOF is reached
While 1
    $chars = FileRead($file, 1000)
    If @error = -1 Then ExitLoop
    MsgBox(0, "Char read:", $chars)
Wend
FileClose($file)
;;;
Case $msg = $button_2
;;;
    EndSelect
WEnd
Exit

I crash a bit ago on something that locked up on me so that is a backup script ( I always make a backup of anything I work on ) so that doesn't have that line in it now but I can't seem to get this to work .

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

I have no idea what some of this stuff does....heh but anyway this makes the program save to that file...not sure exactly if thats all you wanted. Maybe you should give the option to save file name or something. like ask the user: what name do u wantthis file to be? then they type that into a box and then u read it and store it into a string then put that string as the string.txt instead of having standard text.

Here is the only line of code I added:

So 1 line and 1 variable change.

$textleetcode = ControlGetText ( "Small Notes", "", "Edit1" )

And then FileWrite($file, $textleetcode)

Anyway i might of read your question wrong. This is prob the case. So if I did, let me know.

;Generated with AutoBuilder 0.3

Opt("GUICoordMode", 1)
Opt("GUINotifyMode", 1)

GuiCreate("Small Notes", 480,272,10,10,0x04CF0000)
$button_1 = GUISetControl("button", "Read", 340,230, 80,20)
$button_2 = GUISetControl("button", "Save", 220,230, 80,20)
$edit_1 = GUISetControl("edit", "", 30,20, 410,180)
$date_1 = GUISetControl("date", "Date 1", 20,220, 190,20)

GuiShow()

While 1
sleep(100)
$msg = GuiMsg(0)
Select
Case $msg = -3
 Exit
Case $msg = $button_1
$file = FileOpen("test.txt", 0)

; Check if file opened for reading OK
If $file = -1 Then
   MsgBox(0, "Error", "Unable to open file.")
   Exit
EndIf

; Read in 1 character at a time until the EOF is reached
While 1
   $chars = FileRead($file, 100000)
   If @error = -1 Then ExitLoop
   MsgBox(0, "Char read:", $chars)
Wend
;;
FileClose($file)
;;
Case $msg = $button_2
$file = FileOpen("test.txt", 1)

; Check if file opened for writing OK
If $file = -1 Then
   MsgBox(0, "Error", "Unable to open file.")
   Exit
EndIf
$textleetcode = ControlGetText ( "Small Notes", "", "Edit1" )
FileWrite($file, $textleetcode)
FileClose($file)
;;;
Case $msg = $edit_1
;;;
Case $msg = $date_1
;;;
EndSelect
WEnd
Exit
Edited by Falling

Share this post


Link to post
Share on other sites

Wow thanks man that realy help it now saves it to file . I just have to get it to read it back to the input box now ..

But thank you for that help .

Is there a line that clears the input box after one has typed ?

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

This works:

ControlClick ( "Small Notes", "", "Edit1", "Left", 1)

$temp = ControlGetText ( "Small Notes", "", "Edit1" )

While $temp <> "" ;not sure if right syntax

Send("{BS}")

$temp = StringTrimRight($temp, 1)

Wend

Hey can you post your code for that sweet Manager of yours?

Edited by Falling

Share this post


Link to post
Share on other sites

Have you actually read the help file on the Gui functions? They explain how to read controls and write controls and also how to clear an edit control.

Share this post


Link to post
Share on other sites

Have you actually read the help file on the Gui functions?  They explain how to read controls and write controls and also how to clear an edit control.

Yes , My head hurts now and I can't make heads or tails of it . like put in GuiRead in the help search and it has no clue what it is ?

Most of it I just don't understand , sorry but I have tried my best to do it or I would not be here asking for help and looking like a dump shit .

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

Valik your response sounds kind of snobby. No need to ask a question that has an obvious answer. Obviously if he or me had read them files we would not be posting here asking questions nor tryin to answer them.

Thats just the way you came across to me though, maybe other people find that tone peachy.

Edited by Falling

Share this post


Link to post
Share on other sites

Falling , I sent you a PM with the code for what you wanted ..

Share this post


Link to post
Share on other sites

Valik your response sounds kind of snobby.  No need to ask a question that has an obvious answer.  Obviously if he or me had read them files we would not be posting here asking questions nor tryin to answer them. 

Thats just the way you came across to me though, maybe other people find that tone peachy.

Sigh, snobby, whatever. I don't particularly care how it came off, to be quite honest. My question still stands because I know for a fact the answer is in the help file as I've so kindly copied and highlighted below.

Remarks

unchecked state cannot be set at the same time as the disable/hidden when referencing a radio or a checkbox control.

On an "edit" control the info will be added to current content. To erase previous content just use a null string as GuiWrite($n,0,"")

On a "combo" or a "list" control will be set the default.

On a "pic" control the info parameter define the new picture to display.

That's taken straight out of the Remarks section for GuiWrite(). It comes with an example and everything.

One quick rhetorical question to you, Falling, in regards to this statement:

Obviously if he or me had read them files we would not be posting here asking questions nor tryin to answer them.

Do you think you are entitled to an answer (to any question) if you haven't demonstrated you are willing to seek the answer yourself by investing some small measure of time into first finding a solution in documentation that came with the product?

Share this post


Link to post
Share on other sites

Wow Valik , oyur post wounldn't have anything to do with this post would it ?

http://www.autoitscript.com/forum/index.php?showtopic=2403

How about a screen that comes up before you can post a message in V3 Support that says "Have you looked at the help file and read the FAQ?". This screen can be disabled after x posts through the preferences stuff. Also, how about one in Scripts and Scraps saying "If you are posting a help question, go to the correct forum and try again."

I wish those two screens were possible (Then again, would people actually read them...?). I've answered a half a dozen or more questions over the last few days with the simple statement: "See FAQ #n in the help file." Makes me wonder why there is a FAQ...

Share this post


Link to post
Share on other sites

As I've stated before, I don't understand the logic in "I'll post in a forum where it may take hours or days if I get an answer at all instead of spending minutes to find the answer in the help file".

I'm not a big fan of people who, for whatever reason, don't read the help file, especially when it clearly answers the question they are asking. It is one thing to not understand how the help file example works or need help with a concept, but it is something else entirely to ask a question that has already been answered in the help file.

Share this post


Link to post
Share on other sites

As I've stated before, I don't understand the logic in "I'll post in a forum where it may take hours or days if I get an answer at all instead of spending minutes to find the answer in the help file". 

I'm not a big fan of people who, for whatever reason, don't read the help file, especially when it clearly answers the question they are asking.  It is one thing to not understand how the help file example works or need help with a concept, but it is something else entirely to ask a question that has already been answered in the help file.

It has nothing to do with the help file or if I go read the help file . I have a learning disability . I have notes all over my desk just so I can remember what I want to do for the day .

I can't remember what day it is unless someone tells me .

I can't remember my phone number .

Most of the time I have to ask my wife how to spall stuff because I can't remeber how to spell it .

I'm sorry if my disability is putting you out but I have to live with this and belive me it is no fun .

I have maybe a year and all sit in a chair all day and droll all over my self .

So if you could help me as i don't know how to do the code . it took me two weeks just to learn how to do the gui thing .

Share this post


Link to post
Share on other sites

Do you think you are entitled to an answer (to any question) if you haven't demonstrated you are willing to seek the answer yourself by investing some small measure of time into first finding a solution in documentation that came with the product?

For one I was trying to answer the question not asking a question. So basically i went above what you are asking me. I tried to solve the problem without resorting to looking at the answer first. Sure its reinvinting the wheel but I'm 2 days old to this program. Excuess my newbness.

It may well be best to look in a help file. But i think we where doing fine in this thread before you came along like an ass and basically hijacked it by degrading people. The guy said he looked in the help file before he came here (the effort was made--your quote).

You seem to have enough time to come belittle people but not enough time to help them. I think that speaks loudly enough. Why even come read here, or at the very least why post. I guess thats how you get your jollies.

Falling

Share this post


Link to post
Share on other sites

If I were belittling anybody, the odds are extremely high that they wouldn't come back. I don't just play around. If I choose to insult somebody, I make them feel bad enough to go away forever. I have yet to grow weary enough of a person on this forum to run them off. In fact, I haven't grown weary enough of any person in the last 8 - 10 months to run them off of whatever mutual place we were at (I believe the last was IRC).

Every regular here knows that I'm a blunt person. I have no need of sugar coating what I have to say. Some appreciate that, some don't. If you have a problem with what I say and take it personally, you have a problem you need to figure out how to deal with. I learned a long time ago to stop taking things personally.

There are also two adages that come to mind in regards to just handing out free answers to people (I don't remember the exact wording but the meaning is close enough to the original):

"Feed a hungry man a fish, he'll be full for a day; teach a hungry man to fish, he'll be full for a lifetime."

And then there is my personal sadistical favorite:

"Give a man a match, he'll be warm for an hour; Set a man on fire, he'll be warm for the rest of his life."

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