Page 2 of 3

Re: How to read from a file every 3 lines until eof

Posted: Wed Jun 10, 2015 4:42 pm
by jacque
dunbarx wrote: The process runs 30% SLOWER if I do not empty the fields. I only did that for feedback. It actually takes a little time to empty them. I get about 315 ticks if I empty, and 400 if I do not
It would probably take about the same amount of time if you start the timer before the first two lines that empty the fields. Or did you try that?

Re: How to read from a file every 3 lines until eof

Posted: Thu Jun 11, 2015 6:20 am
by alemrantareq
Hi jacque, its really amazing; the process that took about 3 mins now just completed within 10 secs for taking the result into a variable. Special Thanks to you and Craig for the amazing trick. Btw, can you tell me is it possible to scroll 2 fields at the same time? I mean if I scroll field 1, it will auto scroll field 2 too. Thanks

Re: How to read from a file every 3 lines until eof

Posted: Thu Jun 11, 2015 10:52 am
by zaxos
How bout showing a loading animation while livecode procceses the data? Even tho it dosent show the exact percentage of the progress, atleast the user knows that he has to wait.
You can find some here: http://preloaders.net/en/circular
As for the scrollBars i guess you could do something like that:
field 1 code:

Code: Select all

on scrollbardrag 
 set the thumbPosition of fld 1 to the thumbPosition of me
end scrollbardrag
field 2 code:

Code: Select all

on scrollbardrag 
 set the thumbPosition of fld 2 to the thumbPosition of me
end scrollbardrag

Re: How to read from a file every 3 lines until eof

Posted: Thu Jun 11, 2015 12:13 pm
by Klaus
Hi zaxos,

Code: Select all

set the thumbPosition of fld 2...

Are you sure? :shock:


Best

Klaus

Re: How to read from a file every 3 lines until eof

Posted: Thu Jun 11, 2015 12:58 pm
by alemrantareq
thanks zaxos; I've corrected your script to the working one

Code: Select all

on scrollbarDrag
   set the vScroll of fld "f2" to the vScroll of me
end scrollbarDrag

Re: How to read from a file every 3 lines until eof

Posted: Thu Jun 11, 2015 1:09 pm
by Klaus

Code: Select all

on scrollbarDrag
   set the vScroll of fld "f2" to the vScroll of me
end scrollbarDrag
Yep, now THAT makes sense :D

Re: How to read from a file every 3 lines until eof

Posted: Thu Jun 11, 2015 1:14 pm
by alemrantareq
Klaus wrote:

Code: Select all

on scrollbarDrag
   set the vScroll of fld "f2" to the vScroll of me
end scrollbarDrag
Yep, now THAT makes sense :D
:D :D :D

hi Klaus, I have a Menubar which has a background color (check my snapshot) although I've checked in its Property Inspector there's no background color set. Is it possible to remove that background color?

Re: How to read from a file every 3 lines until eof

Posted: Thu Jun 11, 2015 1:49 pm
by Klaus
If you do not explicitely set a property, it gets inherited from the object higher in hierarchie like this:
button -> group -> card -> stack

So the best way in your case is to uncheck the OPAQUE property for your buttons! :D

Re: How to read from a file every 3 lines until eof

Posted: Thu Jun 11, 2015 2:18 pm
by alemrantareq
I've edited the menu group and uncheck "Opaque" option for both buttons; but still it's showing the background :(

Re: How to read from a file every 3 lines until eof

Posted: Thu Jun 11, 2015 2:29 pm
by Klaus
Then you see the color of the object(s) BEHIND your buttons! 8)

Set a backcolor for your buttons so they look like they have NO color set, know what I mean?

Re: How to read from a file every 3 lines until eof

Posted: Thu Jun 11, 2015 2:52 pm
by alemrantareq
I've already tried that before; but it's not effective though. Then I've removed the menubar built by "Menu Builder"; and created a new pulldown menu which has no background color and perfect as I expected. The problem goes with the "Menubar Builder" menu. But Klaus, I'm always thankful for your tricky replies :D

Re: How to read from a file every 3 lines until eof

Posted: Thu Jun 11, 2015 3:59 pm
by jacque
Menu builder creates a transparent menu group. You can make it opaque and stretch it to fit the width of your stack, and then set its color to anything you want. Then I usually make all the menu buttons transparent.

Re: How to read from a file every 3 lines until eof

Posted: Thu Jun 11, 2015 4:03 pm
by jacque
[quote="alemrantareq"]Hi jacque, its really amazing; the process that took about 3 mins now just completed within 10 secs for taking the result into a variable. Special Thanks to you and Craig for the amazing trick./quote]

Quoting all literals, like object names, is another way to speed up scripts. The effects aren't as dramatic as using variables instead of fields, but in repeat loops the differences are noticeable. Always quote literals.

Re: How to read from a file every 3 lines until eof

Posted: Sun Jun 14, 2015 7:20 pm
by alemrantareq
hello, now I'm stuck again. I have 2 columns:

Col 1 (sample)
sjjwjas
dwaiask
dlawla
hylallu

Col 2 (sample)
31316
63676
97761
41731

I want to combine then together. So the expected return will be:
sjjwjas-31316
dwaiask-63676
dlawla-97761
hylallu-41731

Is that possible by repeat loop process? thanks...

Re: How to read from a file every 3 lines until eof

Posted: Mon Jun 15, 2015 5:25 am
by dunbarx
HI.

Code: Select all

repeat with y = 1 to the number of lines of fld "sample1"
put line y of fld "sample1" & "-" & line y of fld "sample2" into line y of temp
end repeat
put temp into fld "combinedData"
See any traps with this?

And you are working on the basics of LC while all this is going on, right?

Craig