#191628 - 2009-01-05 09:40 PM
Xporting words starting with specific letters from 1 kix script to txt file
|
Reg_D
Fresh Scripter
Registered: 2008-10-29
Posts: 12
|
Hi Guys,
Im trying to export workstation names from a Kix script into a text file
so for instance. I have a kix scripts that has a If @wksta = "ws****" ? do this else ?do this
so i want to have a script that looks through the existing script and finds any words with WS at the beggining of it and exports the whole name of the computer to a text document then moves onto the next. this is so they can be used later to have a script that moves them all into a group in AD. There are about 400 of them, hense wanting to do it scripted. Im hoping someone out there can give me a pointer in the right direction.
Much appreciated :-)
|
Top
|
|
|
|
#191629 - 2009-01-05 09:50 PM
Re: Xporting words starting with specific letters from 1 kix script to txt file
[Re: Reg_D]
|
eriqjaffe
Hey THIS is FUN
Registered: 2004-06-24
Posts: 214
Loc: Arlington Heights, IL USA
|
You can use the Left() function to determine if the pattern matches:
if left(@WKSTA,2) = "ws"
do something
else
do something else
endif
|
Top
|
|
|
|
#191632 - 2009-01-05 10:00 PM
Re: Xporting words starting with specific letters from 1 kix script to txt file
[Re: eriqjaffe]
|
Reg_D
Fresh Scripter
Registered: 2008-10-29
Posts: 12
|
cheers for that, tis appreciated
just wondering how you incorporate that into reading a script first???
has got me...... wanna basically run like a find that you can do in notepad and when it finds a result export it to a text doc.
might not even be possible??
Cheers
|
Top
|
|
|
|
#191634 - 2009-01-05 10:28 PM
Re: Xporting words starting with specific letters from 1 kix script to txt file
[Re: Lonkero]
|
Reg_D
Fresh Scripter
Registered: 2008-10-29
Posts: 12
|
Ha ha, the optimist :-)
|
Top
|
|
|
|
#191638 - 2009-01-05 10:39 PM
Re: Xporting words starting with specific letters from 1 kix script to txt file
[Re: Lonkero]
|
Reg_D
Fresh Scripter
Registered: 2008-10-29
Posts: 12
|
sorry, I perhaps have been sloppy in explaining. I have a script with:
if @wksta = "ws****
|
Top
|
|
|
|
#191640 - 2009-01-05 10:45 PM
Re: Xporting words starting with specific letters from 1 kix script to txt file
[Re: Reg_D]
|
Reg_D
Fresh Scripter
Registered: 2008-10-29
Posts: 12
|
sorry computer went funny.
I think perhaps have been sloppy in explaining. I have a script currently with:
if @wksta = "ws****1" do this else do this endif
if @wksta = "ws****2 do this else do this endif
which serves a purpose for another app. this then repeats about 4 hundred times and the ws number is unique every time. I want a script to read all these WS values and export them on their own to a text document seperated by a comma (preferably).
Hope that is clearer
|
Top
|
|
|
|
#191642 - 2009-01-05 11:18 PM
Re: Xporting words starting with specific letters from 1 kix script to txt file
[Re: Reg_D]
|
Gargoyle
MM club member
   
Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
|
Not a silver platter, but to get you on the right track....
Open(1,"TheScript.KIX",2)
Open(2,"TheOutPut.CSV",5)
$Line = Readline(1)
While @Error = 0
$Array = Split($Line," ")
$Location = Left(ASCAN($Array,"ws"),3)
If $Location > -1
Writeline(2,$Array[$location] + ",")
EndIf
$Line = Readline(1)
Loop
Close(1)
Close(2)
_________________________
Today is the tomorrow you worried about yesterday.
|
Top
|
|
|
|
#191668 - 2009-01-06 10:44 AM
Re: Xporting words starting with specific letters from 1 kix script to txt
[Re: NTDOC]
|
Reg_D
Fresh Scripter
Registered: 2008-10-29
Posts: 12
|
Cheers guys, I'll look into that today.
not really done anything like gargoyles solution before. be a good learning curve :-)
Cheers again
|
Top
|
|
|
|
#191678 - 2009-01-06 09:11 PM
Re: Xporting words starting with specific letters from 1 kix script to txt
[Re: Reg_D]
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11625
Loc: CA
|
Give it a try before Jooel get's bored and Golf's it down to something unreadable
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 1574 anonymous users online.
|
|
|