Logoff Script
We want to put a script as a schedule task on a windows XP SP2 that will log
a user off a certain time at night. Does anyone have a script like that?
Thanks,
Eric Sabo
sabo_e@cup.edu Tag: VBScript Documentation Tag: 179346
.Net security
Hi,
I'm looking to change permission in .Net security for my local intranet
traffic. Does anyone have suggestions as to how I may do this?
Thanks in Advance,
JeffH Tag: VBScript Documentation Tag: 179343
WMI impersonation on local machine
hello,
why I cannot impersonate script caller on the same machine when using WMI?
is there
a method to do it?
I do this with sortcuts, but the script runs only under Network Service
account and not under the caller's account.
strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\"
& strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("select * from Win32_ShortcutFile
where name like 'c:\\h%'")
For Each objItem in colItems
Wscript.Echo "target: " & objItem.Target
Next
:
O. Tag: VBScript Documentation Tag: 179342
Help with InvokeVerbEx needed
The following is a direct quote for the Windows 2000 Scripting Guide
<begin quote>
Be aware that verbs always function in exactly the same way they do
when clicked in Windows Explorer. If you right-click a file and select
Open, the file automatically opens. If you select Delete, however, a
confirmation box is displayed before the file is deleted. This same
confirmation box appears if you attempt to delete any object using
InvokeVerbEx. For example, using the Delete verb on a file results in
a dialog box similar to the one shown in Figure 11.8.
By comparison, right-clicking a file and selecting Print does not
display a dialog box; instead, the file is automatically printed to
the default printer. If you use InvokeVerbEx to print a file
programmatically, that file is automatically printed to the default
printer without displaying a dialog box of any kind.
</end quote>
And here is the sample code:
TargetFolder = "C:\Logs"
set objShell = CreateObject("Shell.Application")
set objFolder = objShell.Namespace(TargetFolder)
set colItems = objFolder.Items
for each objItem in colItems
wscript.echo objItem.Name
objItem.InvokeVerbEx("Print")
next
Contrary to what is printed a dialog box DOES appear for "every" file
print. I can not seem to find any information on the optional
parameter.
Does anyone know of a way to make InvokeVerbEx perform as documented -
I want to invoke the print verb on a file without any user
intervention.
Thanks
Lee Tag: VBScript Documentation Tag: 179336
Binding to a user principal name in ad
Hi all:
I am looking for a way to bind to a user in AD by using the User Principal
Name (Which I believe is the field on the Account tab Called User Login
Name). Now I am using the code below which correctly binds to the AD user if
the Display name is the same as the UPN but it will not bind if the Display
name is set to last name, first name. When the script runs correctly it then
updates the description field for the user, disables it and then moves it to
a deletions OU, but if I cannot bind to the user then it will not do all of
this stuff.
EX1
Display Name = aa123
UPN = aa123
works correctly binds and script continues if user enters aa123 user into
code below
EX2
Display name = Doe, John
UPN = aa123
does not find or bind to the user if you enter aa123 - script error
EX3
Display name = Doe, John
UPN-aa123
does find the user if you enter doe, john but the script will not update the
description field for the user or the rest of the .
Set objUser = GetObject _
("LDAP://cn="& getuser &",OU=users,OU=MANAGED DESKTOP
SERVICES,OU=HHH,DC=aa,DC=abc,DC=com")
where getuser is an input from a html form
Any suggestions on how to bind to the UPN as most of our users have ad id
that is not their last name, first name. Thanks Tag: VBScript Documentation Tag: 179329
regex problem
Hi,
as I couldn't find any newsgroup specialized on regex, I hope
somebody here can help me.
I have the following kind of strings:
file/start.asp#en:test>top
file/start.asp?load=http:/www.test.com>top
file/test.asp?load=http://www.test.com#en:test;de:test>top
With the following regex I can extract the things I need (everything
between 'en:'..and the last ; or 'top' or the uri's:
((.*)[(/|\\)])(.*\.asp)(\?load=(.*)#)?((.*;en:(.*));)?(>(.*)$)?
But additionally the whole thing can start with http:// or ftp://, e.g.
http://www.start.com?load=http:/www.test.com>top
http://www.start.com?load=http:/www.test.com#en:test;>top
...
But when I modify it like this:
(http://.*|ftp://.*)|((.*)[(/|\\)])(.*\.asp)(\?load=(.*)#)?((.*;en:(.*));)?(>(.*)$)?
it only matches the whole string and doesn't split it.
Maybe anybody has got a clue, I'm a bit stuck with that a the moment.
Best regards,
Andi Tag: VBScript Documentation Tag: 179320
Change the pwdLastSet value
I need to change the pwdLastSet attribute on accounts in Active
Directory. I found this script which will change the value to 0 which
means the user must change their password at next log on. But we are
implementing a new pwd policy to force users to change their pwd after
180 days. Most of our users pwd's are older than that and we don't want
them all expiring on that day. So, I need to be able to bulk set the
pwdLastSet value to %today's date%.
Here is my idea:
set oUser = GetObject("LDAP://cn=user,ou=test,dc=domain,dc=com")
oUser.Put "pwdLastSet", CLng(127703193192000000)
oUser.Setinfo
(We reverse engineered the Integer 8 number to be approx Sept 1, 2005,
hence the value 127703193192000000)
But when I run this I get an error Overflow: 'CLng'
Has anyone ever done this before? Setting the pwdLastSet value to
something other than 0? Tag: VBScript Documentation Tag: 179315
.net dll with asp
hi all,
i have created a dll with vb.net, so to use it from both asp.net that pure asp
i have tested it in pure asp pages with iis 5.0, and it works.
Now i have to move it on IIS 6.0, but when i launch the asp file i have the
following error:
File or assembly name testVB, or one of its dependencies, was not found.
i've done the same things both on the machine with iis5 that the one with
iis6...
can anyone help me? Tag: VBScript Documentation Tag: 179310
Export list of users to excel speadsheet
Hi,
I am a newbie to scripting so be gentle with me ;-)
I have been asked to export a list of all users from our domain into an
excel spreadsheet. Data must include the following: Logon name, Email
Address, Telephone Number. Our users are in multiple OUs depending on their
office location so the script must search the whole domain.
Can you help? Please highlight the parts which need to be modified...
Many thanks,
Don Pedro Tag: VBScript Documentation Tag: 179307
script to duplicate the content management system
Hello,
I want a script which duplicates the content management system with all the
files and the associated permissions. Can any one please help me with this.
Thanks
Arvind Tag: VBScript Documentation Tag: 179303
Modification of Inbox field formula in Outlook 2003
In Outlook 2003 I have an "email age" field with the following formula:
DateDiff("h",[Received],Now()) & " hours " & DateDiff("d",[Received],Now())
& " day(s) old"
How can I modify the formula such that it does what this pseudo-code
suggests?
If DateDiff("minutes",[Received],Now()) < "59 minutes" Then
DateDiff("minutes",[Received],Now()) & " minutes old"
ElseIf DateDiff("h",[Received],Now()) < "24 hours" Then
DateDiff("h",[Received],Now()) & "hours old"
Else
DateDiff("d",[Received],Now()) & & " days old"
End If
End If
Thanks!
J.S.
-- Tag: VBScript Documentation Tag: 179302
Check if registry registry key exists and then add values to runonce
Hi all,
I have done some scripting but I am no expert. I need to check if a registry
key (not a string value) exists on a client computer. If the key exists it
should add some value to the HKCU runonce hive. If the key does exists it
should do nothing and run the rest in the script.
How do I do that?
Bye
Mariette Knap
www.smallbizserver.net Tag: VBScript Documentation Tag: 179301
Moving the Windows Taskbar via script
Hi
I was just wondering if anyone has any idea of how to move the windows
taskbar through vbscript (or any other non-manual method for that
matter).
The reason for this is that I have a friend who logs on to a university
network. Every time he logs on, the display settings are defaulted to
have the taskbar docked on the bottom of the screen. He prefers to
have it docked on the top of the screen. No personal display
preferences are saved between sessions.
I have been scouring google for a few days now and I'm running out of
ideas.
Any help is appreciated,
Tim Tag: VBScript Documentation Tag: 179296
Make a html Drop Down list behave like a vb Combo Box
Hi,
I am currently working on an Intranet based payroll tool, which
interfaces with our Payroll system, I am currently working on an
expenses claim screen, based on ASP, HTML and vbscript (we have a
totally IE based client base) I have been asked to make some drop down
lists behave much the same as a Win32/vb type combo box, however I am
struggling with this. I want the drop down list to filter the contents
much the same as a combo box. for example if a user wants to find the
payroll number 001934, they would simply type it into the drop down
list and it moves its way to this value rather than the way drop down
lists work in a browser ie. the brower would move to the first number
starting with zero, then to the next number starting with zero, then
the first number starting with 1 etc.
Any help would be greatly appreciated with this. If a Javascript
solution is all you have then please let me have it, I am at the point
of desperation now.
Thanks to everyone in anticipation of your help
Simon Tag: VBScript Documentation Tag: 179295
Username, find the computer
Hi all,
having only the Username from a person, with which the person will login to
a domain. Is it possible to find the computer to which the person is
currently logged on, using LDAP or ADSI? Tag: VBScript Documentation Tag: 179292
CPU, Increase Percentage
Is there a way to dictate how much of the processor's time is given to a
script? My scripts normally do a lot of database accessing, so it's not
uncommon to pin the CPU. I have one scrpt that when run, stays down around 1
or 2% of the processor usage. At that rate it takes 20 minutes to run.
Any ideas on how to get it more of the CPU?
Note: During this time, the System Idle Process is runing above 90%.
Thanks,
Bernie Tag: VBScript Documentation Tag: 179291
http://username:password@domain
I have made the changes in my registry that are documented in many places,
and in Internet Explorer 6 the command http://username:password@domain now
works just fine.
However, I now want to open the same page with a script, going thru the
InternetExplorer object and Navigate (or whatever is appropriate). My
problem is that Navigate will not accept http://username:password@domain as a
url, which is I suppose not surprising. MY QUESTION, THEN, IS HOW DO I OPEN
THIS PAGE?
i suspect that I have to do something with ... As Variant, but I do not
understand the syntax or the semantics.
Thanks in advance for any help. Tag: VBScript Documentation Tag: 179288
Import NS bookmarks script
Is there any way by using some sort of script to import netscape bookmarks
into IE? We are moving away from Netscape in our organisation, it would be
save alot of time if we could automatically do the import say throuogh a
login script then to walk to every machine and run the IE import wizard.
thanks Tag: VBScript Documentation Tag: 179287
Converting an "xls" file to "pdf" file by using "FreePDF XP"
I have searched many sites but there is no such example for converting
an "xls" file to "pdf" file by using "FreePDF XP". So I re-write the
code from "FreePDF XP ResourceKit" and share it here for anyone needs.
Please install "FreePDF XP" before running this script. "FreePDF XP"
can be downloaded at
http://freepdfxp.de/fpxp.htm
----------------------------------8<---------------------------------
'**********************************************************************
'*
'* Author: Curtis Wong
'* File: xls2pdf.vbs
'* Created on: 15 August 2004
'*
'* Aim: To convert "xls" to "pdf" format by using FreePDF
'*
'**********************************************************************
Option Explicit
' Check if this script is run by "cscript.exe"
If Not IsHostCscript Then
Const kMessage1 = "Please run this script using CScript."
Const kMessage2 = "This can be achieved by changing the default"
Const kMessage3 = "Windows Scripting Host to CScript using:"
Const kMessage4 = """CScript //H:CScript //S""."
WScript.Echo kMessage1 & vbCRLF & vbCRLF & kMessage2 & vbCRLF & _
kMessage3 & vbCRLF & vbCRLF & kMessage4
WScript.Quit
End If
' To make this script can be run once at each time
Dim OneInstance, strWQL
strWQL = "SELECT name from win32_process where" & _
" name='wscript.exe' or name='cscript.exe'"
OneInstance = GetObject("winmgmts:").Execquery(strWQL).Count
If Trim(CStr(OneInstance)) <> "1" Then WScript.Quit
' Main part
Dim objFSO
Dim RptDir, CurDir, RptName, objRpt
' Define the Current Directory
Set objFSO = CreateObject("Scripting.FileSystemObject")
CurDir = objFSO.GetParentFolderName(Wscript.ScriptFullName)
If Right(CurDir, 1) = "\" Then _
CurDir = Left(CurDir, Len(CurDir) - 1)
' Define the variables for output reports
RptDir = CurDir
' Add into the following array for the reports needed to convert
' to "pdf" format. Note that filename only, ".xls" is NOT required
RptName = Array("book1")
For Each objRpt in RptName
XLS2PDF objRpt
Next
Msgbox "The conversions are finished.", vbOKOnly + vbInformation, _
"Congratulations"
Set objFSO = Nothing
'**********************************************************************
'*
'* Sub XLS2PDF(ByVal Workbookname)
'* Purpose: Convert Excel Worksheet to pdf
'* Input: Workbookname <Name of Excel Workbook>
'*
'**********************************************************************
Private Sub XLS2PDF(ByVal Workbookname)
Dim psFile, objExcel, OldPrinter
psFile = CurDir & "\" & Workbookname & ".ps"
Wscript.Echo "Converting """ & Workbookname & ".xls"" -> """ & _
Workbookname & ".pdf"""
' Create Excel Object
Set objExcel = CreateObject("Excel.Application")
With objExcel
' Open workbook
.Workbooks.Open RptDir & "\" & Workbookname & ".xls", 0, True
' Open the workbook implicitly
.Visible = False
' Check if it is a blank workbook
If .Worksheets(1).UsedRange.Address = "$A$1" And _
.Worksheets(1).Range("A1") = "" Then
.Workbooks(Workbookname & ".xls").Close False
.Quit
Set objExcel = Nothing
WScript.Echo Workbookname & ".xls is a blank workbook."
WScript.Quit
End If
' Print all worksheets in the opened workbook
' (Comment the following if you only want to print some
' worksheets)
.Workbooks(Workbookname & ".xls").PrintOut _
, , , , "FreePDF XP", True, , psFile
' Print the first worksheet counting from the left
' (Comment the following if you want to print all worksheets in
' the opened workbook)
'.Worksheets(1).PrintOut , , , , "FreePDF XP", True, , psFile
' Close the workbook
.Workbooks(Workbookname & ".xls").Close False
' Quit Excel
.Quit
End With
' Release Excel Object
Set objExcel = Nothing
Dim objFreePDF, FreePDF, objShell, PDFFile, Parameter
' Create Shell object
Set objShell = WScript.CreateObject("WScript.Shell")
PDFFile = RptDir & "\" & Workbookname & ".pdf"
' Define the "freepdf.exe" in Full Path format
FreePDF = objShell.ExpandEnvironmentStrings("%ProgramFiles%") & _
"\FreePDF_XP\freepdf.exe"
'Define the parameter needed for outputing "pdf" files
Parameter = " /3 delps,end ""High Quality"" " & """" & PDFFile & _
""" """ & psFile & """"
If objFSO.FileExists(FreePDF) Then
' Run "freepdf.exe" with parameter and get the WshScriptExec
' object
Set objFreePDF = objShell.Exec(FreePDF & Parameter)
Wscript.Stdout.Write "Please wait "
' Check whether "freepdf.exe" ends for every 0.5 second
Do While objFreePDF.Status = 0
WScript.Sleep 500
Wscript.Stdout.Write "."
Loop
WScript.Echo vbCrLf & "Convertion finished." & vbCrLf
Else
' Prompt to user to install "FreePDF XP" before running this
' script
MsgBox _
"Please install ""FreePDF XP"" before running this script.", _
vbExclamation, "Error"
End If
' Release objects
Set objShell = Nothing: Set objFreePDF = Nothing
End Sub
'**********************************************************************
'*
'* Function: IsHostCscript()
'* Purpose: Check if "cscript.exe" is to run this script
'* Output: Returns true if the script host is "cscript.exe"
'*
'**********************************************************************
Private Function IsHostCscript()
On Error Resume Next
Dim strFullName, strCommand, i, j
Dim bReturn: bReturn = False
strFullName = WScript.FullName
i = InStr(1, strFullName, ".exe", 1)
If i <> 0 Then
j = InStrRev(strFullName, "\", i, 1)
If j <> 0 Then
strCommand = Mid(strFullName, j + 1, i - j - 1)
If LCase(strCommand) = "cscript" Then bReturn = True
End If
End If
If Err <> 0 Then _
WScript.Echo "Error 0x" & Hex(Err.Number) & " occurred. " &
Err.Description _
& ". " & vbCrLf & "The scripting host could not be determined."
IsHostCscript = bReturn
End Function
----------------------------------8<--------------------------------- Tag: VBScript Documentation Tag: 179286
Authentication Scheme
Hi,
I'd like to know on the fly what the current authentication schema is. It
could be one of the followings: NTLM, BASIC, DIGEST, PASSPORT, NEGOTIATE.
Does anyone knows how do I retrieve the current authentication scheme in
vbscript?
Please advice, thanks!
-P Tag: VBScript Documentation Tag: 179281
truncate data from 1 million to 1 dollar using formatCurrency/CCur functions?
I want to ask what are the possiblities to truncate data
from 1 million dollars to 1 dollar by using formatCurrency and
CCur functions?
The ASP page has code <%= formatCurrency(rs(14)) %>, the database
rs(14) is 100000000. But when it displays it in the screen,
it shows $1.00 with code <%= formatCurrency(rs(14)) %>
There is another place with code using CCur and formatCurrency
together, i am not sure if this is ok.
<%
amt_of_deposits = amt_of_deposits + cCur(rRes("natl_trust_tran_amt"))
%>
<%=formatCurrency(amt_of_deposits)%>
This problem is so strange to me, I have no idea whats going on.
please advise. thanks!! Tag: VBScript Documentation Tag: 179280
Computer Power Scheme
Good afternoon,
Could someone please guide me as to how I can remotely using vbs change a
computer's power scheme?
Thank you,
Daniel Tag: VBScript Documentation Tag: 179278
Create XML File with VBSCRIPT
I am new to the XML world and wanted to see if anyone had a simple sample
vbscript that will create an XML file with data from parameters passed to a
function. Hope that makes sense. I need it to create the file, open the
file, writed the tags and close the file to a specific path. Any and all
help is greatly appreciated.
Thanks in advance for your help. Tag: VBScript Documentation Tag: 179276
registerring ocx and dll files
Hi guys,
I'm looking at writing a script that checks to see if a dll is registerred
and if not willl register it.... can anyone assist ?
Cheers, Tag: VBScript Documentation Tag: 179274
uninstalling software
Hi,
anybody has a script to uninstall an application such as winzip on 100
computers remotely from my computer?
thanks Tag: VBScript Documentation Tag: 179264
Has anyone played with this script? http://www.microsoft.com/technet/scriptcenter/resources/scriptshop/default.mspx#EKAA
Has anyone played with this script?
http://www.microsoft.com/technet/scriptcenter/resources/scriptshop/default.mspx#EKAA
It works really well but I don't like the approach. This approach
requires the administrator to maintain a list of exe's which are known
spyware. There are several problems with this approach.
For example (From Symantec.com)
When Spyware.Perfect installer is executed, it performs the following
actions:
1. Creates the following files:
" [FILE NAME].exe
" [FILE NAME]r.exe
" [FILE NAME]un.exe
" [FILE NAME]vw.exe
" [FILE NAME]hk.dll
" [FILE NAME]i.dll
" [FILE NAME]wb.dll
Since we don't know the value of [FILE NAME], we wouldn't be able to
add this to the list unless we could use the old DOS wildcards like
????????r.exe and such. We would still need to know how long "FILE
NAME" is to apply the appropriate number of ??????'s.
Also, new strains of spyware will slip through the cracks unless the
list is updated and there doesn't seem to be a good single source to
check.
So, why wouldn't it be possible to create a "white list" of known
services and processes which should be mostly static (only upgrades
and such would need to force a revision) and ONLY allow those
processes to run. For me to do it I would need a list of processes
from Microsoft or do the inventory myself, then add in the exe's of
the processes I know I will need from Symantec, Scansoft, Adobe, etc.
The white list could also be secured with Software restriction
policies in Windows which would prevent malicious code from taking on
the name of known Windows services which is another weak point of the
current script's approach.
I don't know too much about scripting (I barely know how to cut and
paste code to get it to work) but would the logic need to be changed a
lot to make this idea work? Is there a down-side I am not thinking
of?
I believe Windows can be secured to the point where you would never
need an anti-spyware product or even a script like this one. If I was
building a new network from the ground-up, I would set things up this
way. It would only take careful selection of software which does not
require admin rights on machines (something my current migration to a
secured environment is lacking until I flush out programs like Adobe
Capture and QuickBooks 2005). The recent flack over the status of
Claria and Microsoft really opened my eyes about this because I want
to maintain control over my stuff. Adding anti-spyware to the mix to
try and do my job for me isn't going to get the job done is we are
arguing over what is spyware and what is not. EULA or not, I don't
want certain programs running in my organization. This includes
freecell.exe and sol.exe and anything Claria/Gator related.
Mike Tag: VBScript Documentation Tag: 179261
How to create an array in ASP/VBScript in this specific case?
I want to replace Response.Write in the code below with a an array type
variable but I am not sure how:
for each element in request.form
response.write(element & ": " & request.form(element) &"<br>")
next
Obviously, this does not work as it only sets the last value to the
variable:
for each element in request.form
str_val = element & ": " & request.form(element) &"<br>"
next
Is there some way to set the whole array to the str_val variable?
Thanks,
J.S.
-- Tag: VBScript Documentation Tag: 179247
ASP/VBScript: How to suppress the submit button from the results of this code?
I use the following code to obtain the names and values of all the submitted
form elements in an ASP page:
for each element in Request.Form
Response.Write(element & ": " & Request.Form(element) &"<br>")
next
However, it also gives me the name and value of the Submit button. Is there
any way I can suppress that from my results?
Thanks,
J.S.
-- Tag: VBScript Documentation Tag: 179245
Need to exit loop early
Hopefully this is a straight forward question.
I have a script that reads a file one line at a time, and carries out
ceratin actions depending on what it reads on each line. The script uses a
Do Until....Loop, using
Do Until objTextFile.AtEndOfStream
Loop
I need to add error checking, so that if a set action to be carried out by
the script has an err.number <> 0, the loop will ignore the rest of the loop,
and continue to the next line of the text file that it is reading. So, what
I need to the command to end one "loop" early, but continue through remaining
loops. I'm sure it should be really simple, but I don't seem to be able to
get the syntax right. Tag: VBScript Documentation Tag: 179244
Credentials
When running 'mofcomp abc.mof',
.there is no problem if running by local administrator account.
.error '0x80041003' in %windir%\system32\wbemlogs\wbemess.log if running
by domain accounts (that are member of local administrators group).
Help me! Tag: VBScript Documentation Tag: 179234
Close HTA
I have created an HTA with VBS to perform various tasks.
What command will permit me to close the active HTA?
Thanks,
Danie Tag: VBScript Documentation Tag: 179232
updating registry
Hello,
How can I create a script to go through the registry and replace an entry
with another. Can this be done on remote computer or is it limited to local
computers only.
I would like to replace \\serve01\sw$ with \\serve03\sw$ and this would need
to include any entry with it subdirectories \\serve01\sw$\... with
\\serve03\sw$\...
Thanking you in advance for your assistance!
Daniel Tag: VBScript Documentation Tag: 179230
Insert image to Excel programmatically
Hi experts,
I wish to insert JPEG files into the Excel document through programming way.
Is VBScript able to help me achieve my objective? Please advice
Thanks a lot!!! Tag: VBScript Documentation Tag: 179228
Configure SNMP Settings
I've been looking all over. Can someone please email me a script to
configure all the community, traps destations ect for SNMP
Thanks
--
--
Ryan McKay
Calgary, Alberta, Canada
--
Email: avengerdx@hotmail.com
-- Tag: VBScript Documentation Tag: 179224
Reading screen width and height
I lifted this bit of code (modified) from the Scripting Center:
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_DesktopMonitor")
For Each objItem in colItems
ScreenHeight=objItem.ScreenHeight
ScreenWidth=objItem.ScreenWidth
Next
It works fine, but is there a simpler way to do it, without the loop and array?
I only have one monitor.
Dave Tag: VBScript Documentation Tag: 179223
HELP - Deleting and Access database Record
I have a page that list all records in an access table. I would like to add
a delete record function to the list to delete selected records. Here is my
current code:
*********************************************************
<%
Dim strDB, con
Dim rs
strDB = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" &
Server.MapPath("ques_comm.mdb") & ";"
Set con = CreateObject("ADODB.Connection")
con.Open strDB
Set rs = CreateObject("ADODB.Recordset")
rs.CursorLocation =3
rs.Open "select * from questions ORDER BY usernumber DESC", con
WHILE NOT rs.EOF %>
<TR>
<TD width=25 rowspan="3" align=left valign="middle"
bgColor=#000000><div align="center"><span
class="style1"><%=rs("usernumber")%> </span></div></td>
<TD align=left height=25 bgColor=#e7e7de width=103><strong><font
size="2">Name:</font></strong></td>
<td width="697" bgColor=#e7e7de><font
size="2"><%=rs("UserName")%> </font></td> <td width="3"></TD>
</TR>
<TR>
<TD align=left height=25 bgColor=#e7e7de width=103><strong><font
size="2">Time
Submitted:</font></strong></td>
<td bgColor=#e7e7de><font
size="2"><%=rs("SubmitDT")%> <%=rs("SubmitTF")%> </font></TD>
</TR>
<TR>
<TD align=left height=25 bgColor=#e7e7de width=103><strong><font
size="2">Question:</font></strong></td>
<td bgColor=#e7e7de><font size="2"><%=rs("Comments")%> </font></TD>
</TR>
<TR>
<TD align=left colspn=2> </TD>
<TD align=left height=25 colspn=2> </TD>
</TR>
<% rs.MoveNext
wend
con.Close
Set con = Nothing
Set rs = Nothing
%>
********************************************************
Thanks in advance.
Rich Tag: VBScript Documentation Tag: 179222
Change local password
I want to change a password of a specific user on my computer by using
VBScript.
I just start using this language and i need a little help. I found a
lot of script to change password but in a Ldap environnement. Tag: VBScript Documentation Tag: 179220
Regular expression help
Need to parse through our code files and find every instance of other
files referenced, looking for included files, images, etc. The
expression I'm using is
("|')(.*)(\.asp|\.htm(l)?|\.gif|\.jpg)("|')
Which works great.
Now what I need to do and can't figure out is how to exclude certain
matches, as in
<!--#include file="../../myincludefiles/sqlConnection.asp"-->
<a href="http://www.ourserver.com/somebranchfile.asp">
I don't want anything (for instance) that includes the strings
'myincludefiles' or 'http' inside the quotes.
I'd appreciate any help I can get on this.
- Wm Tag: VBScript Documentation Tag: 179219
Learning scripting vbs
Hi to everyone:
I'm a beginer in the scripting in vbs, and I want to learn it, as full as it
can be learned, but I don't know where i can begin.
which or what page can i visit to learn this script languaje?
Thank you....
Baruch Ortiz Tag: VBScript Documentation Tag: 179217
error: can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus
Hi,
I am getting the message below when i try to disable a select/list box
using vbscript, client side programming.
error: can't move focus to the control because it is invisible, not
enabled, or of a type that does not accept the focus
This is the code i am using below; I have tried various attempts to get
rid of the error message. The list box does become disabled however the
message strill occurs. Does anyone know how to get around this error
message? Any help much appreciated...
-- code below --
set tr = document.getElementById("table_body").lastchild.previouschild
tr.all.tags("select")("test_list_box").disabled = true Tag: VBScript Documentation Tag: 179216
This script shows the Hex dump of a file
Hello,
this script opens an IE windows and shows the hex dump of the file dropped on the icon.
If you do not use drag and drop, you can choose a file from the open dialog box (needs the
appropriate library registered).
Giovanni.
'<%
'************************************************
' File: HexDump2.vbs (VBScript)
' Author: Giovanni Cenati
' 16 june 2005
' Mostra in IE un file in esadecimale
' Shows a hex dump of a selected file
' http://digilander.libero.it
' Codice utilizzabile citando il sito.
' Based on a script post by spmlinton at sk sympatico ca
' in the newsgroup microsoft.public.scripting.vbscript
' on Thu, 27 Mar 2003
'************************************************
Set objArgs = WScript.Arguments 'Vedo se ci sono degli argomenti passati allo script
if objargs.count=0 then
Set comDlg=CreateObject("MSComDlg.CommonDialog.1")
const cdlOFNHideReadOnly = 4 'Nasconde la casella "sola lettura"
const cdlOFNFileMustExist = 4096 'Puoi scegliere solo files esistenti
Const cdlOFNExplorer = 524288 'Finestra in stile win95
comDlg.Flags = cdlOFNHideReadOnly + cdlOFNFileMustExist + cdlOFNExplorer
comDlg.Filter = "Tutti i files|*.*"
comDlg.DialogTitle="Visualizza un file in formato esadecimale"
'comDlg.InitDir="c:\"
comDlg.maxfilesize=500
'comDlg.FileName="c:\autoexec.bat"
comDlg.ShowOpen
if comDlg.FileName="" then wscript.quit
FName= comDlg.FileName
'Ricordo il filename scelto. Saves the filename in variable
set comDlg=nothing 'Scarica l'oggetto. Discards object
else
fName = objArgs(0)
end if
' Lancia Internet Explorer per mostrare i risultati.
Set oIE = WScript.CreateObject("InternetExplorer.Application")
oIE.navigate "about:blank" ' documento vuoto. Empty doc.
' Importante: aspetta che Internet Explorer sia pronto
Do While (oIE.Busy) ' Waits until IE is ready
WScript.Sleep 200 ' Sospende per 200 millisecondi.
Loop
oIE.Visible = 1 ' Internet Explorer è visibile.
oIE.ToolBar = 1 ' ed ha la toolbar così è presente il pulsante "stampa"
Set doc1 = oIE.Document ' Punta al documento...
doc1.open ' ...lo apre
' Scrive le intestazioni html. Writes html headers
doc1.writeln("<html><head><title>" & Title & "</title></head>")
doc1.writeln("<body bgcolor='#FAF0F0'><pre>")
Const ForReading = 1
set fso=createobject("scripting.filesystemobject")
set f=fso.getfile(FName) 'apro il file. Open file for reading
set ts=f.OpenAsTextStream(ForReading,0) 'in lettura
byteCtr=0
chCtr=0
doc1.writeln(Fname)
doc1.writeln(f.size & " bytes")
doc1.writeln()
do while not ts.atendofstream
ch=ts.read(1) 'Legge un carattere. Reads a char
chCtr=chCtr + 1 'E ne tiene nota nel conteggio. Counts it
hexch=hex(asc(ch)) 'Ne determina il codice ascii. Finds ascii code
if len(hexch)< 2 then hexch="0" & hexch
hexLine=hexLine & hexch & " " 'Adds it to the string
if asc(ch)> 31 and asc(ch)< 127 then 'Printable?
if ch=">" then ch=">" '(IE lo interpreterebbe come un tag)
if ch="<" then ch="<" '(IE would think it's a tag)
ascStr=ascStr & ch 'è stampabile. Yes
else
ascStr=ascStr & "." 'non è stampabile. No
end if
'Prepara la stampa di una riga:
'indirizzo - 16 esadecimali - 16 caratteri ascii
'Prepares a line to be displayed:
'Address, 16 hex characters, 16 ascii
if chCtr=16 or ts.atendofstream then
lineStr=byteCtr & vbtab & hexLine & vbtab & ascStr
'Now manages last line if it has less than 16 chars
if chCtr<16 then 'Se l'ultima riga ha meno di 16 cartteri...
lineStr=byteCtr & vbtab & hexLine 'inizio normalmente
for r= (chCtr+1) to 16 'poi riempio la parte restante della riga
lineStr= lineStr & "-- " 'con dei caratteri
next
lineStr = lineStr & vbtab & ascStr 'e finisco normalmente
end if
'Writes output to Internet Explorer
doc1.writeln(lineStr) 'Scrive in IE la riga creata
byteCtr=byteCtr + chCtr 'incrementa l'indirizzo
chCtr=0 'e azzera il parziale
ascStr=""
hexLine=""
end if
loop
'Chiude le intestazioni html
'Closes html headers
doc1.writeln("</pre></body></html>")
doc1.close
set fso=nothing
set f=nothing
set ts=nothing
--
Giovanni Cenati (Aosta, Italy)
Write to user "Reventlov" and domain at katamail com
http://digilander.libero.it/Cenati (VbScript) Tag: VBScript Documentation Tag: 179210
make a program start
I want to create a script which start a program and when someone close it it
will come up again. I want also this program to be maximized.
Someone who can help me with this script? Tag: VBScript Documentation Tag: 179205
VBS to set folder permissions
Hunter1,
Please contact me at
brooks.vanhorn@verizon.net,
Thanks,
Brooks
Hunter1 wrote:
> *I do that with VB without any dramas. Initially when we set up an
> automatic account generation system I was familiar with VB bu
> hadn't
> really played around a great deal with VBScript, since then I d
> nearly
> everything in VBScript, but since the VB proggy which creates an
> sets
> the permissions on their personal directories works I've had no nee
> to
> rewrite it. I can wack up the code to do this in VB if you want,
> shouldn't be too hard to port to VBScript.
>
>
> Brooks wrote:
> > Using VBS I need to search the AD on a Win2K server and for eac
> name in
> > an OU, check to see that a personal folder has been setup. If no
> then
> > I need to create the folder on the server and set the permissions
> > correctly. [Note that the VB script will be run on the server.]
> OK,
> > but here is the problem: I need to set the folder permissions s
> that
> > only the administrators group and that person in the AD have full
> > access permissions and nobody else has no access to it. How do
> do it
> > in vbs?
> >
> > Thanks very much for your reply,
> >
> > Brooks
> >
> > Brooks.VanHorn@Verizon.Net
> >
> >
> >
> > --
> > Brooks
>
> ------------------------------------------------------------------------
> > Posted via [url]http://www.codecomments.com[/url]
>
> ------------------------------------------------------------------------
> > * 'Brooks Van Horn' (brooks.vanhorn@verizon.net) 'Brooks
(brooks.vanhorn@verizon.net
-
Brook
-----------------------------------------------------------------------
Posted via http://www.codecomments.co
----------------------------------------------------------------------- Tag: VBScript Documentation Tag: 179193
copy and Past in Tool Bar Addrs IE
Hi
How can I to Build a script in Address tool Bar of the Internet Explorer
?
thank you in advance Tag: VBScript Documentation Tag: 179186
Processing paragraphs in a Word document
I've written a lot of VBSCRIPT code but very little of it involves
Microsoft Office documents.
I'm working on a program that will read a bunch of Word documents. I
want to loop through all the paragraphs in a document and search for
various strings and then summarize them in a spreadsheet.
I think I know how to do the spreadsheet part, but I'm at a loss at
how to capture the paragraphs of text. I think I need to create a
collection of paragraphs and then loop through them.
I've spent several days searching through various web sites and all
the examples I've found are quite trivial and don't help. I watched
some Microsoft webcasts but they also didn't go into much detail. All
they seemed to cover was how to put a few lines of text into a new
document.
What I want to do seems quite basic, but I can't find much
documentation on how to get started.
Any examples of code that will create this collection and loop through
it would be appreciated.
Barry Tag: VBScript Documentation Tag: 179179
GOTO statement in VBScript
Hello,
Does VBScript supports GOTO statement?
Thanks!
Oren Tag: VBScript Documentation Tag: 179176
I search on the web for good example of VBScript and also for
explication on the Scripting.FileSystemObject. If any body had i good
site to visit for good example .
> I search on the web for good example of VBScript and also for
> explication on the Scripting.FileSystemObject. If any body had i good
> site to visit for good example .
>
rt
"Mats" <mathieu.chagnon@cima.ca> wrote in message
news:1124307925.151916.278270@g47g2000cwa.googlegroups.com...
>I search on the web for good example of VBScript and also for
> explication on the Scripting.FileSystemObject. If any body had i good
> site to visit for good example .
>