Page 2 of 2 <12
Topic Options
#71279 - 2002-10-30 07:30 PM Re: Copying a file to a range of computers
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
les [Frown]

I know you should have this title too, but you are correct in this one.
actually seems that dave is not sure what he actually wants.

and, what comes to topic title, it's far from fitting to the issue here...
_________________________
!

download KiXnet

Top
#71280 - 2002-10-30 08:04 PM Re: Copying a file to a range of computers
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
I'm not busting on you... You haven't posted anything that I haven't said to my monitor. I'm just too lazy to type it.

I just chalk this type of Thread to GIGO.
or in the words of the New Radicals, "You get what you give"
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#71281 - 2002-10-30 08:13 PM Re: Copying a file to a range of computers
dbeiser Offline
Fresh Scripter

Registered: 2001-03-22
Posts: 34
Loc: Melbourne, FL, USA
First, thanks Sealeopard!

Finally a constructive example I can work from, actually it was so simple it eluded me. I’m under a time crunch and must have been thinking to much.

Second,

I agree with Radimus, Lligetfa's needs a name change, let's try "The Canadian SLAMMER!". Of course, the Canadian explains it all, “GO WINGS!”  He he he

Let me first get this off my chest. It's been a while since my last request for help (months) and I've noticed a huge shift in attitude here. This use to be a place you could ask a simple question, not expecting much, and eagerly get a script back instead. Not all this BS I've been getting over the past few hours.

Hey lligetfa, how about constructively explaining what I could do to improve my scripting (I’m not a programmer) vs. telling what I can't do?

What’s with your obsession with the range of numbers? Code is code; it should be flexible enough to accommodate any range of numbers!

With that said….

With that in mind, why don’t you use my outline of code and show me how you would approach the problem? And explain why I need to use Val()

Thanks,
_________________________
Dave Melbourne, FL

Top
#71282 - 2002-10-30 08:25 PM Re: Copying a file to a range of computers
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
by default if you use substr() to pull characters from a string, it returns it to you as a string.

therefore if you to a compare of "19" and "4" as strings, the "4" would be greater.

Use val() and it uses the numeric value.

Les (and others here) have no problem in helping here. He just wants specifics.

What you asked for in the first post, is not what you asked from in the later ones.
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#71283 - 2002-10-30 09:02 PM Re: Copying a file to a range of computers
dbeiser Offline
Fresh Scripter

Registered: 2001-03-22
Posts: 34
Loc: Melbourne, FL, USA
Thanks for the input Radimus.

The example sealeopard posted appears to work for all three ranges, however I think I'll tinker with the val() and try to incorporate it.

I still stand by my first post. I thought it was pretty straight forward, a range is a range; I should be able to plug any range into the code and have it work.

Timeout, I just thought of something. I can't use the val() statement, The letter in front of the number is required to determine the range. I'm not comparing just the range of numbers, I'm also comparing the letter designator. E for East, W for West, and M for Main. I have to know which floor it's on because the numbers are duplicated on all 3 floors.

Thoughts?

Thanks again.

[ 30. October 2002, 21:14: Message edited by: dbeiser ]
_________________________
Dave Melbourne, FL

Top
#71284 - 2002-10-30 09:05 PM Re: Copying a file to a range of computers
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
A range is a range, however, the script must be aware of the permitted ranges.

Also, it's always better to code on the more generic side and not hardcode stuff. Thus, you might want to put your range assignments into a .INI file and use that as a basis. Then you just need to changes those entries without changing any code.
_________________________
There are two types of vessels, submarines and targets.

Top
#71285 - 2002-10-30 09:06 PM Re: Copying a file to a range of computers
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
OK Dave, you asked...

Your first post was very vague. In my opinion not enough to go on.

I asked about perms but didn't get an answer until post #7.

You did not indicate whether this was to be an admin or logon script. we sort of deduced that by around post #16.

You kept changing the rules about ranges. Once they were non-contiguous the code had to change.
I think Rad explained the string vs. numeric thingy. I think he also explained it with the computer term GIGO. At a post count of 24 I thing there was both GI and GO.

I'm sorry if you think my bedside manners stink. BTW, you're not the first to say it. I'll try to remember to add dbeiser to my ignore list to save you from further exposure to it.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#71286 - 2002-10-30 09:07 PM Re: Copying a file to a range of computers
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
In you first example you defined 3 ranges of standard machine names as:
quote:
xxxxxE1 - xxxxxE100 (East Floor)
xxxxxM1 - xxxxxM400 (Main Floor)
xxxxxW1 - xxxxxW200 (West Floor)

You stated that you needed to get three different hosts file to these computers. My substr() above did just that based on the letter. the code would have let you execute the script on your client and update every computer that was turned on.

Anyway, I am glad that you received the feedback you needed to move forward.

[ 30. October 2002, 21:09: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#71287 - 2002-10-30 09:46 PM Re: Copying a file to a range of computers
dbeiser Offline
Fresh Scripter

Registered: 2001-03-22
Posts: 34
Loc: Melbourne, FL, USA
Howard,

I think theirs some confusion from my first post. I am not sorting by N, E, W. I apologize, I didn't have the exact workstation names until about post 12 and just used those names as an example.

Here's the exact range:

usmlbm74 thru usmlbm88 (gets hostfile1 copied)

usmlbm130 thru usmlbm144 (gets hostfile2 copied)

usmlbm146 thru usmlbm160 (gets hostfile3 copied)

I need to determine if the @WKSTA falls within the above range and copy the appropriate host file to it.

Hence, Sealeopard's example appears to work.
_________________________
Dave Melbourne, FL

Top
#71288 - 2002-10-30 10:22 PM Re: Copying a file to a range of computers
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Then you do
code:
$number=val(substr(@WKSTA,7))
select
case $number>=74 and $number <=88
case $number>=130 and $number<=144
case $number>=146 and $number<=160
endselect

And please provide more info the next time, we all have a paying job in addition to our KiXtarting and thus we'd like to help as fast as possible without pulling the details out of one's nose.
_________________________
There are two types of vessels, submarines and targets.

Top
Page 2 of 2 <12


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 369 anonymous users online.
Newest Members
rrosell, PatrickPinto, Raoul, Timothy, Jojo67
17877 Registered Users

Generated in 0.061 seconds in which 0.026 seconds were spent on a total of 14 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org