Jump to content

Problem with {ENTER} in text file. :(


Ivan808
 Share

Recommended Posts

I have the file writing to my .db file. And I have it working with @Tab. I want to replace @TAB with {ENTER} so that I receive this output:

Line1

Line2

Line3

Line4

ect.

Below is the code that I have so far.

Case $save_button
            $pos1 = GUICtrlRead($main_1)
            $pos2 = GUICtrlRead($main_2)
            $DB = FileOpen("database.db",1)
        $DB2 = FileOpen("database2.db",1)
            $EXIST = GetUser($pos1)
            $EXIST = GetPwd($pos2)
            If Not $EXIST Then FileWriteLine($DB, $pos1 & "{ENTER}" & $pos2)
            FileClose($DB)

If I replace "{ENTER}" with @TAB, it gives a tab, but if I use "" with the {ENTER} inside, it gives me:

TEST1{ENTER}TEST2

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

And if I take the quotes ("") out of the equation, it will not work, i keep getting an error.

ERROR: syntax error (illegal character)

If Not $EXIST Then FileWriteLine($DB, $pos1 & {

I have searched and searched for days now, looking in any examples I can come across and still cant figure out why this isn't working. I'm still VERY new at this, so be gentle. :)

I obviously want to eventually use SQLite, but figure this is the next best/easiest thing to do right now to get the script working.

Thanks in advance for any help thrown my way. ;)

Ivan

Link to comment
Share on other sites

I have the file writing to my .db file. And I have it working with @Tab. I want to replace @TAB with {ENTER} so that I receive this output:

Line1

Line2

Line3

Line4

ect.

Below is the code that I have so far.

Case $save_button
 $pos1 = GUICtrlRead($main_1)
 $pos2 = GUICtrlRead($main_2)
 $DB = FileOpen("database.db",1)
 $DB2 = FileOpen("database2.db",1)
 $EXIST = GetUser($pos1)
            $EXIST = GetPwd($pos2)
            If Not $EXIST Then FileWriteLine($DB, $pos1 & "{ENTER}" & $pos2)
 FileClose($DB)

If I replace "{ENTER}" with @TAB, it gives a tab, but if I use "" with the {ENTER} inside, it gives me:

TEST1{ENTER}TEST2

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

And if I take the quotes ("") out of the equation, it will not work, i keep getting an error.

ERROR: syntax error (illegal character)

If Not $EXIST Then FileWriteLine($DB, $pos1 & {

I have searched and searched for days now, looking in any examples I can come across and still cant figure out why this isn't working. I'm still VERY new at this, so be gentle. :)

I obviously want to eventually use SQLite, but figure this is the next best/easiest thing to do right now to get the script working.

Thanks in advance for any help thrown my way. ;)

Ivan

"{ENTER}" is only used for Send. You need a carriage return character which is represented in AutoIt by @CR

FileWriteLine($DB, $pos1 & @CR & $pos2)

If you need carriage return and line feed use @CRLF

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

OUTSTANDING!!! It works!! Thank you very much.

One more minor problem i have is i want to keep the data visable after the user enters it.

input1 to be empty, then when the user types in the data and clicks on Save it will 1. check to see if the data is already in there and 2. if not, then display data just entered.

I am working on this now that I know the ENTER problem.

Any advice on how to tackle this challenge? :)

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