Run a *.vbs file from MS-Access or MS-Excel
Using Office 2003 and Windows XP;
Could someone please post generic example code that illustrates how to run a
stand alone *.vbs file from MS-Access and/or MS-Excel (I would presume the
same method would work for either)?
Thanks much in advance. Tag: File permissions in Windows XP home edition Tag: 204603
ADO Recordset vs Command and AD
I need to query AD for categories of user accounts with several thousand per
category, so I need "Page Size" adoCommand property set to enable paging. I
also want RecordSet.RecordCount to determine nonzero results and how many in
the result set, so I set cursortype=3. If I use adoRecordset.open to execute
the query I have the proper cursor, but not page size. If I use Set
adoRecordSet=adoCommand.Execute then paging is enabled and I get a record set
> 1000 but don't get the cursortype=3. How can I execute the query so that I
get both?
Thanks - Dave
'* use ADO to search Active Directory.
Set adoCommand = CreateObject("ADODB.Command")
Set adoConnection = CreateObject("ADODB.Connection")
adoConnection.Provider = "ADsDSOObject"
adoConnection.Open "Active Directory Provider"
Set adoCommand.ActiveConnection = adoConnection
'* setting "Page Size" property enables paging, without which results are
limited to 1000 records
adoCommand.Properties("Page Size") = 1000
adoCommand.Properties("Timeout") = 120
adoCommand.Properties("Cache Results") = False
'* using recordset object allows forward and backward cursor movement
Set adoRecordset = CreateObject("ADODB.Recordset")
adoRecordset.ActiveConnection = adoConnection
adoRecordset.CursorType = 3
'* list of attributes to return
strAttributes = "sAMAccountName,department"
strPattern = strSearchPattern & "*"
strQuery = "SELECT " & strAttributes & _
" FROM 'LDAP://DC=blah,DC=blah,DC=com'" & _
" WHERE objectClass='user' " & _
" AND objectCategory='person' " & _
" AND sAMAccountName='" & strPattern & "'" & _
" OR sn='" & strPattern & "'"
'* search AD
' adoRecordset.source = strQuery
' adoRecordset.open
'* must use the adoCommand.execute in order for "Page Size" property to apply
adoCommand.CommandText = strQuery
Set adoRecordSet = adoCommand.Execute Tag: File permissions in Windows XP home edition Tag: 204601
Help debug File Not Found
I have the following code in a VBS file; it displays a file open dialog box
and returns the full path to the file chosen. The program should then open
the selected file, but I get an error that the file was not found; how can it
not be found if I just picked it?
The error occurs on the last line, char 1:
Set oDialog = CreateObject("UserAccounts.CommonDialog")
oDialog.Filter = "VBScript Scripts|*.vbs|All Files|*.*"
oDialog.FilterIndex = 2
iResult = oDialog.ShowOpen
If iResult = 0 Then
Wscript.Quit
Else
sTarget = oDialog.FileName
'Wscript.Echo sTarget
End If
Set oWSHShell = CreateObject("WScript.Shell")
oWSHShell.Run sTarget, 3, True Tag: File permissions in Windows XP home edition Tag: 204599
Determine if a file is open
Using Office 2003 and Windows XP;
Is there a way using a script (in a VBS script file) to determine if a file
is open?
If so, could someone please post example code?
Thanks much in advance. Tag: File permissions in Windows XP home edition Tag: 204587
Open an MS-Access DB
Using Office 2003 and Windows XP;
VBS is very cool! It makes me want to never look at another BAT file ever
again!
Could someone please post example code that would open a file? In
particular, an MS-Access front-end MDB. I was thinking that there was certain
code that would open the file in the correct application without having to
point to the app's exe; like a hyperlink works. Is this possible or am I
dreaming it up?
Please post example code; I'm still learning...
Thanks much in advance. Tag: File permissions in Windows XP home edition Tag: 204580
Vista and prnadmin.dll
Question about Vista security. I've got a script that we use for a
lot of printer administration. It relies on the prnadmin.dll
functionality from the windows resource kit tools. In order to
minimize the install time on the script I register the dll in the
script itself:
const PRNADMINPATH = "C:\Wherever\prnadmin.dll"
Dim objShell : Set objShell = CreateObject("WScript.Shell")
objShell.Run "regsvr32 /s """ & PRNADMINPATH & """",0,True
The script is only used by local administrators, so this route makes
it easy to send them a zip file and have them run the script with no
other installation. Works great in 2000/XP.
The question is, running the regsvr32 (even from start -> run) will
not work in Windows Vista since it needs to be elevated. What is the
proper Vista way of doing this type of thing? Will I need to create
an actual installation program for a script now if I want to use a
dll?
Thanks,
Jesse Tag: File permissions in Windows XP home edition Tag: 204570
Functionality Question
Greetings,
I am rather new to VBS and what it can do, but so far it has been a fun
experience. I currently am making a logon script via vbs and it is coming
along nicely. However, I am doing this in preparation of a move from mixed
Novell/MS environment to a pure MS environment.
Novell is currently used as the file server, but I have recently setup a MS
File Server and plan to migrate to it in a month or two. Novell allows for
the dynamic creation of the user home folder and rights assignment to that
folder whenever creating a new user account. My question is this: Is it
possible to mimic that functionalty in the MS environment using VBS, say
write a script to create a new user, user home folder and set permissions on
it. I would assume you would want input msgbox's for the unique naming and
so forth. Just wondering if this is workable? Thanks...
-Mac Tag: File permissions in Windows XP home edition Tag: 204563
Looking for a script to delete AD user accounts
Hi, does anyone have a script they could share that will prompt the user for
a computer name, search AD for the computer object and the delete the
computer object? Our computer objects reside in a variety of OUs, so the
script would need to search the entire directory.
Thanks,
Mike Tag: File permissions in Windows XP home edition Tag: 204559
FTP upload using InetCtls.Inet.1 - error with IE7
Hi,
I'm using the std script from PDF Creator to FTP upload files after PDF
printing.
The script uses the following function to upload.
However after installing IE 7, I get an error on the line "Set ftpo =
CreateObject("InetCtls.Inet.1")".
I have done some googleing, and found out that it because of IE 7.0. How can
I easy change the function so that it works?
Code:
Call FTPUpload(domain, rdir, user, pass, fname)
Private Sub FTPUpload(domain, rdir, user, pass, fname)
Dim fso, ftpo
Set fso = CreateObject("Scripting.FileSystemObject")
Set ftpo = CreateObject("InetCtls.Inet.1")
ftpo.URL = "ftp://" & domain
ftpo.UserName = user
ftpo.Password = pass
ftpo.Execute , "CD " & rdir
Do
WScript.Sleep 100
Loop while ftpo.StillExecuting
ftpo.Execute , "Put """ & fname & """ """ & fso.GetFilename(fname) & """"
Do
WScript.Sleep 100
Loop while ftpo.StillExecuting
ftpo.Execute , "Close"
End Sub
Best regards
Mads Tag: File permissions in Windows XP home edition Tag: 204558
Displaying code as html
Does anyone know of a tool / freeware / code theyve written to parse a piece
of VBScript and format it as HTML. I would like to output code snippets onto
a web site / blog that is correctly formatted and with the right colours.
If someone has an xsl sheet or some other method of doing this it would save
me a lot of time. Tag: File permissions in Windows XP home edition Tag: 204554
Select menu choice in a .Net application via PostMessage
Hi all,
Can anyone give me a hint how to select a menuchoice in an .Net
application via a post message.
I have got this far
objHandle = objForm.FindWindow ("WindowsForms10.Window.8.app.
0.3b95145", "MyApplication")
// FindWindow works and I have got a handle.
// Now I want to activate the a menu choise. e.g. File/Save
PostMessage objHandle, ?????????
Any hints appriciated
/Broeden Tag: File permissions in Windows XP home edition Tag: 204553
VBS equivalent to BAT %USERPROFILE%
Using Office 2003 and Windows XP;
Due to the enhanced power and control found in VBS, I am trying to replace a
few old batch files with a VBS file. Mostly, these are used for deployment of
front-end MDB databases to users and distribution of MS-Excel files.
1) Is there anything in particular I should know about this migration from
batch to VBS? Given the flexibility in VBS it would seem I'm doing myself a
favor...
2) In a batch file, I can use %USERPROFILE% as part of a path and then no
matter who opens the batch file, their particular user profile is mapped.
What is the equivalent command(s) and/or keywords in VBS? --- If it requires
more code, could an example be posted?
Thanks much in advance. Tag: File permissions in Windows XP home edition Tag: 204551
Save results of ASP to excel and save file on server
Currently I am using the:
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "attachment;
filename="myFile.xls"
Opening this page will prompt the user to save or download, as
expected.
What I am trying to do is create the XLS documents overnight so the
user doesnt need to wait for the asp script to take its course. They
can simply click on the "myFile.xls" and download its already saved
results. However, I don't know how to save the file dynamically
without user intervention to click "Save"
Thanks in advance for any assistance. Tag: File permissions in Windows XP home edition Tag: 204548
Adaptec Raid Controller - Interrogate
Is there any way to interrogate the state of an Adaptec Raid controller using
vbScript for data such as are the disks 'optimal'? This is on a Win2003 SBS
server.
Thanks - John Tag: File permissions in Windows XP home edition Tag: 204546
Script to Move All Files in First Folder to A Second Folder
Hello...
I need to move all the files in a network folder (\\bmd-fax\faxes) to
a second folder (\\bmd-fax\new). This will be done repeatedly
throughout the day, so I would like to do it with a script that is
assigned to a desktop icon.
We are using Windows XP computers on a Microsoft Server 2003
network. Does anyone know how to do that with a script?
Thanks so much for any help possible.
Jessi Tag: File permissions in Windows XP home edition Tag: 204544
VbS Script Define??
I need a script that searches words from www.urbandictionary.com and
www.dictionary.com if possible also www.thesaurus.com for words when
executed. Displaying the #1 result. First it would check if the word
is in dictonary.com than urbandictionary.com. When using thesaurus.com
you would use a different command. I need help with the para string,
and stat strings of the websites. I can make the commands and
executables. Here is some code that might be useful for you guys if
need be or you can use your own way.
content = InetOpen("http://dictionary.reference.com/search?q="&word)
if instr(content, "No entry found for") <> 0 then
call defUrban(word, user, mode)
exit sub
end if
data = split(content, "<LI TYPE=""a"">")
if ubound(data) = 0 then
info = split(content, "<DD>")
if ubound(info) > 3 then
for i=1 to ubound(info)
newdef = mid(info(i), 1, instr(info(i), "<")-1)
call displayText(i & ": " & newdef, " ", BotVars.Username, 1)
next
else
for i=1 to ubound(info)
newdef = mid(info(i), 1, instr(info(i), "<")-1)
call displayText(i & ": " & newdef, " ", BotVars.Username, 1)
next
end if
if ubound(info) = 0 then
call defUrban(word, user, mode)
end if
exit sub
end if
'else if ubound(data) > 0, when there is a list of definitions...
if ubound(data) > 3 then
call handleText(user, "Found " & ubound(data) & " entries for "&
word & ". Here are three.", mode)
for i=1 to 3
newdef = mid(data(i), 1, instr(data(i), "<")-2)
call displayText(i &": " & newdef, " ", BotVars.Username, 1)
next
else
for i=1 to ubound(data)
newdef = mid(data(i), 1, instr(data(i), "<")-2)
call displayText(i & ": " & newdef, " ", BotVars.Username, 1)
next
end if
End Sub
Sub defUrban(word, user, mode)
if ScINet.stillExecuting then
call handleText(user, "The bot is busy... wait a few seconds and
try again.", mode)
exit sub
end if
content = InetOpen("http://www.urbandictionary.com/define.php?
term="&word)
if instr(content, "is undefined") <> 0 then
call handleText(user, "Failed to find a definition using both a
dictionary and an urban dictionary.", mode)
exit sub
end if
defArray = split(content, "<div class=""def_p"">")
if ubound(defArray) = 0 then
call handleText(user, "Failed to find a definition using both a
dictionary and an urban dictionary.", mode)
exit sub
end if
defcount = 0
found = false
for i=1 to ubound(defArray)
if instr(defArray(i), "1.") = 0 then
found = true
def = mid(defArray(i), instr(defArray(i), "<p>"))
def = mid(def, 1, instr(def, "</p>")-1)
def = replace(def, """, "")
'addchat vbyellow, def
while instr(def, "<") <> 0
pos1 = instr(def, "<")
pos2 = instr(def, ">")
temp = mid(def, pos1, pos2-pos1+1)
def = replace(def, temp, "")
wend
addchat vbred, len(def)
def = replace(def, " ", " ")
def = replace(def, vbnewline, "")
def = replace(def, vbtab, "")
def = replace(def, cr, "")
def = replace(def, lf, "")
def = replace(def, ctlf, "")
def = replace(def, " ", " ")
call displayText(word & ": " & def, " ", BotVars.Username, 1)
defcount = defcount + 1
if defcount = 1 then exit sub
end if
next
if found = false then call handleText(user, "Definition exists on
urban dictionary, but not on dictionary.com - Definition could not be
displayed.", mode)
End Sub Tag: File permissions in Windows XP home edition Tag: 204543
Credentials when using Controller.CreateScript
I am using Controller.CreateScript successfully to run scripts remotely on
hosts in the same domain. When trying to launch the Controller.CreateScript
on a host that is not in the same domain, I receive a Permission denied
error, and there is an "Access denied attempting to launch a DCOM Server" in
the event log on the server in which the object was attempted. There is not
a trust relationship between these 2 Windows 2000 domains. I would like to
keep things as secure as possible (i.e. I don't want to give "everyone"
permission to create WSHRemote on my host) - what is the best way to
configure the server in the alternate (non-trusting) domain to accept my
remote script, or configure the CreateScript to pass credentials? Tag: File permissions in Windows XP home edition Tag: 204542
script fails if string contains chinese characters
I have a vbscript (see below) that works fine when Regional Options
are set to English (US). However, if I change the Regional Options to
Chinese (PRC), the script fails with the following error message:
Test.vbs(20, 4) Microsoft VBScript runtime error: Invalid procedure
call or argument
The statement that fails is
f=2EWrite(msg)
The value of msg is " starting on 2007=E5=B9=B44=E6=9C=882=E6=97=A5 xxx"
As a workaround, I can get the script to work by changing
FormatDateTime(now(),1)
to
FormatDateTime(now(),4) ' -- returns a date in short format w/o
chinese characters
However, I am wondering if there is a way of making the script to work
with the long date format. Does anyone know why the long format
cause this problem? Is it because latin digits are mixed with chinese
characters?
I see the problem on both XP SP2 and Win 2003 SP1.
Thanks for any suggestion.
HH
Here is the actual script:
'--------------------------------------------------------------------------=
------------------------
Const ForReading =3D 1, ForWriting =3D 2, ForAppending =3D 8
Const OutFile =3D "c:\testfile.txt"
Dim fso, f, msg
Set fso =3D CreateObject("Scripting.FileSystemObject")
if fso.FileExists(OutFile) Then
fso.DeleteFile(OutFile)
End If
Set f =3D fso.OpenTextFile(OutFile, ForWriting, True)
msg =3D " starting on " & FormatDateTime(now(),1) & " xxx"
FormatDateTime(now(),4) & "." & vbCrLf
WScript.Echo "msg type is " & TypeName(msg)
WScript.Echo msg
f.Write(msg)
f.Close
'--------------------------------------------------------------------------=
------------------------ Tag: File permissions in Windows XP home edition Tag: 204540
Boxes appear instead of text when appending to a file.
Hi All,
I'm new to vbscripting and have an issue which I just can't figure
out. I'm hoping somebody here can set me straight.
My Dilemma,
When Appending to a text fil via my script, the text shows up as boxes
in Notepad instead of text. If I copy the text to MSWord or Excel i
see what looks like boxes and other crazy characters. Funny thing is
that when I write to the text file, I have no issues, the text comes
out clean. I'm sure it's my code that is jacked up, so please do fix
her up if you see a problem. I've also attempted specifying the format
as ASCII and get the same result.
Here's what I see in the text file
=E2=B5=84=E4=B5=81=C2=B5=C2=A5=E4=B1=93=E2=B5=83=E4=B1=82=E3=80=B0=E0=A4=B1=
=C5=BE=C2=BA=C3=87=C3=85=C2=AB@=C5=93=C2=AB=E3=8C=89=E3=88=AF=E2=BC=B9=E3=
=80=B2=E3=9C=B0=E3=8C=A0=E3=94=BA=E3=A8=B9=E3=A4=B0=E2=80=9A=E2=80=B9=E0=B5=
=8D
Here's my script, you'll notice this is an HTA so the interesting
section should be between <script Language=3D"VBScript"> and </script>
TIA
<head>
<title>Policy</title>
<HTA:APPLICATION
ID=3D"Policy"
APPLICATIONNAME=3D"Policy"
SCROLL=3D"yes"
SINGLEINSTANCE=3D"yes"
WINDOWSTATE=3D"normal"
>
</head>
<script language=3D"VBScript">
Option Explicit
Const USER_PROFILE =3D &H28&
Const ForReading =3D 1
Const ForWriting =3D 2
Const ForAppending =3D 8
Dim PolicyTextPath, PolicyFolderPath, PolicyUsername,
PolicyReportingPath, PolicyReportingTextPath, PolicyFileName,
PolicyReportingobjFile, _
PolicyTextobjFile, PolicyobjFSO, Policyarrcommands, PolicyobjNetwork,
PolicyobjFolderItem, PolicyobjShell, PolicyobjFolder,
PolicyobjComputer, _
objPolicyFSO, objPolicyFile, PolicyContents, TextstrWordList,
TextstrSearchWord, ReportingstrWordList, ReportingstrSearchWord,
PolicyReportingText, PolicyText
Set PolicyobjFSO =3D CreateObject("Scripting.FileSystemObject")
Set PolicyobjNetwork =3D CreateObject("Wscript.Network")
Set PolicyobjShell =3D CreateObject("Shell.Application")
Set PolicyobjFolder =3D PolicyobjShell.Namespace(USER_PROFILE)
Set PolicyobjFolderItem =3D PolicyobjFolder.Self
Set PolicyobjComputer =3D CreateObject("Shell.LocalMachine")
Set PolicyobjShell =3D CreateObject("Shell.Application")
'Wscript.Echo PolicyobjFolderItem.Path
PolicyReportingPath =3D "\\blabkup\softwaredeployment\policies\Reporting
\"
PolicyFolderPath =3D PolicyobjFolderItem.Path & "\policy"
PolicyUsername =3D PolicyobjNetwork.Username
Sub Window_onLoad
Policyarrcommands =3D Split(Policy.commandLine, chr(34))
PolicyFileName =3D Policyarrcommands(3)
PolicyTextPath =3D PolicyobjFolderItem.Path & "\policy\" &
PolicyFileName & ".txt"
PolicyReportingTextPath =3D PolicyReportingPath & PolicyFileName &
"=2Etxt"
Call PolicyPath
End Sub
'=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Sub PolicyPath
Dim PolicyPath
PolicyPath =3D "\\blabkup\softwaredeployment\policies\Policy\" &
PolicyFileName & ".txt"
Set objPolicyFSO =3D CreateObject("Scripting.FileSystemObject")
Set objPolicyFile =3D objPolicyFSO.OpenTextFile _
(Policypath, ForReading)
PolicyContents =3D objPolicyFile.ReadAll
objPolicyFile.Close
BasicTextArea.value =3D PolicyContents
End Sub
'=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Sub CheckBox
If Checkbox1.Checked Then
Msgbox "By selecting the (I Agree) checkbox you agree to
the policy listed and it's contents."
Call FolderExist
End If
If Checkbox2.Checked Then
Msgbox "You selected (I Do Not Agree), you will continue to
be prompted to accept this policy" _
& vbcrlf & "as it is a business policy which needs to be accepted."
Call Cancel
End If
End Sub
'=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Sub FolderExist
If PolicyobjFSO.FolderExists(PolicyFolderPath) Then
Set PolicyobjFolder =3D PolicyobjFSO.GetFolder(PolicyFolderPath)
If PolicyobjFSO.FileExists(PolicyTextPath) Then
Set PolicyobjFolder =3D PolicyobjFSO.GetFile(PolicyTextPath)
Call TextFileWrite
Else
Call TextFileCreate
End If
'If PolicyobjFSO.FileExists(PolicyReportingTextPath) Then
' Set PolicyobjFolder =3D
PolicyobjFSO.GetFile(PolicyReportingTextPath)
' Call ReportingTextFileWrite
'Else
' Call ReportingTextFileCreate
'End If
Else
Set PolicyobjFolder =3D PolicyobjFSO.CreateFolder(PolicyFolderPath)
Call TextFileCreate
End If
End Sub
'=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Sub TextFileCreate
Set PolicyTextobjFile =3D PolicyobjFSO.CreateTextFile(PolicyTextPath,
ForWriting, True)
'PolicyTextobjFile.writeline "Created " & Now
PolicyTextobjFile.Close
Set PolicyTextobjFile =3D Nothing
Call TextFileWrite
End Sub
'=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Sub ReportingTextFileCreate
Set PolicyReportingobjFile =3D
PolicyobjFSO.CreateTextFile(PolicyReportingTextPath, ForWriting,
True)
'PolicyReportingobjFile.writeline "Created " & Now
PolicyReportingobjFile.Close
Set PolicyReportingobjFile =3D Nothing
Call ReportingTextFileWrite
End Sub
'=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Sub TextFileWrite
Set PolicyTextobjFile =3D PolicyobjFSO.OpenTextFile (PolicyTextPath,
ForReading)
TextstrWordList =3D PolicyTextobjFile.ReadAll
PolicyTextobjFile.Close
TextstrSearchWord =3D PolicyobjComputer.machinename & vbtab &
PolicyUsername
If InStr(TextstrWordList, TextstrSearchWord) =3D 0 Then
Set PolicyTextobjFile =3D PolicyobjFSO.OpenTextFile
(PolicyTextPath, ForAppending)
PolicyTextobjFile.Writeline PolicyobjComputer.MachineName & vbtab
& PolicyUsername & vbtab & Now
msgbox PolicyobjComputer.MachineName & vbtab & PolicyUsername &
vbtab & Now
PolicyTextobjFile.Close
End If
If PolicyobjFSO.FileExists(PolicyReportingTextPath) Then
Set PolicyobjFolder =3D PolicyobjFSO.GetFile(PolicyReportingTextPath)
Call ReportingTextFileWrite
Else
Call ReportingTextFileCreate
End If
Set PolicyTextobjFile =3D Nothing
Call ReportingTextFileWrite
End Sub
'=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Sub ReportingTextFileWrite
Set PolicyReportingobjFile =3D PolicyobjFSO.OpenTextFile
(PolicyReportingTextPath, ForReading)
ReportingstrWordList =3D PolicyReportingobjFile.ReadAll
PolicyReportingobjFile.Close
ReportingstrSearchWord =3D PolicyobjComputer.machinename & vbtab &
PolicyUsername
If InStr(ReportingstrWordList, ReportingstrSearchWord) =3D 0 Then
Set PolicyReportingobjFile =3D PolicyobjFSO.OpenTextFile
(PolicyReportingTextPath, ForAppending)
PolicyReportingobjFile.WriteLine PolicyobjComputer.machinename &
vbtab & PolicyUsername & vbtab & Now
'msgbox PolicyobjComputer.machinename
PolicyReportingobjFile.Close
End If
Set PolicyReportingobjFile =3D Nothing
Call Cancel
End Sub
'=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Sub Cancel
Set PolicyobjFSO =3D Nothing
Set PolicyobjNetwork =3D Nothing
Set PolicyobjShell =3D Nothing
Set PolicyobjFolder =3D Nothing
Set PolicyobjFolderItem =3D Nothing
Set PolicyobjComputer =3D Nothing
Set PolicyobjShell =3D Nothing
Self.Close
End Sub
'=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
</script>
<body TEXT=3D#000000 STYLE=3D"font:14 pt arial; color:Black;
filter:progid:DXImageTransform.Microsoft.Gradient
(GradientType=3D1, StartColorStr=3D'#000000', EndColorStr=3D'#FF9933')">
<Table ALIGN=3DCenter>
<textarea name=3D"BasicTextArea" rows=3D"25" cols=3D"75"></textarea>
</Table>
<TABLE ALIGN=3DRIGHT>
<input type=3D"checkbox" name=3D"Checkbox1"> I Agree<br>
<input type=3D"checkbox" name=3D"Checkbox2"> I Do Not Agree<p>
<input id=3Drunbutton class=3D"button" type=3D"button" value=3D"OK"
name=3D"run_button" onClick=3D"CheckBox">
<input id=3Drunbutton class=3D"button" type=3D"button" value=3D"Cancel"
name=3D "Cancel_Button" onClick=3D"Cancel">
</Table>
</body> Tag: File permissions in Windows XP home edition Tag: 204539
Context Menu ADUC check to see if more that one user is selected
I have added a context menu to Users in ADUC. This menu launches an
application but it should only do so if one user is selected. I am
struggling with the code to check if more than one user is selected.
Any ideas are much appreciated.
Thanks
Dallas Tag: File permissions in Windows XP home edition Tag: 204538
Finding multipe cases that are true
Hi,
I know I read about this somewhere, but I just can't find it again.
I am trying to write a script that will transfer data from a CSV file
to an Excel spreadsheet. The data has to do with the status of trouble
tickets. There can be any one of five different statuses for each
tech. There could be one or five or none. the data looks like this;
"Problem ID +","Assignee ","Status","D/T Reported +"
"PRB000007683094","joe.tech","New","3/30/2007 9:00:30 AM"
"PRB000007663668","joe.tech","Service Restored","3/23/2007 8:25:40 AM"
"PRB000007671182","dan.man","In Progress","3/26/2007 7:24:33 PM"
"PRB000007618787","dan.man","Service Restored","3/7/2007 10:50:10 AM"
"PRB000007671271","dan.man","Service Restored","3/26/2007 9:47:17 PM"
"PRB000007680738","dan.man","Service Restored","3/29/2007 11:50:54 AM"
"PRB000007652289","dan.man","Service Restored","3/19/2007 6:36:24 PM"
"PRB000007667099","dan.man","Service Restored","3/25/2007 3:48:01 AM"
"PRB000007489048","freebird","Pending","1/18/2007 12:30:31 PM"
"PRB000007621881","black.hat","Service Restored","3/8/2007 9:10:14 AM"
"PRB000007612876","jarhead","On Hold","3/5/2007 3:35:12 PM"
"PRB000007613512","jarhead","Service Restored","3/5/2007 6:00:28 PM"
If id do an If Then Else statement I only get one type, if I do a
Select case statement I get one type. How can I get each of them into
its proper place? Tag: File permissions in Windows XP home edition Tag: 204536
Parsing Script Help
I need to create a parsing script, but it has been a long time since
I've done any scripting that I need a major refresher. Here is what I
need from the script:
1. Read an IDX file (large text file from an AS400/iSeries)
2. Capture the characters 1-16 and 17-32 as separate variables (Lets
call them A and B)
3. Compare A and B to see if they are identical, if they are ignore
them, if they aren't prepare them for output
This is only the first part of a bigger process. What is happening
is...Imagine you have an account at a bank (A). For each account you
can have an additional sub account, like multiple savings, checking,
vacation, car loan, etc... and each of these would be identified by
their own number in field B. If you only have one account A will
always equal B, but if you have multiple accounts A will never equal
B. So I need to know which set of A's and B's don't equal.
Once I have that information I will need to compare it with another
file to make sure that the B value belongs to the A value. So back to
our example I want to make sure John Doe's checking account belongs to
John Doe and not John Smith. For right now All I need help with is
the separating the data relevant to what I need.
Thank you. Tag: File permissions in Windows XP home edition Tag: 204533
Re: [ann] Using an HTA as a dialog for an HTA...
Please make a test to the following link :
http://groups.google.com/group/microsoft.public.fr.scripting/browse_thread/thread/845329491e365fc/a4e92bb90cb6c58f?lnk=st&q=+group%3A*.scripting+author%3AJean+-+JMST&rnum=12#a4e92bb90cb6c58f
Tsakalidis G. Evangelos
Serres / Greece
"mr_unreliable" <kindlyReplyToNewsgroup@notmail.com> wrote in message
news:eHKIHrkaHHA.1508@TK2MSFTNGP06.phx.gbl...
> From-time-to-time one sees quibbles posted in the
> wsh/vbs ng's, concerning various inconveniences and/or
> inadequacies of the "usual suspects" for dialogs, (e.g.,
> msgboxes, showModalDialog, showModelessDialog, etc).
>
> HTA's are generally considered more flexible than the above,
> but using an hta as a dialog is problematical, especially if
> you want to communicate with it. And so, enter the
> _"wshGetHTADocObject"_ utility, which does just that.
>
> The wshGetHTADocObject is an actX object, which does just
> what its name suggests. Once you have the doc object, then
> you can interface with the hta's elements and events. Granted,
> this is no different than interfacing with an instance if
> Internet Explorer, except that you don't have to deal with
> those petty annoyances involved with using IE as a dialog.
>
> The (c++) code for this actX object was provided by KB249232.
> However, I found something much more useful. Eduardo Anthony
> Morcillo, (a.k.a., "Edanmo") converted microsoft's c++ code
> into vb.net, and posted it here:
>
> http://www.mvps.org/emorcillo/en/code/inet/iedom.shtml
>
> I converted Edanmo's code from vb.net to vb5, so that I could
> compile it with microsoft's (free, but subsequently abandoned)
> vb5cce compiler.
>
> The attachment includes the source code, the compiled actX
> object (an ocx), an hta mini app plus an hta child dialog.
> It then occurs that one may also use hta's as dialogs from
> a normal script, so an example of that is included too.
>
> Reqirements: in order to use the ocx, you will have to register
> it. Also, you will need the vb5 runtimes (which I understand
> do not come with winVista, but are still available for
> downloading from msdn). Finally, you will need the oleacc.dll.
> This one is not very familiar, it comes with the "accessability"
> package. My own (ancient) system dates back to the last century,
> and it does have oleacc.dll already installed. But if your own
> system does not, then get out your trusty installation CD, and
> bring up your installer, and look for the "accessability" package.
>
> cheers, jw
> Tag: File permissions in Windows XP home edition Tag: 204532
Windows Scripting (WSH) Filetypes...
Hello, Folks!
I know that .VBS and .JS are used as just straight scripting filetypes
that can be run by CScript.exe or WScript.exe. I, also, know
that .WSF files are XML-based scripting files where you can have VBS
and / or JS sections mixed together (not sure if this is run through
WScript, CScript, or both). I have read that a .WSH file is a "Window
Scripting Host Settings file" but I have never seen any examples of it
being used.
Does anyone have any practical examples of using a .WSH file?
TIA... Tag: File permissions in Windows XP home edition Tag: 204526
force a script to resume before it is ready
Can I be Helped???
This is part of my FTP script that connects to multiple Computers (as
determined by a machine.txt file) and retrieves a file from each
computer with all having the same name. The script then renames that
file to the computer name, date and time.
My problem is when one of the computers is not available, the script
hangs while attempting to get that file then errors out because it is
trying to rename a file that does not exist.
I know that you can use "on error resume next" with regard to renaming
a file that does not exist,
but I would still like to make it continue after only a few seconds.
My questions;
Can you tell it to "On error resume next" say after only 3 or 4
seconds.
or can I tell it "On error to Cleanup files" and goto Next to
continue
loop.
Thanks so much,
Cisco
'__________________________________________________
' now run the FTP batch file created above
' create a shell and run the batch file
'_________________________________________________
Set oShell = WScript.CreateObject ("WSCript.shell")
oShell.run strFTPBat,0,TRUE
Set oShell = Nothing
'_____________________________________
'Cleanup files
'_______________________________________
fso.DeleteFile strFTPBat,1
fso.DeleteFile strResponseFile,1
'______________________________________________
'Rename the Files
'_____________________________________________
set fso = createobject("scripting.filesystemobject")
set file = fso.getfile("machine.ini")
mybase = fso.getbasename(file.name)
myext = fso.getextensionname(file.name)
mysuffix = replace(formatdatetime(now(),vbShortdate),"/","-")
mytime = replace(formatdatetime(now(),vbLongTime),":","-")
file.name = mybase & strFtpHost & "-" & mysuffix & "-" & mytime & "."
& myext
'file.name = mybase & strFtpHost & "-" & mysuffix & "." & myext
'msgbox file.name
'______________________________________________
'Continue Loop
'_______________________________________________
Next
'____________End Of Script__________ Tag: File permissions in Windows XP home edition Tag: 204511
E-Mail on AD Group Membership Change
Hi Guys.
I am really hoping someone can help me.
Does anyone have a script or can help me with one. I need a script that i
can run once an hour that will check the Domain Admins and the Administrator
groups in AD and if any change has been made since the last check to send and
email
Thanks to anyone who can help me with this Tag: File permissions in Windows XP home edition Tag: 204508
Error Number 13 Description mismatch
I can't seem to get this script to work. After hours of looking with
no luck, maybe you guys can help me find the errors.
'define
'1.0
' ^ Version Required ^
' Plugin Script
' Designed and Scripted By:
Sub define_Event_Load()
End Sub
'// Fires when the bot executes.
Sub define_Event_LoadDisplay()
End Sub
'// Fires when a user on battle.net talks.
Sub define_Event_UserTalk(Username, Flags, Message, Ping)
if Left(LCase(Message),7) = BotVars.Trigger & "define" then
GetDBEntry Username, myAccess, myFlags
VetoThisMessage()
if instr(myFlags, getAccess("definition")) <> 0 then
if len(Message) < 9 then
call handleText(username, "Supply a word to be defined.", ping)
else
call define(mid(Message, 9), username, ping)
end if
end if
end if
End Sub
Sub define_Event_PressedEnter(Text)
call define_event_userTalk(BotVars.username, 0, Text, -4)
End Sub
Sub define_Event_WhisperFromUser(Username, Flags, Message)
call define_Event_UserTalk(BotVars.Username, 0, Message, -3)
End Sub
Sub define(word, user, mode)
if lcase(word) = "warlock" or lcase(word) = "w_a_r_l_o_c_k" then
call handleText(user, word & ": God's gift to warcraft.", mode)
exit sub
end if
if lcase(word) = "coke" or lcase(word) = "cold_cherrycoke" then
call handleText(user, word & ": See Noob.", mode)
exit sub
end if
if lcase(word) = "noob" then
call handleText(user, word & ": Person that sucks balls at video
games like warcraft.", mode)
exit sub
end if
if ScINet.stillExecuting then
call handleText(user, "The bot is busy... wait a few seconds and
try again.", mode)
exit sub
end if
content = InetOpen("http://dictionary.reference.com/search?q="&word)
if instr(content, "No entry found for") <> 0 then
call defUrban(word, user, mode)
exit sub
end if
data = split(content, "<LI TYPE=""a"">")
if ubound(data) = 0 then
info = split(content, "<DD>")
if ubound(info) > 3 then
for i=1 to ubound(info)
newdef = mid(info(i), 1, instr(info(i), "<")-1)
call displayText(i & ": " & newdef, " ", BotVars.Username, 1)
next
else
for i=1 to ubound(info)
newdef = mid(info(i), 1, instr(info(i), "<")-1)
call displayText(i & ": " & newdef, " ", BotVars.Username, 1)
next
end if
if ubound(info) = 0 then
call defUrban(word, user, mode)
end if
exit sub
end if
'else if ubound(data) > 0, when there is a list of definitions...
if ubound(data) > 3 then
call handleText(user, "Found " & ubound(data) & " entries for "&
word & ". Here are three.", mode)
for i=1 to 3
newdef = mid(data(i), 1, instr(data(i), "<")-2)
call displayText(i &": " & newdef, " ", BotVars.Username, 1)
next
else
for i=1 to ubound(data)
newdef = mid(data(i), 1, instr(data(i), "<")-2)
call displayText(i & ": " & newdef, " ", BotVars.Username, 1)
next
end if
End Sub
Sub defUrban(word, user, mode)
if ScINet.stillExecuting then
call handleText(user, "The bot is busy... wait a few seconds and
try again.", mode)
exit sub
end if
content = InetOpen("http://www.urbandictionary.com/define.php?
term="&word)
if instr(content, "is undefined") <> 0 then
call handleText(user, "Failed to find a definition using both a
dictionary and an urban dictionary.", mode)
exit sub
end if
defArray = split(content, "<div class=""def_p"">")
if ubound(defArray) = 0 then
call handleText(user, "Failed to find a definition using both a
dictionary and an urban dictionary.", mode)
exit sub
end if
defcount = 0
found = false
for i=1 to ubound(defArray)
if instr(defArray(i), "1.") = 0 then
found = true
def = mid(defArray(i), instr(defArray(i), "<p>"))
def = mid(def, 1, instr(def, "</p>")-1)
def = replace(def, """, "")
'addchat vbyellow, def
while instr(def, "<") <> 0
pos1 = instr(def, "<")
pos2 = instr(def, ">")
temp = mid(def, pos1, pos2-pos1+1)
def = replace(def, temp, "")
wend
addchat vbred, len(def)
def = replace(def, " ", " ")
def = replace(def, vbnewline, "")
def = replace(def, vbtab, "")
def = replace(def, cr, "")
def = replace(def, lf, "")
def = replace(def, ctlf, "")
def = replace(def, " ", " ")
call displayText(word & ": " & def, " ", BotVars.Username, 1)
defcount = defcount + 1
if defcount = 1 then exit sub
end if
next
if found = false then call handleText(user, "Definition exists on
urban dictionary, but not on dictionary.com - Definition could not be
displayed.", mode)
End Sub Tag: File permissions in Windows XP home edition Tag: 204494
Operating system question
Ok, so I know this has to be a fairly easy vbs, but I'm looking to gather 2
requirements: First I need to know the Product key on all my PC's on the
network (2000 and XP). Secondly, I would like to also check to see if it is a
Dell PC. I would like all of this info to be sent to a text doc that I can
come back to and look over.
Thoughts? Tag: File permissions in Windows XP home edition Tag: 204490
Internet / Intranet
Is there a script to determine if a web page was opened locally (Intranet)
or remotely (Internet)?
Thank you, Tag: File permissions in Windows XP home edition Tag: 204489
ADSI - Uncheck recipient update policy checkbox
Hello all,
I have written a script that creates userobjects in Active Directory using
ADSI. When a user is created, and I take a look on the tab E-Mail Addresses
in the Active Directory Users and Computers snap-in, the checkbox
"Automatically update e-mail addresses based on recipient policy" is checked.
I want to uncheck this checkbox, but I cannot find out how to do this.
Does anybody know a method to disable the checkbox from a script?
Many thanks in advance. Tag: File permissions in Windows XP home edition Tag: 204480
vbscript security
Hello,
we have a very big environment (600 DC, 16.000 ws) and we are making most of
the admin related tasks automatically by using scripts. In our scripts, we
have to write a domain admin account name and its password. We are using
lsrunase.exe utility and conerting our script into exe. Most of the security
people say this way is not secure. Is there any other way to make our
scripts much more secure?
Thanik in advance.
Atilla Gultekin. Tag: File permissions in Windows XP home edition Tag: 204476
determine how much ram
Is it possible to use vbscript and wmi on a bunch of 2k machines to
determine
-how many memory slots are on the main board
-how much memory is in each memory slot
Thanks, Jeremy Tag: File permissions in Windows XP home edition Tag: 204467
open CD drive properties panel
Hi all. Anyone know how I can open the CD drive property panel? I want
to duplicate what happens when you right click on the drive and select
properties. Tag: File permissions in Windows XP home edition Tag: 204465
Error Handling
My vbscript runs through a list of computers and performs a check. On a few
computers I get the following
Error: Permission denied: 'Get Object'
Code: 800A0046
Errors on this: Set oRegistry =
GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer &
"/root/default:StdRegProv")
I have On Error Resume Next in my script, however, then this error is
encountered it is retaining the values from the last successful check. I
need to be able to skip over this and not retain the previous value. Tag: File permissions in Windows XP home edition Tag: 204457
MapNetwork drive
Hello
I'm currently mapping a network in my script, but what if that drive is not
onlone for some reason. How can I tell, so I can take the appropriate
action? Will that method return something I can branch off of?
Thanks Tag: File permissions in Windows XP home edition Tag: 204455
How to save an XML doc to a variable?
I can load a XML document from a VBScript variable, perform some modifications but when I try to
save the updated XML document to a variable using the save() method, it does not work since this
method does not output to a variable;
Dim XMLDoc, xmlString
Set XMLDoc = CreateObject("msxml2.domdocument")
XMLDoc.async = vbFalse
XMLDoc.loadXML("<?xml version=""1.0""?><test>data</test>")
'
' code to add/update elements in XMLDoc
'
XMLDoc.save(xmlString)
I looked at the WriteTo() and WriteContentTo() methods as well but they do not store in a variable.
How can I save the updated XML document to a vbscript variable?
Thanks. Tag: File permissions in Windows XP home edition Tag: 204449
Run As command from inside batch file
From inside my batch file I need to run an application as a different user,
similar to the Run As command from the desktop. I'm currently using a DOS
Batch file but could use a vbscript batch as well.
Is there a way to exexcute a file from a batch file as a different user?
My current solution is using a Scheduled Task that is configured to run as a
different user and then I run that Task from the batch file.
schtasks /run /tn wbp04324_filecopy
I'd like to avoid using the Scheduled Task if I can call it directly.
Thanks, -phil
--
no place like 127.0.0.1 Tag: File permissions in Windows XP home edition Tag: 204448
Openings with fortune 500, Nasdeq listed, top name in Industries.
Hi,
I introduce myself as Rajeev, I am a IT-Recruiter(Concorde Management
Consultants) and working with Top companies in India. I have some
very
good positions in Configuration Management, Build & Release in India.
Kindly mail me your cv at rajeev@cmctechjobs.com
Thanks
Rajeev Tag: File permissions in Windows XP home edition Tag: 204440
Vbscript - Terminal Server enumerate all logged on users
Hi guys,
I need to enumerate all currently logged on users to a Terminal
server. I'm assuming WMI can be used for this. The reason being is
that we have an application that is cauing problems when two users
logging in with the same sAMAccount are using it.
The script will run locally on the terminal server. I can't seem to
find anything using the usual serach engines...
Can anyone point me in the right direction?
Many thanks,
-Chris Tag: File permissions in Windows XP home edition Tag: 204438
Single quote problem
Anyone know how I can embed a names with embedded single quotes in an Access
Database, using VB script? The problem I have is illustrated in the
following error message I get when trying to save the data submitted by the
user:
=== > This is a dump of the SQL script
insert into tblLocate (weekending,
staffID,fullname,Telephone,dayofweek,Days, familyVisited, FamilyPhone,
FamilyRef, Activity, Location, timestart,timefinish, visitTime, StdHours,
fraction, remarks, Status) Values ('30/03/2007', '00123456', 'Mary
O'Loughlin', '1234 5678', 'Monday', 'Mon,Tue,Wed,Thu,Fri', 'Damian Murphy',
'', '24', 'Family visit', '25 Elsworth Crs', '8:00 am', '1:00 pm', 5, 7.6,
0.6, '', '');
=======> This is the error message I get
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in
query expression Mary O'Loughlin', '1234 5678', 'Monday', 'Mon'.
write2db.asp, line 168
=======> End error message
The name O'Loughlin is clearly the problem and I'm fresh out of ideas...
Thanks
--
Richard John (aka RJ)
rjbpond at bigpond.net.au Tag: File permissions in Windows XP home edition Tag: 204432
Wsf Script need help
I've never script before so I would be grateful it someone would help me out
with the below script. I would it to create a fouth level OU. Currently I
tell it what the Top level OU is that I want to create Second and Third level
OU. I'm unable to get it to create a fourth level OU. please show me exactly
were to make the changes.
OU
-Ou-2
-Ou3
-Ou4
<?xml version="1.0"?>
<job id="CreateOUs">
<script language="VBscript">
<![CDATA[
'***************************************************************
'*** The script creates OU structure underneath top level OU
'*** Second level: Accounts and Resources
'*** Third level:
'*** Accounts children OUs - Users, ServiceAccounts, Groups, Admins
'*** Resources children OUs - Workstations, Servers
'***
'*** To execute, run cscript.exe //nologo CreateOUs.wsf OUName
'*** where OUName is the name of the top level OU
Option Explicit
Dim strOU1 'the first level OU
Dim strOU2 'the second level OU
Dim strOU3 'the third level OU
Dim arrOUTier2 'array of the second level OUs
Dim arrOUTier3a 'first array of the third level OUs
Dim arrOUTier3b 'second array of the third level OUs
Dim strDomainDN 'name of the domain
Dim strADsPath 'ADsPath of the first level OU
Dim strADsSubPath 'ADsPath of the second level OU
Dim adsRootDSE 'aDSRootDSE object
Dim adsContainer, adsSubContainer, adsOU
'variables representing AD container objects
'***************************************************************
'*** Connect to the current domain
Set adsRootDSE = GetObject("LDAP://rootDSE")
strDomainDN = adsRootDSE.Get("defaultNamingContext")
'***************************************************************
'*** Connect to the top level OU
strOU1 = WScript.Arguments(0)
strADsPath = "LDAP://OU=" & strOU1 & "," & strDomainDN
Set adsContainer = GetObject(strADsPath)
On Error Resume Next
arrOUTier2 = Array("Accounts", "Resources")
arrOUTier3a = Array("Users", "ServiceAccounts", "Groups", "Admins")
arrOUTier3b = Array("Workstations", "Servers")
'***************************************************************
'*** Populate the OU structure
For Each strOU2 in arrOUTier2
Set adsOU = adsContainer.Create("OrganizationalUnit", "OU=" & strOU2)
adsOU.SetInfo
If ErrCheck(Err, strOU2) <> 2 Then
strADsSubPath = "LDAP://OU=" & strOU2 & ",OU=" & strOU1 & "," & strDomainDN
Set adsSubContainer = GetObject(strADsSubPath)
Select Case strOU2
Case "Accounts"
For Each strOU3 in arrOUTier3a
Set adsOU = adsSubContainer.Create("OrganizationalUnit", "OU=" & strOU3)
adsOU.SetInfo
Call ErrCheck(Err, strOU3)
Next
Case "Resources"
For Each strOU3 in arrOUTier3b
Set adsOU = adsSubContainer.Create("OrganizationalUnit", "OU=" & strOU3)
adsOU.SetInfo
Call ErrCheck(Err, strOU3)
Next
End Select
End If
Next
On Error GoTo 0
Set adsOU = Nothing
Set adsContainer = Nothing
'***************************************************************
'*** Error checking function
Function ErrCheck(objErr, strObj)
If objErr.Number <> 0 Then
'if the object already exists
If objErr.Number = &H80071392 Then
WScript.Echo "The OU " & strObj & " already exists"
ErrCheck = 1
Else
WScript.Echo "Unexpected error " & objErr.Description
ErrCheck = 2
End If
Else
ErrCheck = 0
End If
objErr.Clear
End Function
]]>
</script>
</job> Tag: File permissions in Windows XP home edition Tag: 204428
VBScript error -2147217900
I am trying to insert the record using ADO, when the record already exists I
get error msg something like this
Err.description = "[Sybase][ODBC Driver][Adaptive Server Anywhere]Primary
key for table 'Table1' is not unique"
err.number = -2147217900
I want to trap this and formulate better error message. WHats the best way
to do...is the error number here unique number (-2147217900)
Thanks Tag: File permissions in Windows XP home edition Tag: 204417
Outlook 2007 and VBScript
Hi,
Anyone having a problem getting Outlook 2007 to open using VBScript?
Here is my code;
Set WSHShell = WScript.CreateObject("WScript.Shell")
Set objOL = WScript.CreateObject("Outlook.Application")
And here is the error I get;
WScript.CreateObject: Could not locate automation class named
"Outlook.Application".
Have they changed the name? and if so to what? Tag: File permissions in Windows XP home edition Tag: 204414
Fastest way to test for empty string
I am a programmer for a small web development company, using classic ASP
(on IIS 6). The question has arisen as to whether a test of the form
'Len(x)=0' executes faster than 'x=""'.
My initial guess was that 'x=""' would be faster than 'Len(x)=0', but a
colleague disagrees.
I very quickly knocked up the following test script, which is followed
by the results I obtained from three runs.
===
s1 = ""
s2 = "hello"
t1 = now()
for i = 1 to 10000000
if s1 = "" then j = 1
if s2 = "" then j = 2
next
t2 = now()
for i = 1 to 10000000
if Len(s1) = 0 then j = 1
if Len(s2) = 0 then j = 2
next
t3 = now()
wscript.echo (t2-t1)*84600, (t3-t2)*84600
===
C:\Documents and Settings\Nick.BRAM-2\Desktop>test1.vbs
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
12.7291671800776 21.5416661623749
C:\Documents and Settings\Nick.BRAM-2\Desktop>test1.vbs
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
11.749999668973 21.5416667779209
C:\Documents and Settings\Nick.BRAM-2\Desktop>test1.vbs
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
11.750000284519 21.5416667779209
C:\Documents and Settings\Nick.BRAM-2\Desktop>
===
This suggests that 'Len(x)=0' is actually quite a bit slower than
'x=""'. Am I wrong? Have I missed something vital? Is this an issue for
which there has been any discussion on the Internet (and if so, where)?
If so, is there a general consensus one way or the other?
Answers to any of these questions would be greatly appreciated!
PS: I have spotted one mistake -- that I should have used 86400 instead
of 84600 -- but unfortunately it's irrelevant.
--
Nick Roberts Tag: File permissions in Windows XP home edition Tag: 204412
problem using variable with wmi query...
Hello Sirs,
I have a problem using a variable with the following line of code:
Set colMonitoredEvents = objWMIService.ExecNotificationQuery _
("SELECT * FROM __InstanceModificationEvent WITHIN 2 WHERE " _
& "TargetInstance ISA 'CIM_DataFile' and " &
"TargetInstance.Name=" & "'objFile'")
The objfile variable points to a file in the format c:\\scripts\
\test.txt.
If I replace the variable with the file name the script works
correctly.
Any ideas are very, very welcome.
Thanks!
zz Tag: File permissions in Windows XP home edition Tag: 204411
VBS login script map drives then printers then run exe file
' Windows Logon Script.
' VBScript - Just Map the two Fidelio Drives
' Author ' Version 1.0 2/26/07
' ----------------------------------------------------------'
' TwoMap.vbs - Map Network Drive to M: and P: and S:
' Example of VBScript Mapping two drives in one script.
' -----------------------------------------------------------------'
Option Explicit
Dim objNetwork, strRemotePath1, strRemotePath2
Dim strDriveLetter1, strDriveLetter2
strDriveLetter1 = "K:"
strDriveLetter2 = "U:"
strRemotePath1 = "\\server\share1"
strRemotePath2 = "\\server\share2"
Set objNetwork = CreateObject("WScript.Network")
' Section which maps two drives for fidelio and the common drive
objNetwork.MapNetworkDrive strDriveLetter1, strRemotePath1
objNetwork.MapNetworkDrive strDriveLetter2, strRemotePath2
' Extra code just to add a message box
'WScript.Echo "Map drives " & strDriveLetter1 & " & " &
strDriveLetter2
'section to RUN VERSION Control
Set objShell = CreateObject("WScript.Shell")
objShell.Run "K:\path1\path2\version.exe"
'Wscript.Quit
' End of Windows Logon Script Example
The exe file won't run and gives this error message
Error is Variable is undefine:'obsShell'
I'm sure this is something simple but i'm kinda new to this Tag: File permissions in Windows XP home edition Tag: 204406
CDO.Message Object
Does anyone know a way to get the result from the .SEND method of a
CDO.Message object? i.e.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Set objEmail = CreateObject("CDO.Message")
' assume email is configured appropriately
objEmail.Send
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When I run
result = objEmail.Send
result is blank or = "" when it is successful.
I am trying to determine that the MSX server did accept my SMTP traffic.
Thanks,
Bart Tag: File permissions in Windows XP home edition Tag: 204405
Internet connections settings via VBS?
Hi folks,
I've got the following scenario:
We run in our domain XP-SP2 and 2K workstations with Internet Explorer 6 and
7.
I'm looking for a solution to set up two checkboxes within IE6 and IE7:
"Automatically detect settings" and "Use automatic configuration script" on
the "Local Area Network Settings" tab.
What I got so far is:
I built an ADM template file to set the property "Use automatic
configuration script". It works fine.
It's not a problem to solve this in VBS because the property is saved in the
registry in
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet
Settings
in the variable AutoConfigURL.
The catch is to check the box "Automatically detect settings". For IE7 I
found the solution in deleting the whole key
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet
Settings\Connections
IE7 re-creates it after start and the desired box is checked.
IE6 doesn't work in the same way. It also creates the key after deletion,
but without the box checked.
The status of the box "Automatically detect settings" seems to be stored in
the REG_Binary values in the key above.
Because I don't know how to interpret this type of value I tried another way
using WMI.
Yes, I was able to retrieve IEs settings with this little script and tried
to save a changed value back using the put_ method.
strComputer = "."
'~ Set objWMIService = GetObject("winmgmts:\\" & strComputer _
'~ & "\root\cimv2\Applications\MicrosoftIE")
'~ Set colIESettings = objWMIService.ExecQuery _
'~ ("Select * from MicrosoftIE_LANSettings")
'~ For Each strIESetting in colIESettings
'~ 'Wscript.Echo "Autoconfiguration proxy: " & strIESetting.AutoConfigProxy
'~ 'Wscript.Echo "Autoconfiguration URL: " & strIESetting.AutoConfigURL
'~ 'Wscript.Echo "Autoconfiguration Proxy detection mode: " & _
'~ strIESetting.AutoProxyDetectMode = 1
'~ 'Wscript.Echo "Proxy: " & strIESetting.Proxy
'~ 'Wscript.Echo "Proxy override: " & strIESetting.ProxyOverride
'~ 'Wscript.Echo "Proxy server: " & strIESetting.ProxyServer
'~ strIESetting.Put_
'~ Next
Unfortunately the provider doesn't support this method in this class.
Do you have an idea to solve this problem?
I'm not sure about using branding, because I need to keep the settings
flexible to change.
Thanks a lot.
Andreas Woll Tag: File permissions in Windows XP home edition Tag: 204402
Changing Permissions - [WP]
I am looking for vbscript which can change permissions on a windows registry
key?
Anybody help please, Thank you. Tag: File permissions in Windows XP home edition Tag: 204398
How can I modify file permission for a single account in Windows XP Home
edition? Tanks for Your help