Extracting a value from a file
Posted: Tue Oct 22, 2013 12:21 am
Hi, I'm have an apps (currency converter/calculator) I made that works pretty
good but after a while I see that I could make improvements. I used a test stack
for the part I want to improve with the code below. Basically this get the rate
from the web and put it in field rate and then I use it for calculation. I would
like to change the line of code "get line 480 of myfile" because once in awhile
changes are made to the web page and I have to change the line number in my
coding. I tried using FIND , SEARCH but that did not work, I think READ FROM
FILE seems a good guess but could not get it to work. The commented lines are
the one before and after line 480. Could you steer me toward the right keyword
and some basic hint how to solve this. Many thanks TIA.
byg
on mouseUp
set the numberformat to "#.000"
get url "http://www.canadianforex.ca/currency-converter/?
cid=273&gclid=COeg6IiroLQCFQqk4AodcWoAXQ"
put it into myfile
-- " = <strong>"
get line 480 of myfile
-- " <strong>"
put "$" && it + 0 into field "rate"
end mouseUp
good but after a while I see that I could make improvements. I used a test stack
for the part I want to improve with the code below. Basically this get the rate
from the web and put it in field rate and then I use it for calculation. I would
like to change the line of code "get line 480 of myfile" because once in awhile
changes are made to the web page and I have to change the line number in my
coding. I tried using FIND , SEARCH but that did not work, I think READ FROM
FILE seems a good guess but could not get it to work. The commented lines are
the one before and after line 480. Could you steer me toward the right keyword
and some basic hint how to solve this. Many thanks TIA.
byg
on mouseUp
set the numberformat to "#.000"
get url "http://www.canadianforex.ca/currency-converter/?
cid=273&gclid=COeg6IiroLQCFQqk4AodcWoAXQ"
put it into myfile
-- " = <strong>"
get line 480 of myfile
-- " <strong>"
put "$" && it + 0 into field "rate"
end mouseUp