Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 15 of 28
  1. #1
    Join Date
    Feb 2009
    Location
    Ukraine
    Posts
    19

    Grin Read Line from TXT-file

    Hi,
    I have some files on HDD. Each file consist of 10 lines.
    I read the data of file via the function
    Code:
    result = Dialog.FileBrowse(true, "Open File", _SourceDrive, "Text File (*.txt)|*.txt|All Files(*.*)|*.*|", "", "", false, false);
    if (result[1] ~= "CANCEL") then
    resultthetxt = TextFile.ReadToString(result[1]);
    end
    Questions are:
    1. how to read data from the line "9" of opened file into var raw_9?
    2. select 14 symbols from right in this variable into var raw_9_result

    Thanks

  2. #2
    Join Date
    Aug 2004
    Location
    Somewhere in Texas, USA
    Posts
    417
    Can you post what you have now and maybe then we could help.

    Unless someone wants to just do it for you which will not help you in learning how to do this on your own.

    What your asking for is really very basic which would make it a great way for you to learn AMS.

  3. #3
    Join Date
    Apr 2007
    Posts
    165
    @Pazan
    something like this i guess you want:

    Code:
    raw_9 = resultthetxt[9]
    raw_9_result = String.Right(raw_9, 14);
    @mwreyf1
    which will not help you in learning how to do this on your own.
    I don't agree with you anymore. one year ago i would, but i discovered that the best way to learn is have a look at examples and stuff. and just create what you want to create. And then learn step by step and not just reading the manual and what each function does. Just look at his code. He obviously tries.How you know how to copy 14 characters from the right of one string into another if you don't know wich function could achieve that. What's basic for us wasn't basic the first times we used ams. I just takes some time to get used to the functions that you need and stuff. But there also people that don't try something and ask to write a complete script for them. Those people don't deserve help in my opinion because they don't try. Don't be offended by me please. It's not my intention.

    best regards,

    Teqskater
    Last edited by Teqskater; 02-16-2009 at 09:05 AM.

  4. #4
    Join Date
    Aug 2004
    Location
    Somewhere in Texas, USA
    Posts
    417
    @Teqskater

    On something as SIMPLE (for even a beginner) as what he is asking, there is no reason for him to not at least attempt to get at least part of it on his own.

    If you look at the code he posted that you reffered to as "him trying", none of that code is in no way an attempt at what he was asking for.

    His question:
    Questions are:
    1. how to read data from the line "9" of opened file into var raw_9?
    2. select 14 symbols from right in this variable into var raw_9_result
    I don't see where he made any attempt at either of those questions.

    I agree that it helps to have a helping hand, but when those times come along that are easy code by most standards, then those are the one's that a beginner should try at all cost to figure out on their own. If they can't figure out the most basic then they will never get it.

  5. #5
    Join Date
    Apr 2007
    Posts
    165
    On something as SIMPLE (for even a beginner) as what he is asking, there is no reason for him to not at least attempt to get at least part of it on his own.
    Your right about that.

    none of that code is in no way an attempt at what he was asking for.
    Ok. That's right. But he was looking into the right direction. I did not say that it would work.

    I don't see where he made any attempt at either of those questions.
    Also i did not say he attempted solving that.

    But ok i get your point right now and i only can say you are right.

    Well at least we need to let him figure out the last part of his puzzle. right?
    When he solves it he's good enough to solve almost everything else.

    Nice to have this discussion with you mwreyf1

  6. #6
    Join Date
    Feb 2009
    Location
    Ukraine
    Posts
    19

    Post

    Well...
    Button OnClick:
    Code:
    result = Dialog.FileBrowse(true, "Open File", "AutoPlay\\Docs", "Text File (*.txt)|*.txt|All Files(*.*)|*.*|", "", "", false, false);
    if (result[1] ~= "CANCEL") then
    raw_9 = resultthetxt[9]
    raw_9_result = String.Right(raw_9, 14);
    Paragraph.SetText("Paragraph1", raw_9_result);
    end
    What's wrong here?
    OnClick, Line 3: attempt to index global 'resultthetxt' (a nil value)

  7. #7
    Join Date
    Apr 2007
    Location
    Raalte, OV, Netherlands
    Posts
    3,287
    Quote Originally Posted by Pazan View Post
    Well...
    Button OnClick:
    What's wrong here?
    OnClick, Line 3: attempt to index global 'resultthetxt' (a nil value)
    Code:
    result = Dialog.FileBrowse(true, "Open File", "AutoPlay\\Docs", "Text File (*.txt)|*.txt|All Files(*.*)|*.*|", "", "", false, false);
    if (result[1] ~= "CANCEL") then
    resultthetxt = TextFile.ReadToTable(result[1]); --<< You forgot this... <<
    raw_9 = resultthetxt[9]
    raw_9_result = String.Right(raw_9, 14);
    Paragraph.SetText("Paragraph1", raw_9_result);
    end
    Bas Groothedde
    Imagine Programming :: Blog :: Familiar people here

    My AMS Plugins:

  8. #8
    Join Date
    Feb 2009
    Location
    Ukraine
    Posts
    19
    Quote Originally Posted by C B programming and webdesign View Post
    ...
    --<< You forgot this <<[/COLOR]
    resultthetxt = TextFile.ReadToTable(result[1]);
    ...
    [/CODE]
    OnClick, Line 5: Argument 1 must be of type string
    Ok, begin again...
    Content of file, from which I try to load line 9:
    data.txt
    Date: 2009-02-11
    Time: 14:48:51
    OS: Windows XP
    User: Admin
    Screen resolution: 1024х768 pix
    Total RAM: 238 MB
    Host name: IOCTO
    IP: 192.168.100.55
    MAC:0007e91674fc
    End Of file here-----
    Button Code OnClick:
    Code:
    result = Dialog.FileBrowse(true, "Open File", "AutoPlay\\Docs", "Text File (*.txt)|*.txt|All Files(*.*)|*.*|", "", "", false, false);
    if (result[1] ~= "CANCEL") then
    resultthetxt = TextFile.ReadToTable(result[1]);
    raw_9 = resultthetxt[9]
    raw_9_result = String.Right(raw_9, 14);
    Paragraph.SetText("Paragraph1", raw_9_result);
    end
    in result I want to get in Paragraph1:
    0007e91674fc
    and nothing anymore
    Last edited by Pazan; 02-17-2009 at 04:47 AM.

  9. #9
    Join Date
    Aug 2004
    Location
    Somewhere in Texas, USA
    Posts
    417
    You are getting C:0007e91674fc as a result of asking for code that would get 14 symbols from the right of line 9 of your text file.

    If that is no longer what you want take a look at the String.Right in the code and change the 14 to whatever you want it to now return.

  10. #10
    Join Date
    Apr 2007
    Location
    Raalte, OV, Netherlands
    Posts
    3,287
    Why would you want to get that information from a textfile anyway? this is all information you could retrieve yourself.

    For reviewing it later, you could save it as an ini/xml file.
    Bas Groothedde
    Imagine Programming :: Blog :: Familiar people here

    My AMS Plugins:

  11. #11
    Join Date
    Feb 2009
    Location
    Ukraine
    Posts
    19
    Quote Originally Posted by mwreyf1 View Post
    If that is no longer what you want take a look at the String.Right in the code and change the 14 to whatever you want it to now return.
    I know how to select symbols from right in the line. I DON'T KNOW HOW TO GET VALUE FROM LINE 9 INTO VARIABLE THAT'S ALL. When I try to do this I get errors. See above.

  12. #12
    Join Date
    Feb 2009
    Location
    Ukraine
    Posts
    19
    Quote Originally Posted by C B programming and webdesign View Post
    Why would you want to get that information from a textfile anyway?
    Because I get information from users in TXT-file.

  13. #13
    Join Date
    Jun 2001
    Location
    California
    Posts
    2,014
    Quote Originally Posted by C B programming and webdesign View Post
    Why would you want to get that information from a textfile anyway? this is all information you could retrieve yourself.

    For reviewing it later, you could save it as an ini/xml file.
    Ahhhh because he wants to?

  14. #14
    Join Date
    Apr 2007
    Location
    Raalte, OV, Netherlands
    Posts
    3,287
    Quote Originally Posted by Bruce View Post
    Ahhhh because he wants to?
    I have noticed, yes
    Last edited by Imagine Programming; 02-18-2009 at 03:41 AM. Reason: typo
    Bas Groothedde
    Imagine Programming :: Blog :: Familiar people here

    My AMS Plugins:

  15. #15
    Join Date
    Feb 2009
    Location
    Ukraine
    Posts
    19
    Is this question very difficult for guru

Similar Threads

  1. Parsing Data from xml URL to a txt file
    By jimmy guilfoyle in forum AutoPlay Media Studio 7.5
    Replies: 1
    Last Post: 04-08-2008, 11:32 AM
  2. Error 3038: Could not seek in compressed file
    By Rikard in forum Setup Factory 7.0
    Replies: 2
    Last Post: 05-25-2006, 11:55 AM
  3. Replies: 1
    Last Post: 11-27-2005, 09:26 AM
  4. HOWTO: Build a Setup from the Command Line
    By Support in forum Setup Factory 6.0 Knowledge Base
    Replies: 0
    Last Post: 09-27-2002, 02:16 PM
  5. How to append txt file if other file present
    By Dane Lamb in forum Setup Factory 6.0
    Replies: 2
    Last Post: 01-17-2002, 11:39 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts