Display Image of a Test Question
I have 1,803 Test questions in the form of images in a directory. The question to be given to the student is random within ranges. I have tried for days to get the images to display. The examples from the books have not worked. This is what I have last
GifJpg = "Tst" & TXHQstnNo(346) & "R.gif
Response.Write GifJpg%><!-- Line 0120 --><%rsTests.Open "SELECT * FROM TXHQsnts WHERE TXHNo = 657", cnnct, 3,
If rsTests("Wrong") = "Y" then%><TD Width="43%"><Img Src="<%=" & GifJpg & "%>" Width="937" Height="137"
All the Images are labeled Tst a Number than one letter at the end. The number part is what is random.
The example above is Test Question # 657. The Question is # 346. The lettter R means the question was answered in-correctly the first time the question was asked.
Does anyone know why I am having trouble to display the Image
Thank You in Advanc
Bill Barber Tag: ASP Help... Tag: 152667
indexing service
hi everybody,
i have a problem with the indexing service when i have to do a second search in my internal portal, the first search is always good but if i want to searh another word the following message appears:
CreateRecordset error '8001010e'
The application called an interface that was marshalled for a different thread.
My code:
<%
dim numerr, abouterr
dim str_search
dim Q
Dim Rs
dim strQuery
str_search = Request.Form("CompSearch")
Response.Write "Stringa " & str_search
'On Error Resume Next
If str_search <>"" then
Set Q=Server.CreateObject("ixsso.Query")
Q.Query = str_search
Q.Catalog="Catalogo_Portale"
Q.SortBy="rank[d]"
Q.Columns="doctitle, filename, create, size, characterization, vpath"
Q.MaxRecords=5
Response.write "ciao1"
'On Error Resume Next
Set Rs = Q.CreateRecordset("nonsequential")
Q.Reset
set Q = Nothing
if Rs.EOF then
Response.Write "Mi dispiace. Nessun risultato trovato."
Response.Write " FILENAME " & Rs.Fields("filename")
else
Response.Write "<p><strong>"
Response.Write Rs.RecordCount
Response.Write "</strong> risultati trovati:</p>"
Do While Not Rs.EOF
Response.Write "<strong>"
Response.Write ("<a target=_blank href="& Rs.Fields("vpath")& ">" & Rs.Fields("doctitle")& ": " & Rs.Fields("filename")& "</a>")
response.Write "</strong> "
Response.Write "<br>"
Response.Write "Create:"
Response.Write Rs.Fields("create")
Response.Write "<br>"
Response.Write "Size:"
Response.Write Rs.Fields("size")
Response.Write "<br>"
Response.Write "<I>"
Response.Write Rs.Fields("vpath")
response.Write "</I> "
Response.Write "<br><br>"
' Spacing between results
Rs.MoveNext
Loop
Rs.close
set Rs = Nothing
end if
end if
if Err.number <> 0 Then
Response.Write "An Error has occured! Error number " & Err.number & " of_ the type: " & Err.description & Err.Column & Err.Line & Err.Source
End If
'Response.Write "Your Session ID is " & Session.SessionID
%>
can you help me?
thanks Tag: ASP Help... Tag: 152661
how can i calculate with currencies/money values?
As a VBS newbe I am trying to create a calculation witch needs to result in
a two digit decimal notation like: 11.90
I keep getting results like: 11.90423 or 11.9
Can anyone please help me solve this problem?
Thanks a lot!
Casper Tag: ASP Help... Tag: 152660
How can I calculate with currencies/money values?
As a VBS newbe I am trying to create a calculation witch needs to result in
a two digit decimal notation like: 11.90
I keep getting results like: 11.90423 or 11.9
Can anyone please help me solve this problem?
Thanks a lot!
Casper Tag: ASP Help... Tag: 152659
Word.Application
Hi
On our intranet, in IE on a client with WinXP Pro sp1, IE6 sp1, Office XP Pro and Office 2k Pro:
set oWrd = createobject("Word.Application") is erroring with "...(DLL) initialization routine failed"
The site is in the Trusted zone and ALL security options are set to enabled
However, on a client with Win2k Pro sp3, IE5.5, Office 2k Pro the page works OK
I have examined the registry and all Word.Application entries have the same clsid (if that is relevant...
Can anyone tell me why?? eg should I try uninstalling one of the Office versions or is it more likely a security issue with WinXP or what..
Thanks for any thought
Arth Tag: ASP Help... Tag: 152657
Controling MS-Agent events from a standalone vb script
Hello,
I'm trying to control ms-agent from vbs. That works fine when the
script is embedded in a web page but, when I try to do that in a
stnadalone script nothing happens !
Nom = "peedy"
Set Agent = CreateObject("Agent.Control.2")
Agent.Connected = true
Agent.Characters.Load Nom, Nom+".acs"
Set Merlin = Agent.Characters(Nom)
Merlin.Show
Merlin.Play "DoMagic2"
Do While Merlin.Visible:wscript.sleep 10:loop
Agent.connected = false
Set Merlin = Nothing
Set Agent = Nothing
sub Agent_Click(ByVal CharacterID, ByVal Button, ByVal Shift, ByVal X,
ByVal Y)
Merlin.Hide
end sub
The click event is never triggered, I tried with _Command, _DblClick
ans so on.
Does anyone have an idea ?
Thanks in advance.
--
Gilles COSTA, Géomètre-expert
Selarl Gross-Allain
17, grande rue, BP 23 91311 Montlhéry cedex, France Tag: ASP Help... Tag: 152652
Runtime Error
Hello all
I have a problem with a small VB script, which I want to use as login
script.
--------------------
Set oNet = CreateObject("Wscript.Network")
Set oFSO = CreateObject("Scripting.FileSystemObject")
oDrive = "O:"
If oFSO.DriveExists(oDrive) Then
oNet.RemoveNetworkDrive oDrive
End If
oNet.MapNetworkDrive oDrive, "\\server\share"
Set oNet = Nothing
Set oFSO = Nothing
Set oDrive = Nothing
--------------------
When I start the vbs I receive this error:
Line: 2
Char: 1
Error: ActiveX component can't create object: 'Scripting.FileSystemObject'
Code: 800A01AD
Source: Microsoft VBScript runtime error
Any ideas?
Thanks in advance
GoTTi Tag: ASP Help... Tag: 152648
Is there an equivalent to continue in vbscript
Hi :
Sometimes, i want to use the "continue" comman ,
but ,i can't find an equivalent in VbScript .Can any one
tell me how to do it ? Tag: ASP Help... Tag: 152644
Problem with UTF-8 and Server.URLEncode
Hi
I'm usin
Windows 2000 Advanced Serve
Service Pack
IIS 5.
Charset UTF-
Codepage= 6500
I have a problem when using the method Server.URLEncode. It converts for instance the character "Ã?" to D6(hexadecimal), but according to the ASCII-table(Extended ASCII codes) the value should be 99(hexadecimal). When I then use the method Request.QueryString the value is corrupt. I am aware of the Knowledge Base article 294831, but the service pack seems to make no difference in this case. Does anyone have any ideas how I can fix this problem?? Please help..
Thanks
Christopher Tag: ASP Help... Tag: 152643
Join Nt4 Domain using VBS
Hi All,
Does anyone have a script to join a PC to a NT4 domain, just using the script and no external apps?
I found a script last week that worked however overwrote it and cant find the site again.
Any help would be great.
Thanks
Brett
**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources... Tag: ASP Help... Tag: 152642
WMI unable to read HKEY_USERS
Hi All
I've been trying to run a simple WMI script to read a value from registry path on HKEY_USERS (See below), . but haven't been able to get it to work on Windows 2000 SP4 machines for some reason (works OK on NT4 SP6a machines)...returnvalue/err.number I get is 2. Even trying to enumerate subkeys under HKEY_USERS I'm unable to do it (HKLM is fine), wondering if anyone else has seen this problem, if this is a bug or a functionality that has been taken away recently by Service Packs, hotfixes... or if there is anything wrong you can see with the script below.... any help is much appreciated. Thanks in Advance...
------------------------------------------------------------
Const HKEY_LOCAL_MACHINE = &H8000000
Const HKEY_USERS = &H80000003
CONST HKEY_CURRENT_USER = &H8000000
Set objreg = Getobject("winmgmts:{impersonationLevel=impersonate}!\\TESTPC\root\default:StdRegProv"
regpath = "S-1-5-21-1606980848-1965331169-1417001333-233556\Software\DFS\IRESS\File
retval = objreg.getstringvalue (HKEY_USERS,Regpath,"userdir", regvalue
wscript.echo "Retval is: " & retva
wscript.echo "regvalue: " & regvalu Tag: ASP Help... Tag: 152641
Computer Name
I would like to read the Computer Name from the registry other than the SET
command to show %COMPUTERNAME%. Is there anyway to do it ? Which one is it
?
Thanks.
JW Tag: ASP Help... Tag: 152638
Saving an MSWord Page
Hi
I have an MSWord document displayed in an iframe on a web page
I want to allow a user to click a "save" button
A dialog box would then be displayed allowing the user to save th
MSWord iframe\document to disk.
Is there a way to do this
(I can't find a "save" dialog box or anything similar)
If so - how Tag: ASP Help... Tag: 152632
Updating Proxy in IE
I would like to script the IE proxy
settings, (Connections, Lan settings,
and advanced "Exceptions" )
Would anyone have a sample script
I could test.
Thanks in advance-
Bill Tag: ASP Help... Tag: 152631
Starting Internet Explorer
How would I start Internet explorer from a script and
open a specific web page?
Thanks for your help - Mike Tag: ASP Help... Tag: 152628
Current Process
Hello,
I need to know the current ID process of a running script.
In other words, while a script is being executed, I need to get the ID
process of the script itself.
Thx in advance for any help.
Alfredo Tag: ASP Help... Tag: 152625
How To read the COM port
This is a multi-part message in MIME format.
------=_NextPart_000_0062_01C3EE3B.4AECCD20
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi friends:
Somebody knows how to read the COM port from VBScript or =
Jscript. I need read it for the output of a scale of trucks.
=
Oscar Onorato
------=_NextPart_000_0062_01C3EE3B.4AECCD20
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1276" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DVerdana size=3D2>
<DIV><FONT face=3DVerdana size=3D2>Hi friends:</FONT></DIV>
<DIV><FONT face=3DVerdana=20
size=3D2> &nbs=
p; Somebody=20
knows how to read the COM port from VBScript or Jscript. I need read it =
for the=20
output of a scale of trucks.</FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2></FONT> </DIV>
<DIV><FONT face=3DVerdana size=3D2></FONT> </DIV>
<DIV><FONT face=3DVerdana size=3D2> =
=
=20
=
=20
=
=20
=
=20
=
=20
=
=20
=
=20
Oscar=20
Onorato</FONT></DIV></FONT></DIV></BODY></HTML>
------=_NextPart_000_0062_01C3EE3B.4AECCD20-- Tag: ASP Help... Tag: 152623
Adding computer name to wallpaper
Hi,
I'm asking a lot of stupid questions today, but please bear with me, it
won't get worse than this!
We use unattended or RIS installation, and today, whenever a server is an
administrator logs on and performs a few tasks that we haven't been able to
automate yet.
When deploying servers we include a branded desktop wallpaper, and one of
the manual tasks is to edit the wallpaper (using Paint) to include the
server name etc..
Questions:
* Is there any way to script the editing of the wallpaper file?
* Or are there any utilities out there which can perform this task?
* Or alternatively, is there another (smarter) way to have the server name
and other info displayed in a similar fashion as when using a wallpaper?
Any input highly appreciated!
Thanks,
Jørn Tag: ASP Help... Tag: 152607
Time to display Startup and Recovery Options
Hi,
Does anyone know how activate the 'Time to display recovery options when
needed' setting and change the default time using scripting? (My Computer ->
Properties -> Advanced -> Startup and Recovery).
Alternatively, are these settings stored in a file somewhere, like the list
of operating system are stored in Boot.ini?
Regards,
Jørn Tag: ASP Help... Tag: 152606
Minidump directory
Hi,
I'm having problems getting Windows to 'accept' a change I make to the
'Small dump directory'.
I've included below a copy of the script (which is largely copied from the
Windows 2000 Scripting Guide):
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer &
"\root\cimv2")
Set colRecoveryOptions = objWMIService.ExecQuery _
("SELECT * FROM Win32_OSREcoveryConfiguration")
For Each objOption in colRecoveryOptions
objOption.DebugFilePath = "C:\Dir\memory.dmp"
objOption.KernelDumpOnly = True
objOption.DebugInfoType = 3
objOption.OverWriteExistingDebugFile = False
objOption.MiniDumpDirectory = "%systemroot%\Dir"
objOption.Put_
Next
When I run the script it's completes OK without any errors, but when I check
the properties of the 'Small dump directory' in the 'Startup and Recovery'
options, it still says the default '%SystemRoot%\Minidump'.
By the way, it makes no difference whether I change the script to read:
objOption.MiniDumpDirectory = "C:\Dir".
Any input appreciated!
Regards
Jørn Tag: ASP Help... Tag: 152605
Managing local user objects
Hi,
I need to create, copy, rename and reset passwords for user obejcts that are
local to a computer (both Windows XP and Windows Server 2003).
I've browsed through the Windows 200 Scripting Guide, which I must say seems
rather comprehensive, but I can only find information on Active Directory
users.
If anyone could point me to where I can find information on local user
objects, I'd be much obliged!
Regards,
Jørn Tag: ASP Help... Tag: 152604
WMI, services and WinXP
Hello Everyone,
I wrote from Italy so please be patient with my english, thanks.
I am a programmer and I would like to use WMI (great!) with Visual Basic 6.0
(or VBSCRIPT) to obtain services enumeration on a remote computer, just for
see what services are running and so on.
The code below works well with Win2K O.S., but there are no chances to use
it with WinXP; every time the error description is "Authorization denied".
I think this is a problem with WinXp access security, because the API
EnumServicesStatus (and related) like the WMI code dont' works with WinXp,
but works well with Win2K.
Same consideration with the SC.exe utility from Microsoft : impossible to
query the remote service dtabase on a WinXp O.S.
IMPORTANT
I am convinced that this is a problem related to the security and permission
because, as I say, I can't execute the code remotely
(i.e. enumerating services on a WinXp PC over the network from an another
Win2K PC...) but the code works well If I use VB directly on a WinXp PC.
Consider that the computers with WinXp O.S. are correctly registered on the
network (LAN), beacuse I can browse they shared folders with Explorer.
Can someone help me, please?
Thank You in advance for Your very very precious support.
VB 6.0 CODE [START]
'this line gets an error on a WinXP computer (remotely), but the code
works well with Win2K or WinXP (locally)
Set WMI = GetObject("WinMgmts:\\MyRemoteComputerName")
Set objs = WMI.InstancesOf("Win32_Service") 'Win32_BaseService
For Each obj In objs
Debug.Print obj.Description
Next obj
VB 6.0 CODE [END]
GianPiero Tag: ASP Help... Tag: 152601
Logon script
Hi all,
Looking for a programmer to help me with following:
I am not familiar with vbscripting, but we are in desperate need for a logon
script for our W3K domain clients.
Clients are a mixture of NT4 SP5 and W2K Sp3 & 4
Up until now we used winbatch to perform certain tasks, but since this is an
'old' licence, we need to upgrade our scripts (and our licence). I want to
switch to windows scripting to avoid to have to buy new licences for over
200 clients..
Current situation:
Clients are members of one or more groups.
In our netlogon share, we may have a CMD file with the same name of the
group.
When logging on, a login.cmd file is run. This cmd verifies if the user is
member of a given group (GG-All). If not, it sends a net send to a given
system, indicating the user is not a member of that group, and exits.
If user is member of GG-All, the the winbatch script runs.
The current winbatch script puts a full-screen window on the clients
machine, used to indicate the progress in the logon. It then makes a list of
all global groups the user belongs to. If there is a matching cmd file, then
that cmd file is executed. (so if a user is memeber of 'GG-Testgroup' then
'GG-Testgroup.cmd' gets executed)
Problems we have now:
Most of the CMD files that are executed are doing four things:
- Check if certain directories exist on the client machine. If not
create them.
- Creating network shares
- Setting registry entries
- Synchronising files between the fileserver and the client. We use
robocopy to synchronise files (works perfectly).
A lot of these CMD files have some sync-commands in common, so there is a
possibility that these commands get executed more than once (resulting in
lenghty logons....). These CMD files/groups are all named in the same format
e.g. GG-SoftwareA, GG-SoftwareB, GG-SoftwareC, ...
So what I need:
Basically : same as above, but in vbs ;-)
- Less code in login.cmd (I think the only line should be 'wscript
login.vbs' , to please the NT4 machines...)
- If user not memeber of 'GG-All' : message to user and \\console PC
- Full screen window, listing user's display name, and a list of all the
login 'jobs' that have to run (= all the groups a user is member of AND have
a CMD file associated with it) (would be nice if an indication of already
executed jobs could be made, or progress bar)
- If user is memeber of at least 1 'GG-Software." group : execute common
code in GG-Software.cmd
- For all groups user is member of: execute group.CMD (minimized, or at
least 'behind' logon screen)
Someone can help me with this?
If you are willing to help me, you can send a mail to t d e m e y e r [at]
m u l t i n e t g r o u p [dot] c o m.
Tim Tag: ASP Help... Tag: 152600
DnsDomainSuffixSearchOrder.
Does anyone have any suggestions to make this more elegant? It pulls the
Dns Suffix Search Order from the registry and compares it to 'DnsSuffixes'
which should be there by default. If the user already has additional
suffixes, it adds them to the back-end of the string and then puts it back
into the registry.
Thanks,
Rob Boger
'> DNS Suffix Search Order.
Function SetDnsSuffixes(Computer)
Dim RegistryObject, CurrentDnsSuffixes, DnsSuffixes, NewDnsSuffixes,
WshShell
Set RegistryObject =
GetObject("WinMgmts:{impersonationLevel=impersonate}!\\" & Computer &
"\root\default:StdRegProv")
'> Define Dns Suffix Search Order.
DnsSuffixes = Array("my.domain.com", _
"domain.com", _
"sbc.com")
'> Get Current Dns Suffix Search Order.
RegistryObject.GetStringValue &H80000002, _
"System\CurrentControlSet\Services\TCPIP\Parameters",
"SearchList", CurrentDnsSuffixes
CurrentDnsSuffixes = Split(CurrentDnsSuffixes,",")
'> Compare Dns Suffixes.
For J = 0 To Ubound(DnsSuffixes)
For I = 0 To Ubound(CurrentDnsSuffixes)
If Ucase(CurrentDnsSuffixes(I)) = Ucase(DnsSuffixes(J))
Then
CurrentDnsSuffixes(I) = ""
End If
Next
NewDnsSuffixes = NewDnsSuffixes & DnsSuffixes(J)
If J <> Ubound(DnsSuffixes) Then
NewDnsSuffixes = NewDnsSuffixes & ","
End If
Next
'> Add Existing Dns Suffixes.
For I = 0 To Ubound(CurrentDnsSuffixes)
If CurrentDnsSuffixes(I) <> "" Then
NewDnsSuffixes = NewDnsSuffixes & "," &
CurrentDnsSuffixes(I)
End If
Next
'> Update Dns Suffixes.
Set WshShell = CreateObject("WScript.Shell")
WshShell.RegWrite
"HKLM\System\CurrentControlSet\Services\TCPIP\Parameters\SearchList", _
NewDnsSuffixes, "REG_SZ"
End Function Tag: ASP Help... Tag: 152598
Querying archived Security Logs
I archive my NT Security Logs on a nightly basis
(\\server\dir\tuesdaySecurityLog.evt) but would like to query these logs
without manually having to open them in the event viewer first.
Any thoughts how I could do this?
TIA Tag: ASP Help... Tag: 152591
work with a word doc file
with my vbs ,
i want to open a word file and search different
string in this file when i find this string
i must create a new word file and put string in this file.
an idea ??
thanks Tag: ASP Help... Tag: 152588
setting windows wallpaper with a VBS script
Hi guys,
Iam not an expert in VBscripting, and I am trying to set a wallpaper
and refresh it (without the user logoff) on winXP, win200 pro, and
win98 using the following script (coz of company marketing strategy).
Iam pushing this script via installshield to more than 1000 computers
with any of above os'.
The script seems to work fine on XP but doesnt work on win2k and
win98. The registries seem to be changing fine but the background
doesnot refresh with the rundll32 userdll call on the last line. Am I
missing anything ??
Please help!! Thanks,
NK
----------------------
----------------------
Dim WshShell, wpFile, wpStyle
set WshShell = CreateObject("Wscript.Shell")
'change this parameter for the destination wallpaper
wpFile = "%windir%\web\wallpaper\dt1.bmp"
'wallpaper style 2-stretch, 1-center;
wpStyle = 2
WshShell.RegWrite "HKCU\Control Panel\Desktop\Wallpaper",wpFile
WshShell.RegWrite "HKCU\Control Panel\Desktop\WallpaperStyle",wpStyle
WshShell.RegWrite "HKEY_USERS\.DEFAULT\Control
Panel\Desktop\Wallpaper",wpFile
WshShell.RegWrite "HKEY_USERS\.DEFAULT\Control
Panel\Desktop\WallpaperStyle",wpStyle
'WScript.Echo WshShell.RegRead("HKCU\Control Panel\Desktop\Wallpaper")
'msgbox (WshShell.RegRead("HKCU\Control
Panel\Desktop\WallpaperStyle"))
WshShell.Run _
"%windir%\System32\RUNDLL32.EXE
user32.dll,UpdatePerUserSystemParameters", _
1, False
----------------------
---------------------- Tag: ASP Help... Tag: 152585
How to list Computer Description using winNT:// provider..
Hi
I'm trying to list all the computers accounts in a NT4.0 Domain with their corresponding descriptions; I can list correctly the computer name but I get no description, even though the description does exist
This is the code I'm using
-----------------------------------------------------------------------------------------------
set DomainName = GetObject ("WinNT://MyDomain"
DomainName.Filter = Array ("computer"
For Each Computer In DomainNam
Wscript.Echo Computer.Nam
set Machine = GetObject ("WinNT://MyDomain/Computer.Name,computer"
WScript.Echo Machine.Descriptio
Next Tag: ASP Help... Tag: 152581
guaranteed file copy
I'm looking to write a script that will:
1.) Loop through a directory on a computer
A.) Copy each file to another directory
B.) Verify that is was copied
C.) Delete the original file
2.) Log all actions to a text file
Can anyone point me in the right direction to start? I'm pretty new
to scripting, but if there was some existing code somewhere I'm sure I
can piece it together and modify it to suite my needs. Tag: ASP Help... Tag: 152576
Accessing Multiple Files w/ vbscript
I'm having great difficulty figuring out a way to access multiple
files using GetFolder, Subfolders, and Files to set a variable for the
file to be accessed. The code below is a bit junky because I want you
to see all the things I've tried. Even if I leave Subfolders out, and
put all the log files in the same folder, I'm returned the same error,
"File not found." I've even tried running the script in the same
folder as the log files. However, if I add "wscript.echo
objFile.name" in a line before
"objOutputFile.Writeline(objfile.name)", I receive a message box
indicating the correct filename.
The bottom line is that I want to be able to parse multiple log files
in a directory structure without having to specify the filenames
manually. Does anyone know if this is a limitation of vbscript? Does
anyone know how to access multiple files in vbscript?
Any help would be greatly appreciated.
-------------------------------
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objParentFolder = objFSO.GetFolder("C:\Test\Logs")
Set objOutputFile = objFSO.OpenTextFile("C:\Test\Reports\ListFiles.txt",
ForWriting, True)
Set objSubFolder = objParentFolder.SubFolders
For Each objFolder in objSubFolder
strBuildPath = objParentFolder & "\" & objFolder.name
Set objFileFolder = objFolder.Files
For Each objFile in objFileFolder
' response.write(objFile.name)
' wscript.echo objFile.name
' objOutputFile.WriteLine(objFile.name)
Next
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objParentFolder = objFSO.GetFolder("C:\Test\Logs\2003\")
' Set objOutputFile = objFSO.OpenTextFile("ListFiles.txt", ForWriting,
True)
For Each objFiles in objParentFolder.Files
' response.write(objFiles.name)
' objOutputFile.WriteLine(objFiles.name)
Next
Set objFileFolder = objFolder.Files
For Each objFile in objFileFolder
' response.write(objFile.name)
' objOutputFile.WriteLine(objFile.name)
Next
For Each objFiles in objParentFolder.Files
' response.write(objFiles.name)
objOutputFile.WriteLine(objFiles.name)
Next
For Each objFiles in objParentFolder.Files
Set objTextFile1 = objFSO.OpenTextFile(objFiles.name , ForReading)
Next
Next
objOutputFile.close
--------------------------------
TIA,
Script Novice Tag: ASP Help... Tag: 152572
Getting SQL Script to run in VBS
Hi Everyone,
I am very new to VB Scripting and would like to find out how might I go
about running an SQL (2000) statement through VBScript and then assign the
result into an environment variable. My application can read the environment
variables. Essentially here is the SQL command I have been trying to use
with VB Script:
isql -U sa -P password -Q "select
cast(substring(@@version,0,charindex('(',@@version,0)) as varchar(40)),
cast(substring(@@version,charindex('Build',@@version,0)-1, Len(@@version))
as varchar(35))" -o c:\result\SQLVersion.txt
The SQL statement gives me the SQL Server version and its service pack info.
Right now it writes to a file but I rather keep it in the memory if
possible, and then simply manipulate the text so that it shows only a single
line of text instead of three.
Thank you for any pointers. Tag: ASP Help... Tag: 152571
Using CSVDE output data in VBS, problem with "\\"
I use csvde to extract data that looks like:
101000081,"CN=Czuchry\\, Michael L.,OU=psy,OU=Depts,DC=company,DC=com"
101000164,"CN=Loud\\, John,OU=lan,OU=Depts,DC=company,DC=com"
etc.
I read that into a VBscript and then based on other criteria, I want to
disable and then move the appropriate user accounts. That section of my
code looks like this:
************************
1 If status = "notactive" Then
2 strADsPath = "LDAP://" & objRecordset.Fields.Item("DN")
3 wscript.echo strADsPath
4 Set objUser = GetObject(strADsPath)
5 wscript.echo objUser
6
7 UAC = objUser.Get("userAccountControl")
8
9 objUser.Put "userAccountControl", UAC OR ADS_UF_ACCOUNTDISABLE
10 objUser.SetInfo
11
12 Set objOU =
GetObject("LDAP://ou=Mail1Disables,ou=ToBeDeleted,dc=company,dc=com")
13 objOU.MoveHere strADsPath, vbNullString
14 End if
The problem is when line 2 tries to build the correct AD path, it sticks the
two \\ characters which is invalid:
LDAP://CN=Loud\\, John,OU=lan,OU=Depts,DC=tcu,DC=edu
C:\scripts\smooth.vbs(63, 5) (null): An invalid dn syntax has been
specified.
How can I convert the \\ to just \ which is the true DN?
I suppose csvde is esc'ing the single DN during its output, but that's such
a huge pain to deal with.
I also realize I shouldn't have to do the csvde export at all, I should be
able to query all the users in AD directly and set variables for them, but I
haven't learned how to do that yet. Tag: ASP Help... Tag: 152570
Script to run when screen saver is on (w2kpro)
How do you get a VB script to work when the screen saver (with password
protect) is on? I have a script that will work (to do a disk defrag) when
run from the desktop, but when I put it in the scheduler and it runs with
the screen saver on, it runs it to the point when it should choose some Send
Keys command. At that point it appears that the window that is supposed to
be chosen is not selected and the script hangs. Anyone with any ideas?
Brian Tag: ASP Help... Tag: 152568
Help VBS and ASP
I could use someones help if possible. I am a new person to the whole
scripting thing, and know very basic information about HTML/ASP. What
I am trying to do is query a SQL Database and send the results to a
webpage in a table format. Below is a sample of my code, and any help
will be greatfully appreciated. If you could recommend a book, or
provide sample code, that would be wonderful
Thanks,
Robnson
<%@ Language = VBScript %>
<%Option Explicit%>
<HTML>
<HEAD>
<h1>
Eventlogs For January 29, 2004
</h1>
<META NAME="Eventlogs" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
<%
dim Conn, objRS, objConn
Set Conn = CreateObject("ADODB.Connection")
Set objRS = CreateObject("ADODB.Recordset")
objConn.Open "DSN=EventLogs;"
Conn.ConnectionTimeout = 15
Conn.CommandTimeout = 10
Conn.Mode = 3 'adModeReadWrite
if objConn.state = 0 then
objConnection.Open strConnectString
end if
dim strSQL, objRS
strSQL = "SELECT *, ComputerName, EventCode,
Message,SourceName,TimeWritten, Type FROM EventTable WHERE (Type =
''Information'') ORDER BY 'TimeWritten'"
objRS.Open strSQL,objConnection,3,3
Response.Write("<Table Border=0 cellpadding=2 cellspacing=2>")
Response.Write("<tr bgcolor=#DFD9E6><td width=30
bgcolor=white> </td><td>" & objRS("ComputerName") & "</td><td>" &
objRS("Type") & "</td></tr>" & objRS("EventCode") & "</td></tr>" &
objRS("SourceName") & "</td></tr>" & objRS("Message") & "</td></tr>" &
objRS("TimeWriiten") & "</td></tr>")
objRS.MoveNext
next
Response.Write("</Table>")
%>
</HEAD>
<BODY>
<P> </P>
</BODY>
</HTML> Tag: ASP Help... Tag: 152566
xml login timeout getting mailbox size
Trying to get the mailbox size in the script below I receive 'Login Timeout'
I send the query to our OWA server and the status thrown is 440.
This is taken from the example on MSDN...
Thanks,
HankC
Output:
C:\>cscript mbsize.vbs
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
0:
0:
0:
0:
0:
<?xml version="1.0"?><g:searchrequest xmlns:g="DAV:"><g:sql>SELECT "http://schem
as.microsoft.com/mapi/proptag/x0e080003" FROM SCOPE ('DEEP TRAVERSAL OF "https:/
/webmail.um.umsystem.edu/exchange/myid/"') WHERE "DAV:isfolder" = true</g:sql>
</g:searchrequest>
Status: 440
Status text: Login Timeout
Code:
Option Explicit
On Error Resume Next
' Declare variables to be used.
Dim iSum ' As Integer
Dim strUri ' As String
Dim strMsg ' As String
Dim strServerName ' As String
Dim strMailbox ' As String
Dim strUserName ' As String
Dim strPassword ' As String
Dim i ' As Integer
Dim oXMLHttp ' As Msxml2.XMLHTTP
Dim oXMLDoc ' As Msxml2.DOMDocument
Dim oXMLSizeNodes ' As IXMLDOMNodeList
Dim oXMLHREFNodes ' As IXMLDOMNodeList
Dim sQuery ' As String
' Initialize variables.
iSum = 0
err.clear
' The URI of the mailbox on the Exchange server.
strUri = "https://webmail.um.umsystem.edu/exchange/myid/"
' Create XMLHTTP object.
Set oXMLHttp = CreateObject("Msxml2.xmlhttp")
' Error checking.
If Err.Number <> 0 Then
wscript.Echo "Error Creating XMLHTTP object"
wscript.Echo Err.Number & ": " & Err.Description
Set oXMLHttp = Nothing
wscript.quit
End If
err.clear
' Specify the SEARCH method, the URI, that the request will be sent
' asynchronously, and the credentials for the mailbox.
oXMLHttp.open "SEARCH", strUri , False, "myid", "myPassword"
wscript.Echo Err.Number & ": " & Err.Description
' Build the query string for a deep traversal search
' on the x0e080003 mapi proptag.
sQuery = "<?xml version=""1.0""?>"
sQuery = sQuery & "<g:searchrequest xmlns:g=""DAV:"">"
sQuery = sQuery & "<g:sql>SELECT ""http://schemas.microsoft.com/"
sQuery = sQuery & "mapi/proptag/x0e080003"" FROM SCOPE "
sQuery = sQuery & "('DEEP TRAVERSAL OF """ & strUri & """') "
sQuery = sQuery & "WHERE ""DAV:isfolder"" = true"
sQuery = sQuery & "</g:sql>"
sQuery = sQuery & "</g:searchrequest>"
' Set the request headers.
err.clear
oXMLHttp.setRequestHeader "Content-Type", "text/xml"
wscript.Echo Err.Number & ": " & Err.Description
oXMLHttp.setRequestHeader "Translate", "f"
wscript.Echo Err.Number & ": " & Err.Description
oXMLHttp.setRequestHeader "Depth", "0"
wscript.Echo Err.Number & ": " & Err.Description
oXMLHttp.setRequestHeader "Content-Length", "" & Len(sQuery)
wscript.Echo Err.Number & ": " & Err.Description
' Send the SEARCH request.
oXMLHttp.send sQuery
wscript.echo squery
If Err.Number <> 0 Then
wscript.Echo "Error sending query."
wscript.Echo Err.Number & ": " & Err.Description
Set oXMLHttp = Nothing
wscript.quit
End If
' An error occurred on the server.
If oXMLHttp.status >= 500 Then
wscript.echo "Status: " & oXMLHttp.status
wscript.echo "Status text: " & "An error occurred on the server."
Set oXMLHttp = Nothing
wscript.quit
' The SEARCH request was successful. Display the inbox folder names, sizes,
' and total size of the mailbox.
ElseIf oXMLHttp.status = 207 Then
' Get the XML response body.
Set oXMLDoc = oXMLHttp.responseXML
wscript.echo oXMLHttp.responsetext
' Build a list of the http://schemas.microsoft.com/mapi/proptag/x0e080003
' XML nodes returned in the search request. The
' http://schemas.microsoft.com/mapi/proptag/ namespace is typically
' assigned the d: prefix in the XML response body.
Set oXMLSizeNodes = oXMLDoc.getElementsByTagName("d:x0e080003")
' Build a list of the DAV:href XML nodes, corresponding to the folders
' in the mailbox. The DAV: namespace is typically assgigned the a:
' prefix in the XML response body.
Set oXMLHREFNodes = oXMLDoc.getElementsByTagName("a:href")
' Loop through the list of nodes and total up the sizes of the
' mailbox folders.
For i = 0 to oXMLSizeNodes.length - 1
' Display the folder URL.
wscript.Echo "Folder: " & oXMLHREFNodes.Item(i).nodeTypedValue
' Display the folder size.
wscript.Echo "Size: " & oXMLSizeNodes.Item(i).nodeTypedValue & " bytes."
wscript.echo ""
' Add the folder size to the running total.
iSum = iSum + oXMLSizeNodes.Item(i).nodeTypedValue
Next
' Display the total size of the mailbox in bytes.
wscript.Echo "Mailbox Size: " & iSum & " bytes."
' Clean up.
Set oXMLSizeNodes = Nothing
Set oXMLDoc = Nothing
Else
' Display the SEARCH status and status text.
wscript.echo "Status: " & oXMLHttp.status
wscript.echo "Status text: " & oXMLHttp.statustext
wscript.quit
End If
' Clean up.
Set oXMLHttp = Nothing Tag: ASP Help... Tag: 152565
Registry: Binary/Hex Value.
I have the following exported from a registry entry, and I want to make a
VbScript automatically import it back ito the registry without having to use
the .reg file, but thus far have been unable to figure it out.
Any help would be greatly appreciated:
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet
Settings\Connections]
"RemoteConnection"=hex:3c,00,00,00,03,00,00,00,03,00,00,00,08,00,00,00,70,72
,6f,78,\
79,3a,38,30,e5,00,00,00,31,34,33,2e,31,36,36,2e,2a,3b,2a,2e,64,65,6c,6c,2e,\
63,6f,6d,3b,31,36,33,2e,32,34,34,2e,2a,3b,31,30,2e,2a,3b,31,32,37,2e,2a,3b,\
2a,2e,73,61,62,72,65,62,74,73,2e,63,6f,6d,3b,2a,2e,63,6f,72,70,74,76,6c,2e,\
63,6f,6d,3b,2a,2e,65,62,72,65,76,69,61,74,65,2e,63,6f,6d,3b,4f,52,4c,31,30,\
50,4c,55,53,57,53,30,31,2e,43,53,45,52,56,45,52,3b,64,65,6c,6c,2e,6d,74,67,\
77,6f,72,6b,73,70,68,65,72,65,2e,63,6f,6d,3b,64,65,6c,6c,68,6f,6d,65,2e,6d,\
74,67,77,6f,72,6b,73,70,68,65,72,65,2e,63,6f,6d,3b,61,6e,79,77,68,65,72,65,\
2e,6e,6d,66,6e,2e,63,6f,6d,3b,36,34,2e,32,30,37,2e,30,2e,2a,3b,2a,2e,74,62,\
67,66,69,6e,61,6e,63,69,61,6c,2e,63,6f,6d,3b,2a,2e,61,72,69,62,61,61,73,70,\
2e,63,6f,6d,3b,3c,6c,6f,63,61,6c,3e,00,00,00,00,00,00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00 Tag: ASP Help... Tag: 152559
Unable to Open Recordset on one system.
I have one system, WIN98SE with WSH 5.6, that is unable to open recordsets
whether I use the RS.Open method or Conn.Execute.
The code below presents both methods. This the only machine that is having
this problem, I re-installed WSH as a basic trouble-shooting step, but that
wasn't it.
Does anyone have an idea what may be happening here?
Thanks, Patrick
----------------------------------------------------------------------------
-------------
sConn = "DSN=SOTAMAS90;UID=RPT;COMPANY=PLY;PWD=*******"
Set oConn = CreateObject("ADODB.Connection")
oConn.Provider = "MSDASQL"
oConn.Open sConn, adAsyncConnect
Set rsOrder = CreateObject("ADODB.Recordset") 'Comment Out if
Connection.Execute method is used
Set rsItems = CreateObject("ADODB.Recordset") 'Comment Out if
Connection.Execute method is used
sSQLOrd = "SELECT SO1.SalesOrderNumber, SO1.SalesOrderDate, SO1.ShipToName,
SO1.ShipToCity, SO1.ShipToState,"
sSQLOrd = sSQLOrd & " SO1.TaxableAmount + SO1.NonTaxableAmount +
SO1.SalesTaxAmount as SalesTotal"
sSQLOrd = sSQLOrd & " FROM SO1_SOEntryHeader SO1"
sSQLOrd = sSQLOrd & " WHERE SO1.Division = " & chr(39) & sCustDiv & chr(39)
& " AND"
sSQLOrd = sSQLOrd & " SO1.CustomerNumber = " & chr(39) & sCustNo & chr(39)
& " AND"
sSQLOrd = sSQLOrd & " SO1.ShipToCode = " & chr(39) & sShipTo & chr(39) & "
AND"
sSQLOrd = sSQLOrd & cStr(" SO1.SalesOrderDate >= {d " & chr(39) & dBegDT &
chr(39) & "}")
sSQLOrd = sSQLOrd & " ORDER BY SO1.SalesOrderNumber DESC"
'Set rsOrder = oConn.Execute(sSQLOrd)
rsOrder.Open sSQLOrd, oConn
----------------------------------------------------------------------------
------------- Tag: ASP Help... Tag: 152558
Show User Selection From Combo Box
Hi
I'm sure this is a very trivial problem!
I have a combo bound to a recordset. I was wondering how I can show the
value on the page, what the user has selected?
The code that I'm using is below.
Any help, would be much apprceciated.
Kind regards
Rikesh
<%
Dim objConnection 'The connection object
Dim objRecordset 'The recordset object
' create the Connection object
Set objConnection = Server.CreateObject("ADODB.Connection")
' open the DSN
objConnection.Open "Provider=sqloledb;" & _
"Data Source=DEVSVR;" & _
"Initial Catalog=pubs;" & _
"User Id=sa;" & _
"Password=admin"
' creates the recordset object
Set objRecordset = Server.CreateObject("ADODB.Recordset")
' SQL String for query
Dim strSQL
strSQL = "SELECT au_id, au_lname FROM Authors"
' execute the SQL statement that you want
' The query should return all the data you'll
' need in your combo box
objRecordset.Open strSQL, objConnection
Request.Form("au_lname")
Response.Write (Request.Form("au_lname"))
%>
<HTML>
<BODY>
<FORM ACTION="DBCombo.asp" METHOD=POST>
<select name=cboPrimary size=1 >
<!--onChange="frmTest.submit();"> -->
Choose from the combo:
select name="lstTopic" size="1">
<%
' while we don't get the end of DataBase
Do While Not objRecordset.EOF
'we put the ID at Value
'this value is important to linked tables
%>
<option VALUE="<%=objRecordset("au_ID")%>">
<!-- This is what will appear in the combo box -->
<%=objRecordset("au_lname")%>
</option>
<%
' Move to the next record...
objRecordset.MoveNext
Loop ' keep the loop
%>
</SELECT>
</FORM>
</BODY>
</HTML>
<%
' close the recordset object
objRecordset.Close
' clean the Recordset object
Set objRecordset = Nothing
%> Tag: ASP Help... Tag: 152551
is there anyway passing array variable of vbscript to javascript
hi
is there anyway passing array variable which is declared in vbscript
to javascript?
i made a sample code and i found that variant type variables which is
declared in vbscript are type 'unknown' in javascript
let me show some example
<script language="vbscript">
Dim arr(1)
arr(0) = "this"
arr(1) = "that"
</script>
<script language="javascript">
alert(typeof(arr));
</script>
then message box with "unknown" will be poped up
i tested this code with other type but all but variant type are just
fine.
is there anyway to solve this problem?
ps.this problem occured when i try to passing parameter in activex's
event to some event handling script code. any idea will be appreciated
have a nice day :) Tag: ASP Help... Tag: 152550
Vb Script to Join a Nt4 Domain and add domain user to Local Admin group
Dear all,
I am trying to create a script that will join a Xp pc to a nt4 domain. However i need to be able to pass the details of the domain admin through to join the domain. Below is the script that i am using to join the domain. However it needs to be able to parse the domain administrator details to join the domain.
Set net = WScript.CreateObject("WScript.Network")
local = net.ComputerName DomainName = "MyDomain"
UserAccount = "testuser"
set group = GetObject("WinNT://"& local &"/Administrators")
group.Add "WinNT://"& DomainName &"/"& UserAccount &""
Any help on the above code or other code would be great.
Thanks
Brett
**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources... Tag: ASP Help... Tag: 152545
Hex to Decimal
I would like to find the script to convert a Hex number to a decimal number.
I couldn't find the function in the Window Script documentation.
Actually I am trying to write an hex number into the registry, I used
Reg.Write with a REG_DWORD type; but it only takes decimal number.
Thanks.
JW Tag: ASP Help... Tag: 152544
Win32_NTLogEvent Query Security Log
Hello.
I try to query the Security Log of a Windows 2000 Domain Controller. I only
want to query for a special time period. I#ve created the following query
string:
Set colLoggedEvents = objWMIService.ExecQuery("Select * from
Win32_NTLogEvent Where TimeWritten >= '"&dtmStart&"' and TimeWritten <
'"&dtmEnd&"' and Logfile='Security' and EventIdentifier='644'", , 48)
The dtmStart and dtmEnd Values are calculated by a Function. The Return
value of this Function is string. If I execute the query I get the following
error:
(null): 0x80041017
In the MS KB 295821 is the clear text of this error number. It means
"WBEM_E_INVALID_QUERY ". I've pasted the query from the Script Repository
from MS. If I paste the Values manually (i.e.dtmStart
=20040127084847.000000+060; dtmEnd=20040128084847.000000+060) I get return
values! What am I doing wrong?
--
Andreas Semmelmann
mailto:nospam@nospam.de Tag: ASP Help... Tag: 152543
FTP Help needed
Can someone please tell me where I can find some useful
information on how to retrieve a file via ftp in a
vbscript? I've found countless articles about msinet.ocx,
but not much on how to use it. i'm having to go through a
proxy server to get the file. Tag: ASP Help... Tag: 152535
script to update computer name
Can I run a script to update the Computer Name of a W2K machine instead of
going through the Network Property ?
Please show me the script.
Thanks.
JW Tag: ASP Help... Tag: 152534
insert quotes into a txt file
hi
i have this script to take input from a user
dim fso, wshshl, fil,oShell, strExec, fullname
dim txtFil
set wshshl = wscript.createobject("wscript.shell"
set fso = createobject("Scripting.FileSystemObject"
set oShell=Wscript.CreateObject("Wscript.Shell"
fullname = inputbox("Enter in Full Name to be assigned to Client", "Fullname"
Set txtFile = fso.OpenTextFile("c:\a.xt", 2, True
'Change 2 to 8 if you want to append to fil
txtFile.WriteLine "Name = " & fullnam
txtFile.Clos
My problem is that when a user enters in spaces between the name, i.e, john do
the output that is written to a.txt is: john do
However, I need to insert quotes around the john doe, like "john doe" on the txt file because it is being read by anothe
program, and it needs quotes around the variable otherwise it will be truncated with just "john"
I pretty sure this is simple, but i'm just learning vb script, so i'm wondering if anyone can help
thanks
andy Tag: ASP Help... Tag: 152533
asp script..
select day,month,year
next...
write text...
http://www.polatliborsa.org.tr/tr/GunlukEndeks.htm