...

View Full Version : Need some help / im rusty



katalyst
09-23-2007, 03:20 AM
Hey Everyone.. i got a problem and not sure what would be the best route to tackle it.. i attempted it with a batch file but couldn't get it to do what i want.

what i have is:
stores with corporate numbers 001-600 i.e. 001, 002,...099,100,101...600..etc.
and i have a corresponding syntax for ip addresses for the stores so for example:

Store #: 415
Has IP's:
IP1: 100.104.115.227
IP2: 100.104.115.228
IP3: 100.104.115.178
IP4: 100.104.115.179

*Every store follows this same syntax and has the same ips, only part that changes is the bolded numbers which are the corporate number*

What I am attempting to accomplish is to run a loop or something that goes through the corporate numbers (001-600) and will output the 4 corresponding IP's for that store.. all to a txt file.. so for example

***EXAMPLE OUTPUT***
Store # 415 Contains
IP1: 100.104.115.227
IP2: 100.104.115.228
IP3: 100.104.115.178
IP4: 100.104.115.179

Store # 416 Contains
IP1: 100.104.115.227
IP2: 100.104.115.228
IP3: 100.104.115.178
IP4: 100.104.115.179

etc.. all the way to 600

i guess the breaking up of the corp number for the ip syntax is what was throwing me off.. basically im just after the output, but if someone could pass along the code, id appreciate it! not even sure what the best "language" is to do this with

EDIT: also, if it's possible, is there a way to put "http://" at the beginning of each ip so that if i copied the text to excel or something it would auto convert it to a hyperlink? that would be sweet!

Appreciate the consideration!
-Steve

garydarling
09-23-2007, 09:12 AM
What you are looking for is a script; you should try posting your question in one of those forums. What your after can't be done in html or css, which are strictly presentation languages.

Gary

shyam
09-23-2007, 09:41 AM
yup can't be done in html/css but can be done in js :)


<html>
<head>
<script>
window.onload=function(){
var nl = '\r\n', prefix='http://', b = [];
for ( var i = 1; i <= 600; i++ ) {
var v = ( i < 10 ? '00' : (i < 100 ? '0' : '') ) + i;

b.push(v.replace(/^(\d)(\d\d)$/, prefix + '100.10$1.1$2.227'));
b.push(v.replace(/^(\d)(\d\d)$/, prefix + '100.10$1.1$2.228'));
b.push(v.replace(/^(\d)(\d\d)$/, prefix + '100.10$1.1$2.178'));
b.push(v.replace(/^(\d)(\d\d)$/, prefix + '100.10$1.1$2.179'));
}

document.getElementById('test').appendChild(document.createTextNode(b.join(nl)));
}
</script>
</head>
<body>
<pre id="test">
</pre>
</body>
</html>
run once and copy paste

katalyst
09-24-2007, 04:08 PM
awww man! that is awesome!
thanks so much

gonna study that code. ive never done anythign with javascript. but that is really cool man! really appreciate it!

im gonna try editing the format

is there a way i can put a blank line between each store (after every 4 lines) and possibly precede each one with "STORE CORP: *corp number*"?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum