parsing
Hi,
I've some textfiles which i would like to import. In one textfile there are
over 1024 columns when separated. This exceeds sql server's maximum columns.
Let call this the resultfile.
In the other texfile i've got a descriptionfile about the resultfile. The
description contains the columnnames of the resultfile (see below for
example). The problem with the resultfile is that it doesn't contain any
columnnames, but the columns appear in order of the descriptionfile.
The tricky part is that there are columns which really represents 1 column
(those columns has the same name but with an indexnumber). The values in
those columns need to be changed into the indexnumber, but start from zero.
Then data should be transformed
For example (never mind the values):
id | field1_1 | field1_2 | field2 | field3
1 | empty 1 1 2003
Above should be:
id | name | value
1 field1_1 | empty
1 field1_2 | 1 (should be 2, but i want i the index to start from 0, so it
is 1)
1 field2 | 1
1 field3 | 2003
Descriptionfile example:
formid fieldnr fieldname idx length
1 1 field0 0 2
1 2 field1 1 1
1 3 field1 2 1
1 4 field2 0 2
1 5 field3 0 4
Can someone help me on this, i want to use a vbscript in a sql dts package?
This bustin my brains for weeks Tag: website hosting Tag: 166394
Trip to Disney
GET YOUR TRIP
TRIPS TO DESNEY
TRIPS TO HAWAII
http://travelexpert2004.us
http://travelexpert2004.biz
http://gotraveling85.us Tag: website hosting Tag: 166391
Edit/Delete section of an ini file
I need to write a string value to a section of an ini file. I managed to
write to it but it appends to existing values. I need to either edit the
current value or delete the values in the section in question before I write
new values
For example:
file ="C:\VBS\myConfig.ini"
Section = "ORACLE TO SQL SERVER"
item = "CASE_X"
Value = "XYZ"
ini file output:
[ORACLE TO SQL SERVER]
CASE_X=ABC
CASE_X=XYZ
CASE_X=XYZ
DB_NAME=YYY
LSNAME=orclDB
DTSERROR_O2S="C:\sqlConfig\dtsError\orcl_2_mssql\xxx.txt"
How do I edit the original value of ABC to XYZ without having to write new
lines as I need only I line for CASE_X Values. Any input would be greatly
apreciated
--
fhillipo Tag: website hosting Tag: 166389
way to put clipboard information into file txt....please
hello,
i would like to know if it's possible to put clipboard information into file
txt or worksheet excel cell.
i m beginner in vbscript and i don't understand how to make object and
class....etc.
My code is :
Set Fmobject = CreateObject("Scripting.FileSystemObject")
Set Fm1 = Fmobject.createtextfile("c:\text.txt") 'création file txt
Text = "hello, i'm french " 'i would like past the clipboard information
Fm1.WriteLine (Text)
Fm1.Close
thank for your help !!! Tag: website hosting Tag: 166387
Way to recursively Find pre-defined files (from list) and Copy to new Dir?
Hi - haven't had any luck finding this type of script:
1. I have a pre-defined list of filenames (stored in a plain txt document
called 'files.txt')
2. I'd like to write a script that will search the file system For each
file in the plain txt document (could be nested in sub-directories) and copy
them to a new location
I've found plenty of examples for finding types of files (i.e. .mp3's,
.zip's, etc.) but nothing that will let me pass in specific (& unique)
filenames.
Thanks for your help! Tag: website hosting Tag: 166369
Interrogating Active Directory Computers
Hi,
The problem is that the script stops (in error) when a computer is not
powered on.
I want the script to move on to the next computer in the active directory.
Maybe I can test on a pingresult ? But how to implement a ping ?
And what is the exactly output when a computer i powerd on ?
Greetz,
Wim.
'*********************************************
'*
'* Search adressbooks in Active Directory computers, via FileSystemObject
'*
'*
'**********************************************
on error resume next
Dim objDSE, strDefaultDN, strDN, objContainer, objChild
Dim Fso, Drives, Drive, Folder, Files, File, Subfolders,Subfolder 'First
of all, you have declare the variables and create the FileSystem object.
Dim strComputer
'***************************
' Create Excel File
'***************************
Set objExcel = WScript.CreateObject("Excel.Application") 'Create Excell
file
objExcel.Visible = True
objExcel.Workbooks.Add
objExcel.ActiveSheet.Name = "Adresbooks"
objExcel.ActiveSheet.Range("A1").Activate
objExcel.ActiveCell.Value = "PC" 'col header 1
objExcel.ActiveCell.Offset(0,1).Value = "Location 1" 'col header 2
objExcel.ActiveCell.Offset(0,2).Value = "Location 2" 'col header 3
objExcel.ActiveCell.Offset(0,3).Value = "Location 4" 'col header 2
objExcel.ActiveCell.Offset(0,4).Value = "Location 5" 'col header 2
objExcel.ActiveCell.Offset(1,0).Activate 'move 1 row down
'***************************
' Run through Active directory
' searching for computers
'***************************
Set objDSE = GetObject("LDAP://rootDSE")
strDefaultDN = objDSE.Get("defaultNamingContext")
strDN = InputBox("Enter the distinguished name of a container" & vbCrLf &
"(e.g. " & strDefaultDN & ")", , strDefaultDN)
If strDN = "" Then WScript.Quit(1) 'user clicked Cancel
Set objContainer = GetObject("LDAP://" & strDN)
Call ListUsers(objContainer)
wscript.echo "Script finished"
Sub ListUsers(objADObject)
Dim objChild
For Each objChild in objADObject
Select Case objChild.Class
Case "computer"
strComputer=objChild.cn
'wscript.echo strComputer
AdresboekZoeken(strComputer) 'search adressbook
Case "organizationalUnit" , "container"
Call ListUsers(objChild)
End select
Next
End Sub
'****************************************
'Search adressbook on remote computer
'****************************************
Sub AdresboekZoeken(Computer)
Set Fso=createobject("scripting.filesystemobject") 'Then, Set the Drives
object, so you can search in all the available drives of the computer
Set Drives=fso.drives
pc= "\\" & computer & "\c$"
wscript.echo pc
Dosearch pc 'Dosearch is the name of the function that we'll use to
search for files and subfolders.
wscript.echo "Finished searching on pc " & computer
End Sub
Function Dosearch(Path)
Set Folder=fso.getfolder(path) 'Get the folder where we have to work.
Set Files = folder.files 'Get all the files inside this folder
For Each File in files 'File is the current file where we are 'Now do a
for-each for each file
'wscript.echo fso.GetExtensionName(file.path)
If fso.GetExtensionName(file.path)="wab" then
msgbox file.path 'Just to do something
end If
Next
Set Subfolders = folder.SubFolders 'Get all subfolders in our main
folder
For Each Subfolder in Subfolders 'Now, for each subfolder
Dosearch Subfolder.path
Next
end function Tag: website hosting Tag: 166357
Parsing Links
Hi I have a script that someone helped me make. However it is just short of
what I need. The players data still has the html code around it. I want to
extract the name only with the statistics. I cant seem to get my head around
it - everything I have tried seems to come up with errors. Here is the
script.
I have left out my attempts at adding another Myvar mid statement that would
extract the player name. The script as you see it works.
<%
Dim objRead, objWrite, objShell, objXML, objFile, objFSO
Dim location, thisFolder, nbastats, strURL
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objXML = Server.CreateObject("MSXML2.ServerXMLHTTP")
Set ObjHttp = Server.CreateObject("Msxml2.XMLHTTP")
objHttp.Open "GET",
"http://www.tsn.ca/nba/Statistics.asp?category=Points&position=&division=&season=2005&type=player&endRow=520&startRow=1",
false
objHttp.Send
nbastats = objHttp.ResponseText
Set objHttp = Nothing
If Not objFSO.FileExists (Server.MapPath("nbastats.txt")) Then
objFSO.CreateTextFile (Server.MapPath("nbastats.txt"))
Set objFile = objFSO.GetFile(Server.MapPath("nbastats.txt"))
Set objWrite = objFile.OpenAsTextStream( 2,-2 )
'Response.Write( skaters )
'Response.End()
objWrite.Write( nbastats )
objWrite.Close()
Set objFile = Nothing
Set objWrite = Nothing
If Not objFSO.FileExists(Server.MapPath("csv.html")) Then
objFSO.CreateTextFile(Server.MapPath("csv.html"))
Set objFile = objFSO.GetFile(Server.MapPath("csv.html"))
Set objWrite = objFile.OpenAsTextStream( 2, -2 )
Set objFile2 = objFSO.GetFile(Server.MapPath("nbastats.txt"))
Set objRead = objFile2.OpenAsTextStream( 1, -2 )
MyVar = MID(nbastats, instr(1, nbastats, "bgcolor=""#F7EDE0""")-32,
LEN(nbastats))
MyVar = MID(MyVar, 1, instr(1, MyVar, "</table>")-1)
Dim myArray(17)
Dim ii 'col count
Do While instr(1, MyVar, "<tr") > 0
'// Now extract the 'record' from the table (like above code)
MyRec = MID(MyVar, instr(1, MyVar, ">")+1)
MyRec = MID(MyRec, 1, instr(1, MyRec, "</tr>")-1)
'// Now we should be left with all the <td>'s
ii = 0
Do while instr(1, MyRec, "<td") > 0
myValue = MID(MyRec, instr(1, MyRec, ">")+1)
myValue = MID(myValue, 1, instr(1, myValue, "</td>")-1)
'// We have successfully got a value from a <td>!
'// Maybe at this point you could load it into an array:
myArray(ii) = myValue
'// Now we have to clean the MyRec string up
MyRec = MID(myRec, instr(1, myRec, "</td>")+5)
ii = ii + 1
Loop
'// At this point we have a loaded myArray with all the values from the
record! You could build an SQL string at this point or anything really
objWrite.WriteLine Join(myarray,",") & "<br>"
response.Write ("All done")
'// Now we have to trim up the main string
Myvar = MID(MyVar, instr(1, MyVar, "</tr>")+5)
Loop
%>
</head>
<body>
</body>
</html>
I appreciate your input - thanks Tag: website hosting Tag: 166355
Search files on remote computer
Hi all,
I want to search on multiple remote computers (nt 4 & XP) for *.wab files.
Because the NT-machines, I can't use WMI.
Is there another way to do this ?
I add 2 scripts that I use now. 1 for a local machine (systemfileobject)
and 1 for remote machines (WMI)
Thank you all.
Greetz
Wim Heirbaut.
'********************************************************
'*
'* Search adressbooks (*.wab) in Active Directory Computers, via
FILESYSTEMOBJECT
'* How to do this on several remote computers ?
'*
'********************************************************
On error resume next
Dim Fso, Drives, Drive, Folder, Files, File, Subfolders,Subfolder 'First
of all, you have declare the variables and create the FileSystem object.
Dim strComputer
Set Fso=createobject("scripting.filesystemobject") 'Then, Set the Drives
object, so you can search in all the available drives of the computer
Set Drives=fso.drives
Dosearch "c:\" 'Dosearch is the name of the function that we'll use
to search for files and subfolders.
Function Dosearch(Path)
Set Folder=fso.getfolder(path) 'Get the folder where we have to work.
Set Files = folder.files 'Get all the files inside this folder
For Each File in files 'File is the current file where we are 'Now do a
for-each for each file
If fso.GetExtensionName(file.path)="wab" then
msgbox file.path 'Just to do something
end If
Next
Set Subfolders = folder.SubFolders 'Get all subfolders in our main
folder
For Each Subfolder in Subfolders 'Now, for each subfolder
Dosearch Subfolder.path
Next
end function
wscript.echo "Gedaan"
********************************
*******************************
***************************
'*********************************************
'*
'* Search adressbooks in Active Directory computers, via WMI
'* If there is a computer not powered on, the script ends unexpected :-(
'*
'**********************************************
on error resume next
Dim objDSE, strDefaultDN, strDN, objContainer, objChild
'***************************
' Create Excel File
'***************************
Set objExcel = WScript.CreateObject("Excel.Application") 'Create Excell
file
objExcel.Visible = True
objExcel.Workbooks.Add
objExcel.ActiveSheet.Name = "Adresbooks"
objExcel.ActiveSheet.Range("A1").Activate
objExcel.ActiveCell.Value = "PC" 'col header 1
objExcel.ActiveCell.Offset(0,1).Value = "Location 1" 'col header 2
objExcel.ActiveCell.Offset(0,2).Value = "Location 2" 'col header 3
objExcel.ActiveCell.Offset(0,3).Value = "Location 4" 'col header 2
objExcel.ActiveCell.Offset(0,4).Value = "Location 5" 'col header 2
objExcel.ActiveCell.Offset(1,0).Activate 'move 1 row down
'***************************
' Run through Active directory
' searching for computers
'***************************
Set objDSE = GetObject("LDAP://rootDSE")
strDefaultDN = objDSE.Get("defaultNamingContext")
strDN = InputBox("Enter the distinguished name of a container" & vbCrLf &
"(e.g. " & strDefaultDN & ")", , strDefaultDN)
If strDN = "" Then WScript.Quit(1) 'user clicked Cancel
Set objContainer = GetObject("LDAP://" & strDN)
Call ListUsers(objContainer)
objExcel.close
wscript.echo "Script finished"
Sub ListUsers(objADObject)
Dim objChild
For Each objChild in objADObject
Select Case objChild.Class
Case "computer"
strComputer=objChild.cn
AdresboekZoeken(strComputer) 'search adressbook
Case "organizationalUnit" , "container"
Call ListUsers(objChild)
End select
Next
End Sub
'****************************************
'Search adressbook on remote computer
'****************************************
Sub AdresboekZoeken(Computer)
teller=0
WScript.Echo "I start search on : " & Computer
Set objWMIService = GetObject("winmgmts:" &
"{impersonationLevel=impersonate}!\\" & Computer & "\root\cimv2") ' maakt
verbinding met wmi van computer
Set colDisks = objWMIService.ExecQuery ("SELECT * FROM Win32_LogicalDisk
WHERE Name = 'C:'")
For Each objDisk in colDisks
Set colFiles = objWMIService.ExecQuery ("SELECT * FROM CIM_DataFile
WHERE Drive = 'C:'")
For Each objFile in colFiles
If objFile.Extension= "wab" then
Wscript.Echo Computer & " ==> " & objFile.Name
objExcel.ActiveCell.Value = computer
objExcel.ActiveCell.Offset(0,1+teller).Value = objFile.Name
teller=teller+1
End If
Next
Next
wscript.echo "Finished searching on pc " & computer
End Sub Tag: website hosting Tag: 166353
How do I put it all on one line?
I have two questions, but they may have the same answer. I am trying to get
these scripts to send the output all to a single line with spaces (or
whatever) seperating the values.
Here's the first script that queries SQL instances from the registry:
strComputerName = "sqlserver"
Const HKEY_LOCAL_MACHINE = &H80000002
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &
strComputerName & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\Microsoft SQL Server"
strValueName = "InstalledInstances"
Return =
objReg.GetMultiStringValue(HKEY_LOCAL_MACHINE,strKeyPath,strValueName,arrValues)
If (Return = 0) And (Err.Number = 0) Then
For Each strValue In arrValues
WScript.Echo Trim(strValue)
Next
Else
Wscript.Echo "GetMultiStringValue failed. Error = " & Err.Number
End If
The output looks like this:
C:\>cscript getsqlinst.vbs
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
SSLAB01
SQL2K5
C:\>
And I want it to look like this:
C:\>cscript getsqlinst.vbs
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
SSLAB01, SQL2K5
C:\>
And the second:
strComputerName = "serverwithmultipleips"
Set objWMIService = GetObject( _
"winmgmts:\\" & strComputerName & "\root\cimv2")
Set colNicConfig = objWMIService.ExecQuery _
("Select IPAddress from Win32_NetworkAdapterConfiguration" _
& " where IPEnabled=TRUE")
For Each objNicConfig In colNicConfig
If Not IsNull(objNicConfig.IPAddress) Then
strIPAddresses = Join(objNicConfig.IPAddress)
Else
strIPAddresses = ""
End If
WScript.Echo strIPAddresses
Next
Output looks like this:
C:\>cscript ipaddy.vbs
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
147.34.97.120 147.34.97.229
192.168.234.235
C:\>
And I want it to look like this:
C:\>cscript ipaddy.vbs
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
147.34.97.120, 147.34.97.229, 192.168.234.235
C:\>
Any help is much appreciated! Tag: website hosting Tag: 166332
move users in local groups...
HI , i want to remove domain user account from de local admin group in the
pc , then the same user add to group advanced users..any has one scirpt to
do this??
for example i have this script..
'add user to local group
strComputer = "."
Set objGroup = GetObject("WinNT://" & strComputer & "/Advanced Users,group")
Set objUser = GetObject("WinNT://" & strComputer & "/kenmyer,user")
<------- this variable must be a valor of the user authenticated to domain
for example %username% , if not, only the user kenmyer will be add to group
..
objGroup.Add(objUser.ADsPath)
i expect your comments , tk's! Tag: website hosting Tag: 166328
File Version compare issue
All,
I am using fso.getfileversion to get the version of a file then capare it to
a static value. The issue that i am having is that that script thinks
9.0.0.2602 is greater than 10.0.5529.0. Although an echo displays the file
versions correctly, i think that the minor version of .0 is not being
calculated..
Any ideas???
Thanks Tag: website hosting Tag: 166326
How to Convert Chars from a .BAT command Line?
Hi!
I've got a simple RUN.BAT with this
@echo off
myscript.vbs /s="select * from OPERAÇÃO_COM_TRATAMENTO"
In "myScript.vbs" i've read the command line "/s" and i have not the same
result string , because de characters "ÇÃ" are translated to another
thing...
How can i pass correctly de characters "ÇÃ" in the .BAT command line, or
re-construc them in the vbs ???...
Thanxs a lot...... Gabriel. Tag: website hosting Tag: 166325
Converted BAT won't function
I'm attempting to convert a simple BAT file to VBS, as
seen below. When I double-click the vbs file, nothing
happens, i.e., the intended Rasdial connection does not
occur. No diagnostics from WSscript are displayed.
What am I missing?
Sub DialJPS()
Set oShell = CreateObject("WScript.Shell")
oShell.Run "c:\Windows\System32\rasdial.exe Rasdial jps stanton@jps.net
mypassword" ,0
End Sub
Thanks,
Bill Tag: website hosting Tag: 166312
CSV file parsing
Hi,
Please forgive me - I'm new to scripting...
I have a csv file, comma-delimited, which has the following fields,
E-mail Addresses
SMTP:ecdlcorrector@DOMAIN.com%MS:TRAINING/DOMAIN/ECDLCORREC%X400:c=US;a=
;p= Training;o=DOMAIN;s=ecdlcorrector;%CCMAIL:ecdlcorrector at DOMAIN
Secondary-Proxy-Addresses
smtp:
I need to get a vbscript to take the "ecdlcorrector" from
<SMTP:ecdlcorrector@domain.com> and add it to the field
<secondary-proxy-address>, but only use the "ecdlcorrector" part and add it
to "@newdomain.com".
Essentially, I want to add the ecdlcorrector in the above as a new
email address with a different @domainname into the secondary-proxy-address
field.
I hope this makes sense and that somebody can help me, or point me in
the right direction.
Kind regards
Gerard Gallagher Tag: website hosting Tag: 166310
Shell
What's the connotation associated with the common
use of the word "Shell" in the context of VB? Aside
from whatever connotation someone might have
intended, it appears that it is some special kind of
"run" or "call" statement to initiate the running of
another program, service or what?
Thanks, (just getting started)
Bill Tag: website hosting Tag: 166306
CDO SMTP Code with Authentication
I got some code for sending mail via SMTP from a Microsoft Web site. When I
run it, the server returns the message that I should configure my mail
client to use authentication. I tried adding lines for authentication, but I
keep getting the same message. The code is below. Any input on how to get
configure it for authentication would be appreciated.
Thanks!
Neil
Dim iMsg
Dim iConf
Dim Flds
Dim strHTML
Const cdoSendUsingPort = 2
set iMsg = CreateObject("CDO.Message")
set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
' Set the CDOSYS configuration fields to use port 25 on the SMTP server.
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") =
cdoSendUsingPort
'ToDo: Enter name or IP address of remote SMTP server.
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
"smtpauth.earthlink.net"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout")
= 10
.Item("http://schemas.microsoft.com/cdo/configuration/SMTPAuthenticate")
= cdoBasic 'cdoBasic=1
.Item("http://schemas.microsoft.com/cdo/configuration/SendUserName") =
"xxx@earthlink.net"
.Item("http://schemas.microsoft.com/cdo/configuration/SendPassword") =
"mypw"
.Update
End With
' Build HTML for message body.
strHTML = "<HTML>"
strHTML = strHTML & "<HEAD>"
strHTML = strHTML & "<BODY>"
strHTML = strHTML & "<b> This is the test HTML message body</b></br>"
strHTML = strHTML & "</BODY>"
strHTML = strHTML & "</HTML>"
' Apply the settings to the message.
With iMsg
Set .Configuration = iConf
.To = "mymail@earthlink.net" 'ToDo: Enter a valid email address.
.From = "mymail@earthlink.net" 'ToDo: Enter a valid email address.
.Subject = "This is a test CDOSYS message (Sent via Port 25)"
.HTMLBody = strHTML
.Send
End With
' Clean up variables.
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing
MsgBox "Mail Sent!" Tag: website hosting Tag: 166305
how do you pass the name of an image that has been clicked?
i have some images in a form. <input type="image" i would like to be able to
pass the name of the image clicked to the subsequent page. is there a
property which relates to the item which has been clicked? or would it be an
index of the array of images or form inputs where the index is equal to the
image clicked or input submitted. i don't think that vbscript or asp supports
"this.name" please help before i go insane
thanks Tag: website hosting Tag: 166299
Script Editor
I was given to understand that there's a
VBScript editor in Office 2K. While
I'm familiar with the VBA editor in
Access, I've not found any other editors
in Office 2K.
Am I blind or miss-informed?
Thanks,
Bill Tag: website hosting Tag: 166295
Value Added Tax calculation
hello all
i was helped by people from this group
to add 17.5% onto a variable number.
for that, i am very grateful.
i now need to calculate the VAT at 17.5%
from a variable number.
example
the amount value added tax in £100 is £17.50
preCalc = inputbox("Enter the sub total amount",,"100")
preCalc = (preCalc * 0.175) '
msgbox "Grand total: " &space(3) & (preCalc) & "%"
could i make a simple change to line 2 to do this
many thanks Tag: website hosting Tag: 166292
wmi / disabling nic's
Hi,
I would like to disable my wireless network interface from a vbscript
for my laptop, in order to save power. (hardware profiles are such a
pain to achieve that..;)
However, it looks like there is no function/hook possbility in the wmi
to do that in windows XP (i used WMITools to explore the objects)
Has anyone an idea/ solution ?
Thanks Tag: website hosting Tag: 166290
Processor qty reported incorrectly in registry
I am trying to script an audit of domain servers.
The "NUMBER_OF_PROCESSORS" key reports 2x the actual number of processors if
the processor uses hyperthreading technology.
How can I determine whether the processor uses hypertheading technology
within a vb script?
Many Thanks Tag: website hosting Tag: 166289
CreateElement
Hi
Can I use CreateElement with VBS and, if so, what's wrong with this code?
<Script Language="vBS">
Sub AddElement()
oOption = document.createElement("OPTION")
oOption.text="HP LaserJet 2200"
oOption.value="1"
document.all.PrinterList.add(oOption)
End Sub
</SCRIPT>
</HEAD>
<BODY onLoad="test()">
<SELECT Name=PrinterList ID=PrinterList>
</SELECT>
</BODY>
Regards
PO Tag: website hosting Tag: 166287
InputBox on top
I have a COM server (out-of-proc) that starts a VBscript by means of the
script control.
The script needs to display an input box. The box shows, but it is not on
top. Is there any
way I can make it to appear on top automatically, from within the script?
Alternatively, does anyone know of a tool that would spy on the windows and
automatically
raise windows with a given title (or title pattern)?
TIA,
Rob Hegt Tag: website hosting Tag: 166285
Converting .bat file to .vbs file
Hi there all,
I've got a batch file with the below code in it. I'd like to convert this to
run in a vbs file as then I can use msgbox etc to prompt for certain
variables.
For the life of me I can't make it work in vbs! The mkdir and copy bits are
fine, it's when I try the silent software install that it just doesn't work.
I realise this is a long shot, but can anyone help me convert this to vbs?
Cheers,
Pete
mkdir "c:\Program Files\BO License\"
copy .\BusinessObjects_enterprise_600_8166.signed.key.xml "c:\Program
Files\BO License\"
start /wait .\setup.exe /s /v"/qn /L*v C:\bo6_install.log
INSTALLLANG=en,fr,es DEFAULTLANG=en INSTALLTYPE=1
ADDLOCAL=bo,bo.AccessPacks,bo.rdbms.ODBC,bo.rdbms.ODBC3,bo.rdbms.ODBC2,bo.rdbms,bo.rdbms.Microsoft,bo.rdbms.MSSQLServerODBC,bo.rdbms.MSAccessODBC,bo.rdbms.Oracle,bo.rdbms.OracleClient,bo.AdminProducts,bo.vba,bo.vba.common,bo.DesktopProducts,bo.BusinessObjects,bo.BusinessObjectsDoc,bo.3TierBusinessObjects,bo.BusinessObjectsHelp,bo.BusinessObjectsExplorer,bo.BusinessObjectsReporter,predefined.setup.invisible,bo.vba.en LICENSEDIR=c:\PROGRA~1\BOLICE~1\ " Tag: website hosting Tag: 166282
registry key permissions
This is a multi-part message in MIME format.
------=_NextPart_000_008E_01C4D21C.F3C640F0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Is there a way to change permissions on a reg key using vbscript?
--
Jeff Giroux
------=_NextPart_000_008E_01C4D21C.F3C640F0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1476" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Is there a way to change permissions on =
a reg key=20
using vbscript?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2><BR>--<BR>Jeff=20
Giroux<BR></FONT></DIV></BODY></HTML>
------=_NextPart_000_008E_01C4D21C.F3C640F0-- Tag: website hosting Tag: 166276
ASP VBSCRIPT Error
Hello all and thanks for any responses. Also im not sure if this will be the
right forum for this, hopefully I get an answer and Any thoughts would be
appreciated
I have an ASP page that calls a Stored procedure which gives back an
identity of the insert
----ASP PAGE----
<%
SET conn = server.createobject("adodb.connection")
conn.open MM_QuoteSytem_STRING
getReqNumSQL = "EXEC [dbo].InsertReqFromQuoteSystem 'USERID', 2"
RESPONSE.WRITE getReqNumSQL & "<br>"
set GeneratedReqNum = conn.execute(getReqNumSQL)
' Trying to get the generated ID Number
response.write GeneratedReqNum.Fields(0).Value
%>
----------------------------------------
I have tried multiple incarnations for the response.write to no avail
----Stored Procedure ----
PROCEDURE [dbo].InsertReq
@Originator varchar(15),
@DivisionID int
AS
BEGIN
SET NOCOUNT OFF
DECLARE @ReqIdentity INT
INSERT INTO [dbo].[Req] (
[Date_Opened],
[Date_Closed],
[CurrentStatus],
[Originator],
[DivisionID]
) VALUES (
getdate(),
getdate(),
'REQCL',
@Originator,
@DivisionID
)
SELECT @ReqIdentity = @@IDENTITY
SET NOCOUNT ON
SELECT ReqIdentity = @ReqIdentity
END
--------------------------------------
When i run the stored procedure within Query Analyzer i do get a result
(1 row(s) affected)
ReqIdentity
-----------
22982
When executed from my ASP page i get an error of
ADODB.Recordset error '800a0cc1'
Item cannot be found in the collection corresponding to the requested name
or ordinal.
FYI I tried the following so far
GeneratedReqNum(0) -- Same error
For each flds in GeneratedReqNum.fields -- nothing gets returned
I am assuming that the stored procedure is not giving back the result set
from its execution. For the life of me I cant get the result set out
Thanks Again
Len Tag: website hosting Tag: 166275
Getting Around AppActivate, trying to SetFocus
This seems as though it should be simple, but I'm having a tough time.
I have a vbscript that starts up an application (a VPN client). I
start this as a shell.Exec since I need to read the output and verify
that the "dialogue" is correct. After reading the correct text, I then
need to send back an acknowledgement (a "y"). The problem is in
running it as a scheduled task.
When I run it from a command line, it works fine. But when I run as a
scheduled task, even with an "AppActivate" call, the window does not
get focus and thus the input is not sent, and the application hangs.
Research has suggested that AppActivate is somehow problematical (I'm
not sure why). There is a third party component AutoITX that does what
I want, but I am forbidden to use software with this type of
licensing, so that is not an option.
I'm trying to cobble together a COM component that will do roughly
what "WinActivate" does. I can (I think) get the window handle from
either a FindWindow() call or via EnumWindows(); the question is what
to do next. SetFocus doesn't seem to work - I suspect because it is in
a different thread. Does anyone have any suggestions? (Is the VB
AppActivate method more robust than the VBScript one, or is is just a
shell?)
TIA,
Jim Tag: website hosting Tag: 166274
automate user creation in AD
I have had no luck with this
I need to create a form or script for the HR department that will allow them
to do the following when a new employee starts
Create a new user account in AD (First name Last name, Username) or have the
code auto create the username from the values from the first and last name
Choose which OU to place the user in (there are 4 OUs that represent
different divisions on our company)
My manager does not want them to use the MMC
Any help would be greatly appreciated
Thank you Tag: website hosting Tag: 166263
calculating a percentage
hi all
i am trying to calculate a total value which includes
17.5 %
i am having trouble doing this, so can some one
please help me
Dim VAT
preCalc = inputbox("Enter the sub total amount",,"100")
'preCalc = (preCalc * 17.50%)
msgbox "Grand total: " &space(3) & (preCalc)
thanks Tag: website hosting Tag: 166258
Help with very Basic script
I'm having fits trying figure out how to use Cscript to add a user to
a group. I am running AD. Cscript is the default scripting host and I
am running Ver. 5.6. I've run it from the domain Administrator
account. I run it from the command prompt on the C:\ . It throws no
errors, opening up with:
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights
reserved.
and returns me to the command prompt. But it doesn't add the user to
the group.
Here is my code. What am I screwing up on?????
On Error Resume Next
Set Group = GetObject("WinNT//Spozinch/HighSec.group")
Group.Add "WinNT://Spozinch/Ross.User"
Where "Spozinch" is the domain name, "HighSec" is the universal group
and "Ross" is the user name.
Thanks. Tag: website hosting Tag: 166257
"If wscript.interactive then" crashes with no error
Hi,
I have a working script that I want to use in both batch mode and
interactive. Interactive works fine. When I use
"C:\WINNT\system32\wscript.exe //X //D C:\WINNT\system32\OWAchange.vbs //B
//nologo"
to start the script, it exits with no error upon reaching the line,
"If WScript.Interactive Then".
I have searched msdn, all the help files, and googled it, and can find no
reference to any problem. The line works fine in interactive mode. Can
someone clue me in to what the problem may be? I realize that
stdin,stdout,& stderr are not available when using Wscript instead of
Cscript, but I would not think that this would be a factor(and I'm not
using them, anyway). Please help. Tag: website hosting Tag: 166255
Launch an excel page from ASP without "Open/Save" window
Hello,
I would like to launch excel file (separate from the browser) from an ASP
page and can't figure out how to do it without it opening in the browser or
with the "Open/Save/Cancel" window.
I can generate the right look, I'd just like the effect of a separate excel
application launched (without the popup open/save window).
Thanks for any help you can give,
Matt Tag: website hosting Tag: 166250
Available client printers list
Hi
Win2000. Is there a way, using VBS, to generate a list of all available
printers on a client? I want to load the names into a <SELECT>.
Regards
PO Tag: website hosting Tag: 166246
How to create printerports and printers on a Windows 2003 cluster
I need to create a lot of netwerkprinters on a Windows 2003 cluster. In a
non-clusterd environment I have a script that does this for me using a Excel
sheet as input source.
I use a Script like this (partial):
Set objPrinter= objWMIService.Get("Win32_Printer").SpawnInstance_
objPrinter.DriverName =
objPrinter.PortName =
objPrinter.DeviceID =
objPrinter.Location =
objPrinter.Network = True
objPrinter.Shared = True
objPrinter.ShareName =
objPrinter.Description =
objPrinter.Put_
This works perfectly on a windows server, but not on a Windows 2003 cluster.
does anyone have suggestions ow I can script against a Windows 2003 cluster??
Thanks in advance. Tag: website hosting Tag: 166243
About OWC vbscript
Dear all,
I have a report which is made by OWC. In the report, Branch Code is in the
rowfield and delivery date is in the column field. The users can choose
different days or add and drop different measures to view. However, they are
not allowed to change the content of rowfield(i.e. Branch Code). Does anybody
know how to write this VBSciprt? Thanks!
Polly Tag: website hosting Tag: 166242
executing mutiple programs
Hi there,
I have been trying to write a login that will excute a number of programs in
sequence. The programs are third party windows applications. However, I'm
having great problems in finding info on excuting a progam in vbscript. I
have been trying the below code but getting no joy. any help on where I'm
going wrong or the correct syntax on how I can do this would be great.
thanks.
Liam Tag: website hosting Tag: 166219
Executinh
Hi there,
I have been trying to write a login that will excute a number of programs in
sequence. The programs are third party windows applications. However, I'm
having great problems in finding info on excuting a progam in vbscript. I
have been trying the below code but getting no joy. any help on where I'm
going wrong or the correct syntax on how I can do this would be great.
thanks.
Liam
oShell = WScript.CreateObject("WScript.Shell");
oShell.Run( "command.com /K dir c:\\windows");
oShell.Run( "wordpad.exe");
WScript.Echo( "Done" ); Tag: website hosting Tag: 166218
Executing a number of programs
Hi there,
I'm new to the world of scripting, but have some VB experience. What I'm
trying to do is to write a script that will allow me to launch a number of
programs in sequence. having create diffculty finding vbscript to do this.
The program I'm launching are third party windows applications.
Been trying simple script like below to work, but no joy. Any help on
assistance on how to launch an application in vbscript would be great.
thanks,
Liam
oShell = WScript.CreateObject("WScript.Shell");
oShell.Run( "command.com /K dir c:\\windows");
oShell.Run( "wordpad.exe");
WScript.Echo( "Done" ); Tag: website hosting Tag: 166217
regread with curly braces in registry path
Does anyone have a solution for doing a regread in vbscript, when the
path contains curly braces?
I can't get my vbscript to work when the curly braces are present..
An example path:
HKEY_LOCAL_MACHINE\SOFTWARE\Novell\Location
Profiles\Services\{1E6CEEA1-FB73-11CF-BD76-00001B27DA23}\Teller\Tab2\DefaultUserName
Here is the script that isn't working:
keyname3 = "HKEY_LOCAL_MACHINE\SOFTWARE\Novell\Location
Profiles\Services\" &brStart &"1E6CEEA1-FB73-11CF-BD76-00001B27DA23"
&brEnd &"\Teller"
validate20 = bjShell.RegRead(keyname3 & "\Tab2\DefaultUserName")
if validate20 = "" then
validate20 = "No Value Set"
wscript.echo validate20
Else
wscript.echo validate20
end if
Thanks very much!!
Please, if possible, respond to christopher.rees@yesbank.com in
addition to here - as I don't get a chance to check here very often. Tag: website hosting Tag: 166214
api call using vbscript
h
+----------------------------------------------------------------
| Attachment filename: new text document.txt
|Download attachment: http://www.codecomments.com/attachment.php?postid=1073516
+----------------------------------------------------------------
-
sarthak_s
-----------------------------------------------------------------------
Posted via http://www.codecomments.co
----------------------------------------------------------------------- Tag: website hosting Tag: 166205
api call
Hi,
I tried to use API called "user32" using VBScript, this is what I did
-
sarthak_s
-----------------------------------------------------------------------
Posted via http://www.codecomments.co
----------------------------------------------------------------------- Tag: website hosting Tag: 166204
calling client side dll using vbscript
hi
i m an asp.net programmer . i want to call dll at client side usin
vbscript/javascript . how it can be done.
sartha
-
sarthak_s
-----------------------------------------------------------------------
Posted via http://www.codecomments.co
----------------------------------------------------------------------- Tag: website hosting Tag: 166203
Copy file from a remote server
Hi,
I need to copy a file from a remote server to my local machine using
vbscripts. the remote drive is not connected with a drive letter and the
info that I have is the path \\SERVERNAME\C$\DIR1\REMFILE.PST and I must
copy it to my C:\MYFOLDER
I have this script:
Const OverwriteExisting = True
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile "D:\REMOTEFOLDER\xx.pst" , "C:\MYFOLDER\", OverwriteExisting
The problem is that this script only run with local drives
If I use:
objFSO.CopyFile "\\SERVERNAME\C$\DIR1\REMFILE.PST" , "C:\MYFOLDER\",
OverwriteExisting
the script does not work
Could you give me a possible solution ?
Thanks in advance Tag: website hosting Tag: 166199
Change TS profile path
Hi,
I need to change the TS profile of all users who are members of a
certain group- domain wide. As I'm newbe to vbs, it night be all
false...
This is what I wrote:
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set WshShell = WScript.CreateObject("WScript.Shell")
Set WshFiles = Wscript.CreateObject("Scripting.FileSystemObject")
Dim UserName
Dim UserDomain
UserName = WshNetwork.Username
UserDomain = WshNetwork.UserDomain
AdsPath = "WinNT://" & UserDomain & "/" & UserName
Set Dso = GetObject("WinNT:")
Set ObjUser = Dso.OpenDSObject(AdsPath,"","", ADS_READONLY_SERVER)
For Each Prop In ObjUser.Groups
Select Case Prop.Name
Case "Terminal Server User"
objUser.TerminalServicesProfilePath = "\\polaris\Profiles\&
UserName"
end select
next
Please help me correct it.
TIA,
Ronen Tag: website hosting Tag: 166197
delete old folders and contents based on foldernames
can anyone help me im trying to delete folders and its contents based on the
filename of the folder. The folder contains the date that it was backed up as
well as some other information
The existing script copies the folders and renames it with the current date
and then deletes the source.
dNow = Now
yyyy = Year(dNow)
dd = Right("00" & Day(dNow), 2)
mt = Right("00" & Month(dNow), 2)
sDate = dd & mt & yyyy
'WScript.Echo "Date part is: " & sDate
WScript.Sleep 500 ' Wait 500 milliseconds
'Copies the folders to have current data in them.
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.copyFolder "d:\Backup\ECS Data\Daily\ecs" , "d:\Backup\ECS
Data\Daily\ecs "& sDate
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.copyFolder "d:\Backup\ECS Data\Daily\ecsv7_archive" , "d:\Backup\ECS
Data\Daily\ecsv7_archive "& sDate
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.deleteFolder "d:\Backup\ECS Data\Daily\ecs"
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.deleteFolder "d:\Backup\ECS Data\Daily\ecsv7_archive" Tag: website hosting Tag: 166196
How to define IP, dns, additional dns and WINS using vbsscript
I use my Laptop at my office, at home, during my business trips (wireless)
with different settings of IP address, DNS, gateway, and proxy servers. I
wrote bat files with different settings of IP, DNS and gateway. I wrote the
second .vbs file with setting of proxy server (appropriate Registry setting).
I would like to unite all these settings in one .vbs file. However I don't
know how can I set my IP address, dns, additional dns and gateway using
vbsscript.
Help me, please.
Thank you.
Yuri. Tag: website hosting Tag: 166194
Math problem
I'm working on a script that requires the computer to chose a random number,
either 1, 2 or 3. I looked in a vbscript source book and it gives the
following example:
Randomize
GetRandomNumber = Int((3 * Rnd( )) + 1)
The author says the Rnd( ) function generates a random number between 0 and
1. The Int( ) function, which returns the integer portion of a number,
executes, multiplying 3 times the randomly generated number and then adds 1
to it. The final result is a randomly generated number with a value between
1 and 3.
If I do the math 3 times 0 is 0 and add 1 is 1. 3 times 1 is 3 plus 1 is 4.
Am I not understanding something in this equation? If not I would
appreciate an explanation. Thanks, Jim Tag: website hosting Tag: 166183
Random selection
I'm working on a script that requires the computer to chose a random number,
either 1, 2 or 3. I looked in a vbscript source book and it gives the
following example:
Randomize
GetRandomNumber = Int((3 * Rnd() + 1)
The author says the Rnd( ) function generates a random number between 0 and
1. The Int( ) function, which returns the integer portion of a number,
executes, multiplying 3 times the randomly generated number and then adds 1
to it. The final result is a randomly generated number with a value between
1 and 3.
If I do the math 3 times 0 is 0 and add 1 is 1. 3 times 1 is 3 plus 1 is 4.
Am I not understanding something in this equation? If not I would
appreciate an explanation. Thanks, Jim Tag: website hosting Tag: 166181
Here is the link to the web hosting company that I use for my 3 sites.