Save whole array in a file without error ( dangerous )

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
olllllliii
Pro Scripter
Posts: 60
Joined: Tue Dec 22, 2009 9:51 am
Location: Mannheim ( Germany )
Contact:

Save whole array in a file without error ( dangerous )

Post by olllllliii » Wed Oct 06, 2010 9:30 am

Code: Select all

Let>SEMI=;

// Fill 2 Arrays
Let>Memotext=1;2;3;4;5;6;7;8
        Let>Memouser=call;look;wash;cool;iron;clean;PS3;something
        Separate>Memotext,;,arrItems
        Separate>Memouser,;,arrItemsU

  Let>k=1
  ArrayCount>arrItems,nmax

///
/// Some code to edit add or del some elements
///

    // Now i want to save that information to a file
    // I tried that with Concat ...but doesnt work

    Let>i=0
    Repeat>i
        Add>i,1
        Let>users=%users%+arrItems_%i%+%SEMI%
        Let>lines=%lines%+arrItemsU_%i%+%SEMI%
    Until>i,nmax

    // Write to file
    Let>WLN_NOCRLF=0
    WriteLn>c:\Programme\NETNODE\user.txt,nWLNRes,users
    Let>WLN_NOCRLF=0
    WriteLn>c:\Programme\NETNODE\data.txt,nWLNRes,lines

// Does someone know a way to concat the _1 _2 elements together in
// one variable ( IF i use ignore errors the programm gets unstable )[code]

[/code]
Oliver Hilger Mannheim
alias Olllllliii

adroege
Automation Wizard
Posts: 438
Joined: Tue Dec 07, 2004 7:39 pm

Post by adroege » Wed Oct 06, 2010 11:45 am

Try this. It is fixed now.

Code: Select all

//Set IGNORESPACES to 1 to force script interpreter to ignore spaces.
//If using IGNORESPACES quote strings in {" ... "}
//Let>IGNORESPACES=1
Let>SEMI=;

// Fill 2 Arrays
Let>Memotext=1;2;3;4;5;6;7;8
        Let>Memouser=call;look;wash;cool;iron;clean;PS3;something
        Separate>Memotext,;,arrItems
        Separate>Memouser,;,arrItemsU

  Let>k=1
  ArrayCount>arrItems,nmax

///
/// Some code to edit add or del some elements
///

  // Now i want to save that information to a file
  // I tried that with Concat ...but doesnt work
  
  Let>users=
  Let>lines=

    Let>i=0
    Repeat>i
        Add>i,1
        Let>String1=arrItems_%i%
        Let>String2=arrItemsU_%i%
        Let>users=%users%%String1%%SEMI%
        Let>lines=%lines%%String2%%SEMI%
    Until>i,nmax

    // Write to file
    Let>WLN_NOCRLF=0
    WriteLn>c:\user.txt,nWLNRes,users
    Let>WLN_NOCRLF=0
    WriteLn>c:\data.txt,nWLNRes,lines



Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts