Load from txt

150 views
Skip to first unread message

mh

unread,
May 25, 2012, 6:51:07 AM5/25/12
to fak...@googlegroups.com
hi,

I found this example:

https://skitch.com/itod/gwgca/screen-shot-2011-12-26-at-10.22.55-pm

and tried it. (See attachement)
But I allways got the message "Variable not found: mail"
What I did wrong?



Unbenannt-1.jpg

Todd Ditchendorf

unread,
May 25, 2012, 11:38:24 AM5/25/12
to fak...@googlegroups.com
Hi mh, sorry that example is incomplete. You must add a single line of JavaScript to the end of your "Do JavaScript" Action:

fake.set('mail', mail);

TD

mh

unread,
May 25, 2012, 12:35:12 PM5/25/12
to fak...@googlegroups.com
thx itod,

that works fine for one line in my txt.
With two lines in my txt, the script repeats two times, and overwrites itself.
hope you understand me :-/

On the first run both html elements get the value of my first line in the txt.
On the second run both html elements get the value of my second line in the txt...
Unbenannt-1.jpg

Todd Ditchendorf

unread,
May 25, 2012, 3:08:00 PM5/25/12
to fak...@googlegroups.com
hi mh,

you have an error in your JS. check your indexes. (items[1] is used twice)

TD

mh

unread,
May 25, 2012, 4:15:51 PM5/25/12
to fak...@googlegroups.com
hi,

that makes not really a difference . If I use the index [0] I got the value before the ":" , if I use index [1], I got the value behind the ":".
I attached an image which shows the loops.
It repeats two times, after the first loop I got both value from line one, after the second loop I got both value from line 2.
What I what is, the second value of line 1, and the second value of line 2.

thanks for helping me :)
Unbenannt-1.jpg

Todd Ditchendorf

unread,
May 25, 2012, 5:19:03 PM5/25/12
to fak...@googlegroups.com
On Fri, May 25, 2012 at 1:15 PM, mh <michi...@googlemail.com> wrote:
hi,

that makes not really a difference . If I use the index [0] I got the value before the ":" , if I use index [1], I got the value behind the ":".

Yes, that is correct. And that is correct/expected behavior.
 
I attached an image which shows the loops.
It repeats two times, after the first loop I got both value from line one, after the second loop I got both value from line 2.
What I what is, the second value of line 1, and the second value of line 2.

it will be easiest to just edit your text file to include the items you want together on the same line.

If you can't edit your text file, then you'll have to buffer up the values and only spit them out on the page every other loop. This is possible with some JavaScript work.

TD

mh

unread,
May 26, 2012, 3:43:51 AM5/26/12
to fak...@googlegroups.com
thx for your respond,

I can't edit my txt file, so I have to buffer the values.
Is it possible to give me an easy example? I really have no idea to do it with JS.
That would be very helpful. :)

thx itod 
Reply all
Reply to author
Forward
0 new messages