473,394 Members | 1,845 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How to get the runtime value

Ben
I posted on this forum several days ago and got helpful replies. but,
most replies directed to html file download. I rephrase my question
here.

I am working on a project collecting data from web. Since there are
many URLs I need to visit and manually copy the data, I am thinking to
automate this job.

I plan to use WSH to retrieve the webpages, extract the values and save
those numbers to a local fie.(Please let me know if you have better
solutions.) However, the javascipt becomes my enemy this time.

I made a simple example here.
-----------------------
<html<body>
<script>
n1 = 25
v1 = '<a href="a.htm"file_' + n1 + '</a>'
document.write(v1)
</script>
</body</html>
------------------------

v1 is equal to '<a href="a.htm"file_25 </a>'. However, the runtime
value of v1 is not retrievable from the downloaded file.

If I need to get the runtime value of v1, what should I do?

Thanks,

Ben

Jan 4 '07 #1
6 2536
Ben wrote on 04 jan 2007 in comp.lang.javascript:
I posted on this forum several days ago and got helpful replies. but,
most replies directed to html file download. I rephrase my question
here.

I am working on a project collecting data from web. Since there are
many URLs I need to visit and manually copy the data, I am thinking to
automate this job.

I plan to use WSH to retrieve the webpages, extract the values and save
those numbers to a local fie.(Please let me know if you have better
solutions.) However, the javascipt becomes my enemy this time.

I made a simple example here.
-----------------------
<html<body>
<script>
n1 = 25
v1 = '<a href="a.htm"file_' + n1 + '</a>'
document.write(v1)
</script>
</body</html>
------------------------

v1 is equal to '<a href="a.htm"file_25 </a>'. However, the runtime
value of v1 is not retrievable from the downloaded file.

If I need to get the runtime value of v1, what should I do?
I have no idea what you mean by "runtime value" here.
You can simply do something like: alert(v1)

If you want to retrieve the content of the body element,
use innerHTML

<html<body onload='alert(document.body.innerHTML)'>
<script type='text/javascript'>
var n1 = 25
var v1 = '<a href="a.htm"file_' + n1 + '</a>'
document.write(v1)
</script>
</body</html>

==============================

I doubt if the above will bring you to automaic fetching.

Why, as I showed you before, not use XMLHTTP GET?

If you can get the content of the html files downloaded,
you will be in the clear, or not?

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jan 4 '07 #2
Ben
Dear Evertjan,

I followed your suggestion to use XMLHTTP GET. The problem is I need
to copy the values saved in variables which are dynamically generated
when the javascript is executed in a web browser.

When I download the file from web, it is a plain html text. I have to
open the file in a web browser to manually copy the string. In this
example, it is saved in v1 and equals
'<a href="a.htm"file_25 </a>'.

Thanks.

Ben

Evertjan. wrote:
Ben wrote on 04 jan 2007 in comp.lang.javascript:
I posted on this forum several days ago and got helpful replies. but,
most replies directed to html file download. I rephrase my question
here.

I am working on a project collecting data from web. Since there are
many URLs I need to visit and manually copy the data, I am thinking to
automate this job.

I plan to use WSH to retrieve the webpages, extract the values and save
those numbers to a local fie.(Please let me know if you have better
solutions.) However, the javascipt becomes my enemy this time.

I made a simple example here.
-----------------------
<html<body>
<script>
n1 = 25
v1 = '<a href="a.htm"file_' + n1 + '</a>'
document.write(v1)
</script>
</body</html>
------------------------

v1 is equal to '<a href="a.htm"file_25 </a>'. However, the runtime
value of v1 is not retrievable from the downloaded file.

If I need to get the runtime value of v1, what should I do?

I have no idea what you mean by "runtime value" here.
You can simply do something like: alert(v1)

If you want to retrieve the content of the body element,
use innerHTML

<html<body onload='alert(document.body.innerHTML)'>
<script type='text/javascript'>
var n1 = 25
var v1 = '<a href="a.htm"file_' + n1 + '</a>'
document.write(v1)
</script>
</body</html>

==============================

I doubt if the above will bring you to automaic fetching.

Why, as I showed you before, not use XMLHTTP GET?

If you can get the content of the html files downloaded,
you will be in the clear, or not?

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jan 4 '07 #3
VK

Ben wrote:
I am working on a project collecting data from web. Since there are
many URLs I need to visit and manually copy the data, I am thinking to
automate this job.

I plan to use WSH to retrieve the webpages, extract the values and save
those numbers to a local fie.(Please let me know if you have better
solutions.) However, the javascipt becomes my enemy this time.

I made a simple example here.
-----------------------
<html<body>
<script>
n1 = 25
v1 = '<a href="a.htm"file_' + n1 + '</a>'
document.write(v1)
</script>
</body</html>
------------------------
Sign it off on my part but I'm still not clear about the exact
procedure. Could you please provide a URL of a page similar to one you
are working with? That doesn't have to be a real page from your set -
though that would be optimal - just any page having a similar data in
similar form.
Then just comment on this URL by steps:
1) get the URL
2) find ...
3) ...

Jan 4 '07 #4
Ben wrote on 04 jan 2007 in comp.lang.javascript:
Evertjan. wrote:
>==============================

I doubt if the above will bring you to automaic fetching.

Why, as I showed you before, not use XMLHTTP GET?

If you can get the content of the html files downloaded,
you will be in the clear, or not?
[Please, PLEASE do not toppost on usenet,
and only quote what is relevant to your reply,
so also do not copy the signature, below the --]
I followed your suggestion to use XMLHTTP GET. The problem is I need
to copy the values saved in variables which are dynamically generated
when the javascript is executed in a web browser.
As long as you know the clientside code, you can dublicate that in your
code. I suppose some serverside starting values must be brought to the
client?
When I download the file from web, it is a plain html text. I have to
open the file in a web browser to manually copy the string. In this
example, it is saved in v1 and equals
'<a href="a.htm"file_25 </a>'.
Yes, you are working without the help or the approval of the page owner,
it seems. So you will have to do some work analyzing his page yourself,
and completely understand the clientside code. How else would you know
where in the text the values are you want?

Else you would have to break into the DOM,
which seems very difficult to automate.

Please do not infringe on an other's copyright.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jan 4 '07 #5
"Ben" <la******@gmail.comwrote in news:1167936633.083168.124630@
42g2000cwt.googlegroups.com:
I am working on a project collecting data from web. Since there are
many URLs I need to visit and manually copy the data, I am thinking to
automate this job.

I plan to use WSH to retrieve the webpages, extract the values and save
those numbers to a local fie.(Please let me know if you have better
solutions.) However, the javascipt becomes my enemy this time.

I made a simple example here.
-----------------------
<html<body>
<script>
n1 = 25
v1 = '<a href="a.htm"file_' + n1 + '</a>'
document.write(v1)
</script>
</body</html>
------------------------

v1 is equal to '<a href="a.htm"file_25 </a>'. However, the runtime
value of v1 is not retrievable from the downloaded file.

If I need to get the runtime value of v1, what should I do?

Let me see if I can rephrase this slightly. If you retrieve the above
web page (using any method) into a text file and view (or search, or
extract text from) the file, all you see is the source code, including
the JS.

However, the browser evaluates the JS and displays the HTML '<a
href="a.htm"file_25 </a>' which renders on the browser's screen as the
link 'file_25'.

From the downloaded text file, he wants to extract the value 'file_25'.
How can he do that?

Jan 5 '07 #6
Ben
Yes. This is exactly what I want to say. What I want is not the source
code. I want to get the saved data in javascript variables.
Let me see if I can rephrase this slightly. If you retrieve the above
web page (using any method) into a text file and view (or search, or
extract text from) the file, all you see is the source code, including
the JS.

However, the browser evaluates the JS and displays the HTML '<a
href="a.htm"file_25 </a>' which renders on the browser's screen as the
link 'file_25'.

From the downloaded text file, he wants to extract the value 'file_25'.
How can he do that?
Jan 5 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: lovecreatesbeauty | last post by:
I ever missed a `return' statement when write a function `int HighDigit(Num)' to get the highest digit of an integer. But even if the `return' statement is ignored the function still can obtain...
2
by: Arif Khan | last post by:
Hi, I want to write down a function entry point logging method, allowing logging of passed in parameters values along with function name and parameter names. I know I can get the parameter name and...
0
by: zfraile | last post by:
I'm getting this error from the JIT compiler at runtime, but only on my boss' machine, not my development machine. I believe the error is generated from a call to an Excel object, but I can't tell...
1
by: vinoda2005 | last post by:
Hi frriends, here is a small problem.In the following code,how to get the runtime value into 'a' here?please help me. switch (a) { case 1: System.out.println("one"); break; case...
4
by: caulagi | last post by:
Hello! I want to write - public double CycleTime { get { return cycletime; } }
7
by: ravi | last post by:
Hi, I am a newbie to javascript. Iam working on a page that has two radio buttons and a tree. I do not have my tree nodes to be selectable. Iam working on Firefox. I have the firebug...
9
by: manish | last post by:
we have avariablr int bps; // bps determined during run time - - - how can we make conditional declaration of a variable y we want appropriate declaration depending upon bps.
7
by: Norman Diamond | last post by:
A project depends on VC runtime from Visual Studio 2005 SP1, and DotNet Framework 2. Options are set in the setup project properties, so if these two dependencies are not already installed then...
14
by: KK | last post by:
Dear All I have a small problem with using as operator on value type array. Here is an example what I am trying to do. using System; using System.Collections.Generic; using System.Text;
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.