Sign in to follow this  
Followers 0
controlledchaos

simple text box

24 posts in this topic

hi,

im trying to make a simple text box for the user to just enter their name and click ok, can anyone help?

yeah im a noob!

Share this post


Link to post
Share on other sites



Look for InputBox in help


----[ SandyD ]---

Share this post


Link to post
Share on other sites

Look for InputBox in help

thank you! :whistle:

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

is there a way to have entered text (name entered in textbox) save to the file or a file?

Edited by controlledchaos

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

is there a way to have entered text (name entered in textbox) save to the file or a file?

Sure. Search help for FileWrite and see the examples.

Edited by SadBunny

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites

Sure. Search help for FileWrite and see the examples.

i tried that but couldnt get them to work....

Share this post


Link to post
Share on other sites

i tried that but couldnt get them to work....

Not gonna write out the code for you. The example in the help file works. Please post your own code attempt so we can try to figure out where things went wrong.


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites

Not gonna write out the code for you. The example in the help file works. Please post your own code attempt so we can try to figure out where things went wrong.

i wouldnt learn anything if you wrote the code for me.

got the filewrite to work. :whistle: but i am trying to get the information the user typed into the input box to save to the file, like a record of who has logged in type thing...

Share this post


Link to post
Share on other sites

FileWrite will append to the opened file. so it will be like a log file.

I would personally use _FileWriteLog() to make a record in the logfile. then you get timestamps when the login attempt was made. see helpfile on the use of _FileWriteLog()


> there are 10 types of people in the world, those who understand binary and those who don't.

Share this post


Link to post
Share on other sites

FileWrite will append to the opened file. so it will be like a log file.

I would personally use _FileWriteLog() to make a record in the logfile. then you get timestamps when the login attempt was made. see helpfile on the use of _FileWriteLog()

Small correction: FileWrite will not append to opened file by default. It depends on the way that FileOpen was called. From FileOpen help:

FileOpen ( "filename", mode )

(........)

Mode (read or write) to open the file in.

Can be a combination of the following:

0 = Read mode

1 = Write mode (append to end of file)

2 = Write mode (erase previous contents)

4 = Read raw mode

8 = Create directory structure if it doesn't exist (See Remarks).

Both write modes will create the file if it does not already exist. The folder path must already exist (except using mode '8' - See Remarks).

Furthermore, just to be complete: you can write whatever string you read from the inputbox, just do for instance

PSEUDO:
$input = Inputbox(........)
$file = fileopen(.....)
filewriteline($file,$input)
fileclose($file)

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites

Small correction: FileWrite will not append to opened file by default. It depends on the way that FileOpen was called. From FileOpen help:

of course, I just read the top in the helpfile about filewrite. ...Append a line of text to the end of a previously opened text file... but it really depends on if the file was opened with the append mode. I stand corrected.


> there are 10 types of people in the world, those who understand binary and those who don't.

Share this post


Link to post
Share on other sites

how do i get the file to save the output of the textbox? i am trying to get the information the user typed into the input box to save to the file, like a record of who has logged in type thing...

Share this post


Link to post
Share on other sites

how do i get the file to save the output of the textbox? i am trying to get the information the user typed into the input box to save to the file, like a record of who has logged in type thing...

I answered this in my prev post. See my pseudocode example, try it, and again like I said before:

If you can't get it right, please post your attempt and we will try and help you figure out where things went wrong.


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites

I answered this in my prev post. See my pseudocode example, try it, and again like I said before:

If you can't get it right, please post your attempt and we will try and help you figure out where things went wrong.

CODE

InputBox("Name?", "Enter Your Name Here")

$file = FileOpen("name.txt", 2)

FileWrite($file, "Line1")

FileWrite($file, "Still Line1")

FileWrite($file, "Line2")

filewriteline($file,$input)

FileClose($file)

thats all i have

Share this post


Link to post
Share on other sites

CODE

InputBox("Name?", "Enter Your Name Here")

$file = FileOpen("name.txt", 2)

FileWrite($file, "Line1")

FileWrite($file, "Still Line1")

FileWrite($file, "Line2")

filewriteline($file,$input)

FileClose($file)

thats all i have
Here, now you show that you tried :whistle:

Ok now for some explaining: what you will need to do is put the result of the InputBox (what the user entered) into a variable, for instance $name or $input, or whatever you want. (Otherwise it will ask for the name, but the result won't be remembered because it is not put in a variable.) Like this:

$name = InputBox("Name?", "Enter Your Name Here")oÝ÷ Ù8^*.q©ð®+^¶´ß©Úëh¶WÊ-£
âµæ§{   bëh¶WØ^®­m©© Åý¶Þ)ݶ¬¶¸§*.j·°®+b,

Hope it helps.


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites

Here, now you show that you tried :whistle:

Ok now for some explaining: what you will need to do is put the result of the InputBox (what the user entered) into a variable, for instance $name or $input, or whatever you want. (Otherwise it will ask for the name, but the result won't be remembered because it is not put in a variable.) Like this:

$name = InputBox("Name?", "Enter Your Name Here")oÝ÷ Ù8^*.q©ð®+^¶´ß©Úëh¶WÊ-£
âµæ§{   bëh¶WØ^®­m©© Åý¶Þ)ݶ¬¶¸§*.j·°®+b,

Hope it helps.

Yes! Yes! Yes! Thank you thank you sadbunny! :P lol it worked!

now i am trying to get the date/time the user entered their name. basically its a log to show when/who has entered an online class. if someone could point me in the right direction i'd be grateful!

Share this post


Link to post
Share on other sites

Yes! Yes! Yes! Thank you thank you sadbunny! :whistle: lol it worked!

now i am trying to get the date/time the user entered their name. basically its a log to show when/who has entered an online class. if someone could point me in the right direction i'd be grateful!

Search the help for this exact string: time and date macros


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites

Search the help for this exact string: time and date macros

ok and how would i use these? i was thinking of using filewritelog, but it creates a new file. i need a list of the users and when they log on/out saved to the same file. any suggestions? thanks for all your help sadbunny! :whistle:

Share this post


Link to post
Share on other sites

ok and how would i use these? i was thinking of using filewritelog, but it creates a new file. i need a list of the users and when they log on/out saved to the same file. any suggestions? thanks for all your help sadbunny! :whistle:

Filewritelog should work fine... I ran this code three times and it just appended the log lines to the same file (and did not create a new one). What code did you use for filewrite log? Are you sure you made it attempt to write to the same file each time?

#include <file.au3>
;
_FileWriteLog("c:\my.log","Text 1")
;
_FileWriteLog("c:\my.log","Text 2")

Running this three times resulted in one file, named c:\my.log ofcourse, containing:

2007-03-22 18:50:11 : Text 1

2007-03-22 18:50:11 : Text 2

2007-03-22 18:50:59 : Text 1

2007-03-22 18:50:59 : Text 2

2007-03-22 18:51:08 : Text 1

2007-03-22 18:51:08 : Text 2


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites

ok and how would i use these? i was thinking of using filewritelog, but it creates a new file. i need a list of the users and when they log on/out saved to the same file. any suggestions? thanks for all your help sadbunny! :whistle:

But, for use of those macro's, try this:

$string = "it's now day "&@MDAY&" of month "&@MON&" of year "&@YEAR&". The time is "&@HOUR&":"&@MIN&":"&@SEC&"."

MsgBox(0,"example",$string)

You should be able to build this into a string to write to a log file yourself. If you don't want to use _fileWriteLog() that is.


Roses are FF0000, violets are 0000FF... All my base are belong to you.

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