Calling VBScript Functions directly from external program
I would like to call a VBScript function within a .vbs file directly from an external program without having to execute the whole program. I will also need to pass a couple of parameters to the function. Does anybody know how to do this? Thanks Tag: Adding a site to the Intranet Zone Tag: 159724
disable FORM Submit by Enter Key
Hi,
How do I make a form not submit when a user presses "Enter" on the keyboard?
thanks
rafael Tag: Adding a site to the Intranet Zone Tag: 159719
print default
I try to script for "print Default", but i don't know to change.
The name of printer is "Color"
The name of Computer is "Pippo"
This is the script:
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colInstalledPrinters = objWMIService.ExecQuery _
("Select * from Win32_Printer Where Name = 'ScriptedPrinter'")
For Each objPrinter in colInstalledPrinters
objPrinter.SetDefaultPrinter()
Next
Thank you very much
Adry Tag: Adding a site to the Intranet Zone Tag: 159718
Using Store Procedure through VBScript which has a output paramete
I have a Storeprocedure which has 2 paramteres
1. Name
2. EmployeeId Output
Now I want to use this StoreProcedure to update the Column as EmployeeId in Different server & different table called TAble2
i.e I will pass name as "Samay" and it will return the EmployeeId as "123" which I will Update in TableB - EmployeeId
How Can i use the Storeproceure in VbScript which has an 1 output parameter
Please Advice Tag: Adding a site to the Intranet Zone Tag: 159717
Next Every Other Friday
Okay; I have this great script I added to our logon script that will tell if
it is the day to turn in your timesheet (every other friday). What I would
like to do is either augment this one or use another one that I can use on
our website to determine when the next date to turn in your timesheet is or
the next pay date (which is the opposite friday). Is there an easy way to
calculate what the next one is? I assume it is some do until statement, but
am unsure. If the formula works correctly, the output should be July 2,
2004 if ran right now
' use ISO date format yyyy-mm-dd so it is unambiguous!
sFirstFriday = "2003-04-25"
If Weekday(Now) = vbFriday Then
iDeltaWeeks = DateDiff("w", sFirstFriday, Now)
iEvenOdd = iDeltaWeeks Mod 2
If iEvenOdd = 0 Then
MsgBox "Remember to complete your time sheet today and turn it into to
your supervisor", vbOKOnly + vbExclamation, "Reminder"
End If
End If
--
Robert Cohen
A legend in his own mind
-- Tag: Adding a site to the Intranet Zone Tag: 159711
Reset permissions for subdirectories
Hi there,
How can I use VBScript to enable "Reset permissions on all child objects" option in the Advanced dialog box of a directory or perform the same fuctionality as this option using VBScript?
Thanks
Yang
**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources... Tag: Adding a site to the Intranet Zone Tag: 159710
ASP: Mac Address
I have a verification script that I would to limit the users from logging in
from another computer, without using cookies.
I would like to find the mac address and use this to verify the correct
computer.
What is the code that will allow me do this? Tag: Adding a site to the Intranet Zone Tag: 159709
scripting objects hang the PC
I am trying to use Filesystemobject for creating files using ASP page on IIS
web server on a Pentium4 machine running WinXP SP1.
I have given all permissions to the anonymous user which logs into the
Webserver (IUSR------).
However when I run the asp page which has the statements of FileSystem
object creation etc, nothing happens. If I click the button which loads that
asp page, after a few tries, the webserver also stops responding. If I try
to view any other page now on the webserver, it gives a message that the
webserver is busy because two many people are trying to access the
webserver.
To reenable the webserver I have to restart the computer.
Please help.
S N Tag: Adding a site to the Intranet Zone Tag: 159704
redim array in dictionary
Hi,
i want to redim a array that ot the data part of a dictionary.
dim oDic
dim aData
dim i
aData = split("abc,def,ghi",",")
set oDic = wscript.CreateObject("Scripting.Dictionary")
oDic.add "Row1", aData
i = ubound(oDic("Row1"),1) + 1
redim oDic("Row1")(i) ' <= fails
Any ideas ?
Many Thanks
Clas
--
The light at the end of the tunnel,
was switch off due to high costs. Tag: Adding a site to the Intranet Zone Tag: 159703
LDAP query from AD subdomains
How to query all printers from all domain in vbscript, Now I can get all
printers from top domain but nothing from subdomain. Tag: Adding a site to the Intranet Zone Tag: 159702
Permissions denied GetObject
Hi
I am running Windows XP and when every I try and run GetObject I get a
permissions denied error. I have the latest scripting engine loaded and the
strange thing it is only happening on this machine, IF I try another Windows
XP machine it works fine. Does anyone know why I am getting a permissions
denied when trying to execute this command "GetObject" ?
Thanks Tag: Adding a site to the Intranet Zone Tag: 159699
Help WMI on cluster [Win32_PerfRawData_PerfProc_Process]
Hi all:
I have the following script
====================================================================
Set objServices = GetObject("winmgmts:{impersonationLevel=impersonate}!root\cimv2")
...........................................
Set objWMIObjects = objServices.InstancesOf("Win32_PerfRawData_PerfProc_Process")
'''Win32_PerfFormattedData_PerfProc_Process for XP
.............................................
For Each ManagementObject In objWMIObjects
strResult = vbcrlf & "PercentProcessorTime : " &
ManagementObject.PercentProcessorTime & vbcrlf
strResult = strResult & "VirtualBytes : " &
ManagementObject.VirtualBytes & vbcrlf
=====================================================================
This one work fine on my winxp nb, my lab cluster environment
But fail on my customer cluster machine, no error return, just like
objWMIObjects has no items
Any idea ?
P.S I use mofcomp perf....mof already but still couldn't work
Scott_Wu Tag: Adding a site to the Intranet Zone Tag: 159697
Help w/ the Basics (if...then) - Okay, you can tell I'm an Engineer!!
Yes, I admit I'm an engineer. I'm new to this but I'm thinking
logically here. I'm looking for if..than statement examples. Yes,
I've found tons but it really doesn't explain anything to me. For
example, I'm looking for a basic script that would say If you find a
particular registry key with a particular string value, than delete
it. If you you don't find a particular registry key with it's string
value, than move on to the rest of the script. I can't find anything
like that. I can't even find if you find the key, rename it, modify
it, smile at it......
Am I too much of an engineer and this is working my left brain, the
side I've probably never touched, probably rotted out???? I've
created a delreg key and it works fine - see:
******************************************************
Const HKLM = &H80000002
sKey = "SOFTWARE\Lotus\Notes"
Set oReg = GetObject _
("WinMgmts:{impersonationLevel=impersonate}!//./root/default:StdRegProv")
DeleteRegistryKey HKLM, sKey
Sub DeleteRegistryKey(ByVal sHive, ByVal sKey)
Dim aSubKeys, sSubKey, iRC
On Error Resume Next
iRC = oReg.EnumKey(sHive, sKey, aSubKeys)
If iRC = 0 And IsArray(aSubKeys) Then
For Each sSubKey In aSubKeys
If Err.Number <> 0 Then
Err.Clear
Exit Sub
End If
DeleteRegistryKey sHive, sKey & "\" & sSubKey
Next
End If
oReg.DeleteKey sHive, sKey
End Sub
*****************************************************************
Not bad for an engineer - whatever.... Anyway, is this something that
can be done? Thanks to anyone that can help me out, point me in the
right direction. Tag: Adding a site to the Intranet Zone Tag: 159695
Disconnect Client Sessions from Server
I'm having rpoblems with a my backup routine. It seems that it cannot
backup a group of files because client sessions are still open. The
machines are logged off but for some reason the server thinks they are still
connected. I can disconnect using management console on server but I'm
looking to have this run as a scheduled script. Is there a way using VB to
disconnect client sessions from a server.
thanks in advance,
rob Tag: Adding a site to the Intranet Zone Tag: 159691
Environment Path (Win9x & WinXP)
I'm looking for a script that will allow me to set the path (in the
autoexec.bat file for the 9x world) and in the SYSTEM environment in
the NT world.
I've tried several things and can get the NT world to work, ut have
had no luck in setting the path in the 9x world (autoexec.bat).
Can someone show me the way?
Thanks!
Ron Tag: Adding a site to the Intranet Zone Tag: 159689
WMI connectserver using explicit username / password
I'm new to scripting, and could use some help. I'm trying to retrieve
a list of services on a remote computer using WMI, and have gotten it
to work on the server it's running on.
As far as I understand things, when I do this on a remote computer, I
need to supply an explicit username and password as ConnectServer
arguments. After doing this, the code gives me an "access denied"
error.
Not sure if this is relevant, but here's omething of note about the
security logs on the target remote computer. The administrator set up
an account within the administrator group for me to use. However,
whenever I try to log on using that account via ConnectServer, the
security log shows a failed attempt by "SYSTEM". In addition, in the
details about the failed attempt, the correct username is listed. I
can't figure it out.
Here's a snippet of the code (with the username and password literals
replaced, of course).
Set wbemServices = CreateObject("WbemScripting.SWbemLocator")
Set wbemConnection =
wbemServices.ConnectServer("fnetserv","\root\cimv2","READ",
"edgeread")
wbemConnection.Security_.ImpersonationLevel = 3
Set wbemObjectSet = wbemConnection.ExecQuery("SELECT * FROM
Win32_Service")
Another topic of note was that in the security log, the authority
process was called "Microsoft something" (i forget now), whereas every
other process was NTLM. I figured this was the COM verifying and
determining proper authority from the network, so I wasn't worried
about it, but if I should specify exactly to use NTLM in
ConnectServer, can someone give me the exact literal to use?
Sorry for being longwinded, and thanks in advance for any help on
these issues! Tag: Adding a site to the Intranet Zone Tag: 159686
Converting svgcheck.vbs to a java script
Adobe provides this vbs file that is necessary to use their SVG Viewer
plugin. However vbs is not recognized on Mozilla and i need to convert
this to a Javascript file. I have no idea of vbs. Can someone help ?
Following is the vbs :
' Copyright 1999-2000 Adobe Systems Inc. All rights reserved.
Permission to redistribute
' granted provided that this file is not modified in any way. This
file is provided with
' absolutely no warranties of any kind.
Function isSVGControlInstalled()
on error resume next
isSVGControlInstalled = IsObject(CreateObject("Adobe.SVGCtl"))
end Function
Thank you so much
b mathur. Tag: Adding a site to the Intranet Zone Tag: 159685
Any way to read text files without using FileSystemObject in ASP?
I'm using a free webhost that has disallowed access to the FSO, which is
making my life that much harder. I want to be able to read in text
files, but I don't know of any way except using the FSO. [bangs head
against wall] Help? Please?
--
auric underscore underscore at hotmail dot com
*****
Stupidity - the ONLY effective anti-hacker method.
-- CommanderStab (irc) Tag: Adding a site to the Intranet Zone Tag: 159682
Scripting for the registry, and getting return codes...
I've written some scripts for the registry, but I want to know how to get a
return value if a key exsists. It doesn't appear to allow me to return a
number if the key exisits or not.
Example:
This script was taken from the Script Center
(http://www.microsoft.com/technet/community/scriptcenter/registry/scrreg08.m
spx)
Script Start
------------
const HKEY_LOCAL_MACHINE = &H80000002
const REG_SZ = 1
const REG_EXPAND_SZ = 2
const REG_BINARY = 3
const REG_DWORD = 4
const REG_MULTI_SZ = 7
strComputer = "."
Set StdOut = WScript.StdOut
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &
strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Test Application"
oReg.EnumValues HKEY_LOCAL_MACHINE, strKeyPath, arrValueNames, arrValueTypes
WScript.Echo Err.number, Err.Description
For i=0 To UBound(arrValueNames)
StdOut.WriteLine "Value Name: " & arrValueNames(i)
Select Case arrValueTypes(i)
Case REG_SZ
StdOut.WriteLine "Data Type: String"
StdOut.WriteBlankLines(1)
Case REG_EXPAND_SZ
StdOut.WriteLine "Data Type: Expanded String"
StdOut.WriteBlankLines(1)
Case REG_BINARY
StdOut.WriteLine "Data Type: Binary"
StdOut.WriteBlankLines(1)
Case REG_DWORD
StdOut.WriteLine "Data Type: DWORD"
StdOut.WriteBlankLines(1)
Case REG_MULTI_SZ
StdOut.WriteLine "Data Type: Multi String"
StdOut.WriteBlankLines(1)
End Select
Next
Script End
-----------
How can I have this script let me know if the key exisits? It doesn't seem
to return an error until it hits the UBound (of course). Any ideas? I don't
cafre about the values in the key if it does exsist, I just want to know if
it is there or not.
Thanks Tag: Adding a site to the Intranet Zone Tag: 159670
Search multiple subtrings return results
I am trying to code a search action for an asp page
this will search an mdb memo field for occurrences of
each substring from a form field that can have multiple
values
for example in the form field name "keywords"
the user could input per following example
one flesh, marriage, women
the keywords I want to contain phrases as well
as individual words. Each value or substr of the field
will be separated with commas.
Question how can I extract the substrings and
create variables holding each substring encountered
Is this possible and if so how? Tag: Adding a site to the Intranet Zone Tag: 159669
subinacl problems for reg key permissions
Hi all,
I'm having trouble using subinacl, in that I can't get it to work!
Below I've included an example of the command I'm typing into the cmd window as well as the output from subinacl.
I'm trying to set permissions for a reg key, I've tried a few variations:
- using /keyreg and /subkeyreg
- providing the entire reg key ie: "hkey_local_machine\software\stephen" and "software\stephen" as I've seen these differences in various examples.
- In this example I've omitted the permissions part as I want to apply full permissions for the user for this test, but I've also tried /grant=machine_name\iusr_machine_name=F.
------------------------------------------------------------
C:\>subinacl /keyreg "hkey_local_machine\software" /grant=machine_name\iusr_machine_name
+keyreg hkey_local_machine\software
/grant=ecdb0219\iusr_ecdb0219
Elapsed Time: 00 00:00:00
Done: 0, Modified 0, Failed 0, Syntax errors 0
------------------------------------------------------------
To apply permission for a reg key to I have to set access for each part of the entire reg key, ie: for the example below do I have to set access rights for Key1, key2 and TheKey etc. or is it simply enough to set access rights on Thekey? I'm wondering if this is my problem?
> hklm\software\key1\key2\TheKey <
I can't understand what I'm doing wrong, as always any ideas/comments welcome!
Thanx in advance,
Stephen
. Tag: Adding a site to the Intranet Zone Tag: 159665
vbscript in visual basic 6
Hello all,
I am writing some code in Visual Basic 6. Is there a way that I can write
vbscript in the subroutine or is there a way a can tell the vb app to
execute a vbs file that is in a folder on the c drive?
Thank you Tag: Adding a site to the Intranet Zone Tag: 159664
desktop settings using scripts
Hi
We have staff and student users, and we would like to be able to see if
any students were logged in as staff. On our old system (which was not
standard and we didn't know how it worked :-) we had red desktops for
staff and green for students.
Now we have windows 2003/xp we would like to replicate this. Is there
any way using vbscript in a login script I can achieve this?
thanks
andy Tag: Adding a site to the Intranet Zone Tag: 159663
Checking the font details at the cursor position
Hi,
I am having a content editable div which is used to act like a rich text
editor. I also have got a toolbar with two combo boxes (Font face and font
size) and other tools such as bold, italic, underline, font color etc., etc.
The rich text editor works fine. I am using the Document.ExecCommand to
change the font/size etc.
my problem is the font face and font size combo boxes don't change when I
navigate between different paragraphs having different font faces and sizes.
is there a way to identify the font details of the current cursor position
and fire a method to update these combo boxes when the user is navigating
between text?
Thanks in advance.
Kind Regards,
Rex Devapriya De Silva Tag: Adding a site to the Intranet Zone Tag: 159660
Reading registry keys with & in key name?
I am attempting to read registry key values using regread that contain the & character. Specifically, I am trying to read the value "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\PCI\VEN_8086&DEV_1008&SUBSYS_011B1028&REV_02\3&1070020&0&10\LocationInformation". WMI is not an option because I am trying to do this inside of Windows PE. I can successfully read valus that do not contain a & symbol. At a command prompt, I can use reg query to read these values if I enclose the key path in quotes.
The error is:
Error: Invalid root in registry key "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\PCI\VEN_8086&DEV_1008&SUBSYS_011B1028&REV_02\3&1070020&0&10\LocationInformation"
Code: 80070002
Source: WshShell.RegRead.
Is there any way I can read these values using regread? Tag: Adding a site to the Intranet Zone Tag: 159659
ASP link back to Access database
I need some answers please....
I am using Active Server Pages and have three files. The main file
Orders.html is a order form for a computer company. When the user
inputs his information in the required fields and pushes submit the
information is then looped back to Notify.asp for messages that
appear, and then all the information is then submitted back to a
Microsoft Access database.
But it will not submit information to the access database. Could
someone please advise to what I am doing incorrectly? I believe the
error is in the asp page, but not sure what I need to do to correct
it.
PLEASE HELP. Any help much appreaciated. This is a URGENT request to.
Here is my coding:
ORDERS.html file
CODE
<HTML>
<HEAD>
<TITLE>Nano Group Computer Sales & Support - Order Form</TITLE>
<LINK REL=STYLESHEET TYPE="text/css" HREF="main.css">
<SCRIPT language="vbscript">
Window.Status = "Don't forget to order. Your product will be shipped
within 2-4 business days!"
</SCRIPT>
</HEAD>
<TR VALIGN="Top">
<TD VALIGN="Top">
<CENTER>
<img SRC="logo.gif" height=103 width=985 align=Top>
</CENTER>
<DIV align=right>
<img SRC="navfront.jpg" height=20 width=18>
<A HREF="home.html"><img SRC="buttonHome.jpg" height=20 width=75></A>
<img src="nav.jpg" height=20 width=18>
<A HREF="trainframe.html"><img SRC="buttontraing.jpg" height=20
width=75></A>
<img SRC="nav.jpg" height=20 width=18>
<A HREF="tech.html"><img Src="buttonTech.jpg" height=20 width=75></A>
<img SRC="nav.jpg" height=20 width=18>
<A HREF="locations.html"><img SRC="buttonLoc.jpg" height=20
width=75></A>
<img SRC="nav.jpg" height=20 width=18>
<A HREF="Products.html"><img SRC="buttonProd.jpg" height=20
width=75></A>
<img SRC="navend.jpg" height=20 width=18>
</DIV></TR></TD>
<TR VALIGN=Top>
<TD VALIGN=Top>
<TABLE BORDER=1 ALIGN=left CELLSPACING=0 CELLPADDING=0 WIDTH=100%>
<img src="bar.jpg" width=100% align=center>
<TD VALIGN=left WIDTH=18% height=10% BACKGROUND="links.jpg">
<H1 STYLE="HEIGHT=8pt; width=8%; Color=red;
filter:shadow(directorn=75, color-black)">
LINKS</H1>
<A HREF="links.html" TARGET="_top"><H3>HOT Links</H3></A>
<A HREF="Tips.html" TARGET="_top"><H3>Tips & Tricks</H3></A>
<A HREF="FAQ.html" TARGET="_top"><H3>Q & A's</H3></A>
<A HREF="Orderstatus.html" TARGET="_top"><H3>Order Status</H3></A>
<A HREF="Magazine.html" TARGET="_top"><H3>Our Newsletter</H3></A>
<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=0 WIDTH=75%>
</TR></TD>
</TABLE>
<TD>
<CENTER>
<A NAME=#Top></A>
<H1>Product Order Form</H1>
</CENTER>
<FORM NAME=frmPMPRegistration ACTION="NanoGroup.asp" METHOD=post>
Date: <INPUT TYPE="text" Name="txtDate" Value=" " ><BR>
<BR>
<H5>Personal Information:</H5>
<B>Title:</B> <SELECT NAME="optTitile">
<OPTION>Mr.
<OPTION>Mrs.
<OPTION>Miss.
</SELECT><BR><BR>
<B>Last Name:</B> <INPUT TYPE=text NAME=txtFirst VALUE="
">  
<B>First Name:</B> <INPUT TYPE=text NAME=txtLast VALUE="
"><BR><BR>
<B>Address:</B>   <INPUT TYPE=text NAME=txtAddress
VALUE=" "><BR><BR>
<B>City:</B> <INPUT TYPE=text NAME=txtCity VALUE="
"><BR><BR>
<B>Province:</B><SELECT NAME=optLevel>
<OPTION>British Columbia
<OPTION>Alberta
<OPTION>Saskatchewan
<OPTION>Manitoba
<OPTION>Ontario
<OPTION>Quebec
<OPTION>Nova Scotia
<OPTION>New Brunswick
<OPTION>Prince Edward Island
</SELECT><BR><BR>
<B>Postal Code:</B> <INPUT TYPE=text NAME=textPostCode
VALUE=" "><BR><BR>
<B>Telephone:</B>  <INPUT TYPE=text NAME=textPhone VALUE="
"><BR><BR>
<B>EMail Address:</B> <INPUT TYPE=text
NAME=textEmail VALUE=" "><BR><BR>
<center>
<H5>
Please fill in all required fields, so that we may better serve you:
</center></H5>
<HR>
<center>
<H4>Product Sales - ORDER section</H4></center>
<B>Category:</B> <SELECT NAME="optCategory">
<OPTION>System - Dell Desktop Computers
<OPTION>Laptop Computer
<OPTION>Printer
<OPTION>Computer Accessories
</SELECT><BR><BR>
<B>Which product are you ordering?</B><SELECT NAME="optProduct">
<OPTION>System - Dell Desktop Computers
<OPTION>Laptop Computer
<OPTION>Printer
<OPTION>Mice
<OPTION>CD Drive
<OPTION>Hub
<OPTION>NIC Card
</SELECT>
<i>If you would like to order more than one item, please fill
in the section at the bottom of this form</i>
<BR>
<BR>
<B>Do you subscribe to our Monthly Newsletter?<BR></B>
<INPUT TYPE=checkbox NAME=chkYes VALUE=Yes>Yes
<INPUT TYPE=checkbox NAME=chkNo VALUE=No>No<BR><BR>
<B>If not, would you like to?</B><BR>
Please <A HREF="Magazine.html"><i>click here</i></A> to be
re-directed to our newsletter form
<BR>
<BR>
<B>Which Nano Group Computer Sales & Support location(s) do you shop
at most often?<BR></B>
<SELECT NAME=optLocation>
<OPTION>Aylmer
<OPTION>Calgary
<OPTION>Edmonton
<OPTION>Fredericton
<OPTION>Halifax
<OPTION>Kingston
<OPTION>London
<OPTION>Moncton
<OPTION>Montreal
<OPTION>Ottawa
<OPTION>Regina
<OPTION>Toronto
<OPTION>Victoria
<OPTION>Winnipeg
</SELECT><BR><BR>
<SCRIPT LANGUAGE="VBscript">
Sub optLocation_OnChange
Dim x
Dim y
x=Document.frmPMPregistration.optLocation.SelectedIndex
for y=0 to Document.frmPMPregistration.optLocation.Length-1
if y=x then
Alert "Thank you for shopping in our" +
Document.frmPMPregistration.optLocation.Options(x).Text+
"Location"
end if
Next
End Sub
</SCRIPT>
<BR><center>
<H4>Payment Option:</H4></center>
We accept <img src="mastercard.gif">only  <INPUT TYPE=radio
NAME=rdoCard VALUE=Card>Master Card  
<INPUT TYPE=radio NAME=rdoVisa VALUE=Visa>Visa
<BR>
<BR>
Please enter any additional comments, suggestions or feedback that
would
help us continue providing the best service to you.<BR>
<center><TEXTAREA NAME=comments ROWS=10 COLS=60>
</TEXTAREA></center>
<HR>
<CENTER>
<INPUT TYPE=submit NAME=cmdSubmit VALUE=Submit>
<INPUT TYPE=reset NAME=cmdReset VALUE=Reset Form>
</FORM>
<SCRIPT LANGUAGE=vbscript>document.frmPMPRegistration.txtDate.Value=Now
</SCRIPT>
<A HREF="Products.html">[Back to Product Sales]</A>
</BODY>
</HTML>
ORDERS.inc file
CODE
<HTML>
<TITLE>Order.inc for Nano Group Computer Sales & Support Project -
WPF </TITLE>
<HEAD>
</HEAD>
<BODY>
<%
Dim objConn
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "DSN=Nano"
%>
</BODY>
</HTML>
NanoGroup.asp
CODE
<HTML>
<!-- #INCLUDE FILE="ADOVBS.inc" -->
<!-- #INCLUDE FILE="order.inc" -->
<HEAD>
<TITLE>NanoGroup.asp - From ORDER FORM Order.html- Nano Group Computer
Sales & Support. Using ASP page - Adding a new record to Access
database</TITLE>
<LINK REL=STYLESHEET TYPE="text/css" HREF="main.css">
</HEAD>
<BODY>
<H1> Nano Group Computer Sales & Support</H1>
<H3> Thank you for purchasing our Products, you will receive your
shipment within 2-4 business days! </H3>
<%
Dim strCategory,strProduct,strFirst,strLast,strAddress,strCity,strProvince,strPostalCode,strTelephone,strEmail
strTitle = Request.Form("optTitle")
strCategory = Request.Form("optCategory")
strProduct = Request.Form("optProduct")
strFirst = Request.Form("txtFirst")
strLast = Request.Form("txtLast")
strAddress = Request.Form("txtAddress")
strCity = Request.Form("txtCity")
strProvince = Request.Form("txtProvince")
strPostalCode = Request.Form("txtPostalCode")
strTelephone = Request.Form("txtPhone")
strEmail = Request.Form("txtEmail")
%>
<%
Dim objrsUsers
Set objrsUsers = Server.CreateObject("ADODB.Recordset")
objrsUsers.Open "Orders", strConn,adOpenForwardOnly,adCmdTable
objrsUsers.Filter = "Email= '" & Request.Form("txtEmail") & "'"
If objrsUsers.EOF then 'Create New Record
objrsUsers.AddNew
End If
objrsUsers("Title") = strTitle 'populate a new record or
modify current one
objrsUsers("Category") = strCategory
objrsUsers("Product") = strProduct
objrsUsers("LastName") = strLast
objrsUsers("FirstName") = strFirst
objrsUsers("Address") = strAddress
objrsUsers("City") = strCity
objrsUsers("Province") = strProvince
objrsUsers("PostalCode") = strPostalCode
objrsUsers("Telephone") = strTelephone
objrsUsers("Email") = strEmail
objrsUsers.Update
objrsUsers.Close
objrsUsers=Nothing
objConn.Close
objConn.Nothing
%>
<BR>
<HR>
Welcome, <% Response.Write strFirst %> <% Response.Write
strLast %>
<BR>
You product(s) have been ordered, and your information has been
updated in our database.
<BR>
<% Response.Write strCategory %>
<% Response.Write strProduct %>
<% Response.Write strFname %>
<% Response.Write strLast %> <BR>
<% Response.Write strAddress %> <BR>
<% Response.Write strCity %> <BR>
<% Response.Write strProvince %> <BR>
<% Response.Write strPostalCode %> <BR>
<% Response.Write strTelephone %> <BR>
<% Response.Write strEmail %> <BR>
<%End If%>
<% Response.Redirect "Order.html" %>
</BODY>
</HTML>
NOTE: File not attached is access database. Table under "Orders" and
field name - Category, Products, First Name, Last Name, Address, City,
Province, Postal Code, Telephone and E-Mail.
Can any one help? Thank you Tag: Adding a site to the Intranet Zone Tag: 159651
ASP link back to Access database
I need some answers please....
I am using Active Server Pages and have three files. The main file
Orders.html is a order form for a computer company. When the user
inputs his information in the required fields and pushes submit the
information is then looped back to Notify.asp for messages that
appear, and then all the information is then submitted back to a
Microsoft Access database.
But it will not submit information to the access database. Could
someone please advise to what I am doing incorrectly? I believe the
error is in the asp page, but not sure what I need to do to correct
it.
PLEASE HELP. Any help much appreaciated. This is a URGENT request to.
Here is my coding:
ORDERS.html file
CODE
<HTML>
<HEAD>
<TITLE>Nano Group Computer Sales & Support - Order Form</TITLE>
<LINK REL=STYLESHEET TYPE="text/css" HREF="main.css">
<SCRIPT language="vbscript">
Window.Status = "Don't forget to order. Your product will be shipped
within 2-4 business days!"
</SCRIPT>
</HEAD>
<TR VALIGN="Top">
<TD VALIGN="Top">
<CENTER>
<img SRC="logo.gif" height=103 width=985 align=Top>
</CENTER>
<DIV align=right>
<img SRC="navfront.jpg" height=20 width=18>
<A HREF="home.html"><img SRC="buttonHome.jpg" height=20 width=75></A>
<img src="nav.jpg" height=20 width=18>
<A HREF="trainframe.html"><img SRC="buttontraing.jpg" height=20
width=75></A>
<img SRC="nav.jpg" height=20 width=18>
<A HREF="tech.html"><img Src="buttonTech.jpg" height=20 width=75></A>
<img SRC="nav.jpg" height=20 width=18>
<A HREF="locations.html"><img SRC="buttonLoc.jpg" height=20
width=75></A>
<img SRC="nav.jpg" height=20 width=18>
<A HREF="Products.html"><img SRC="buttonProd.jpg" height=20
width=75></A>
<img SRC="navend.jpg" height=20 width=18>
</DIV></TR></TD>
<TR VALIGN=Top>
<TD VALIGN=Top>
<TABLE BORDER=1 ALIGN=left CELLSPACING=0 CELLPADDING=0 WIDTH=100%>
<img src="bar.jpg" width=100% align=center>
<TD VALIGN=left WIDTH=18% height=10% BACKGROUND="links.jpg">
<H1 STYLE="HEIGHT=8pt; width=8%; Color=red;
filter:shadow(directorn=75, color-black)">
LINKS</H1>
<A HREF="links.html" TARGET="_top"><H3>HOT Links</H3></A>
<A HREF="Tips.html" TARGET="_top"><H3>Tips & Tricks</H3></A>
<A HREF="FAQ.html" TARGET="_top"><H3>Q & A's</H3></A>
<A HREF="Orderstatus.html" TARGET="_top"><H3>Order Status</H3></A>
<A HREF="Magazine.html" TARGET="_top"><H3>Our Newsletter</H3></A>
<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=0 WIDTH=75%>
</TR></TD>
</TABLE>
<TD>
<CENTER>
<A NAME=#Top></A>
<H1>Product Order Form</H1>
</CENTER>
<FORM NAME=frmPMPRegistration ACTION="NanoGroup.asp" METHOD=post>
Date: <INPUT TYPE="text" Name="txtDate" Value=" " ><BR>
<BR>
<H5>Personal Information:</H5>
<B>Title:</B> <SELECT NAME="optTitile">
<OPTION>Mr.
<OPTION>Mrs.
<OPTION>Miss.
</SELECT><BR><BR>
<B>Last Name:</B> <INPUT TYPE=text NAME=txtFirst VALUE="
">  
<B>First Name:</B> <INPUT TYPE=text NAME=txtLast VALUE="
"><BR><BR>
<B>Address:</B>   <INPUT TYPE=text NAME=txtAddress
VALUE=" "><BR><BR>
<B>City:</B> <INPUT TYPE=text NAME=txtCity VALUE="
"><BR><BR>
<B>Province:</B><SELECT NAME=optLevel>
<OPTION>British Columbia
<OPTION>Alberta
<OPTION>Saskatchewan
<OPTION>Manitoba
<OPTION>Ontario
<OPTION>Quebec
<OPTION>Nova Scotia
<OPTION>New Brunswick
<OPTION>Prince Edward Island
</SELECT><BR><BR>
<B>Postal Code:</B> <INPUT TYPE=text NAME=textPostCode
VALUE=" "><BR><BR>
<B>Telephone:</B>  <INPUT TYPE=text NAME=textPhone VALUE="
"><BR><BR>
<B>EMail Address:</B> <INPUT TYPE=text
NAME=textEmail VALUE=" "><BR><BR>
<center>
<H5>
Please fill in all required fields, so that we may better serve you:
</center></H5>
<HR>
<center>
<H4>Product Sales - ORDER section</H4></center>
<B>Category:</B> <SELECT NAME="optCategory">
<OPTION>System - Dell Desktop Computers
<OPTION>Laptop Computer
<OPTION>Printer
<OPTION>Computer Accessories
</SELECT><BR><BR>
<B>Which product are you ordering?</B><SELECT NAME="optProduct">
<OPTION>System - Dell Desktop Computers
<OPTION>Laptop Computer
<OPTION>Printer
<OPTION>Mice
<OPTION>CD Drive
<OPTION>Hub
<OPTION>NIC Card
</SELECT>
<i>If you would like to order more than one item, please fill
in the section at the bottom of this form</i>
<BR>
<BR>
<B>Do you subscribe to our Monthly Newsletter?<BR></B>
<INPUT TYPE=checkbox NAME=chkYes VALUE=Yes>Yes
<INPUT TYPE=checkbox NAME=chkNo VALUE=No>No<BR><BR>
<B>If not, would you like to?</B><BR>
Please <A HREF="Magazine.html"><i>click here</i></A> to be
re-directed to our newsletter form
<BR>
<BR>
<B>Which Nano Group Computer Sales & Support location(s) do you shop
at most often?<BR></B>
<SELECT NAME=optLocation>
<OPTION>Aylmer
<OPTION>Calgary
<OPTION>Edmonton
<OPTION>Fredericton
<OPTION>Halifax
<OPTION>Kingston
<OPTION>London
<OPTION>Moncton
<OPTION>Montreal
<OPTION>Ottawa
<OPTION>Regina
<OPTION>Toronto
<OPTION>Victoria
<OPTION>Winnipeg
</SELECT><BR><BR>
<SCRIPT LANGUAGE="VBscript">
Sub optLocation_OnChange
Dim x
Dim y
x=Document.frmPMPregistration.optLocation.SelectedIndex
for y=0 to Document.frmPMPregistration.optLocation.Length-1
if y=x then
Alert "Thank you for shopping in our" +
Document.frmPMPregistration.optLocation.Options(x).Text+
"Location"
end if
Next
End Sub
</SCRIPT>
<BR><center>
<H4>Payment Option:</H4></center>
We accept <img src="mastercard.gif">only  <INPUT TYPE=radio
NAME=rdoCard VALUE=Card>Master Card  
<INPUT TYPE=radio NAME=rdoVisa VALUE=Visa>Visa
<BR>
<BR>
Please enter any additional comments, suggestions or feedback that
would
help us continue providing the best service to you.<BR>
<center><TEXTAREA NAME=comments ROWS=10 COLS=60>
</TEXTAREA></center>
<HR>
<CENTER>
<INPUT TYPE=submit NAME=cmdSubmit VALUE=Submit>
<INPUT TYPE=reset NAME=cmdReset VALUE=Reset Form>
</FORM>
<SCRIPT LANGUAGE=vbscript>document.frmPMPRegistration.txtDate.Value=Now
</SCRIPT>
<A HREF="Products.html">[Back to Product Sales]</A>
</BODY>
</HTML>
ORDERS.inc file
CODE
<HTML>
<TITLE>Order.inc for Nano Group Computer Sales & Support Project -
WPF </TITLE>
<HEAD>
</HEAD>
<BODY>
<%
Dim objConn
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "DSN=Nano"
%>
</BODY>
</HTML>
NanoGroup.asp
CODE
<HTML>
<!-- #INCLUDE FILE="ADOVBS.inc" -->
<!-- #INCLUDE FILE="order.inc" -->
<HEAD>
<TITLE>NanoGroup.asp - From ORDER FORM Order.html- Nano Group Computer
Sales & Support. Using ASP page - Adding a new record to Access
database</TITLE>
<LINK REL=STYLESHEET TYPE="text/css" HREF="main.css">
</HEAD>
<BODY>
<H1> Nano Group Computer Sales & Support</H1>
<H3> Thank you for purchasing our Products, you will receive your
shipment within 2-4 business days! </H3>
<%
Dim strCategory,strProduct,strFirst,strLast,strAddress,strCity,strProvince,strPostalCode,strTelephone,strEmail
strTitle = Request.Form("optTitle")
strCategory = Request.Form("optCategory")
strProduct = Request.Form("optProduct")
strFirst = Request.Form("txtFirst")
strLast = Request.Form("txtLast")
strAddress = Request.Form("txtAddress")
strCity = Request.Form("txtCity")
strProvince = Request.Form("txtProvince")
strPostalCode = Request.Form("txtPostalCode")
strTelephone = Request.Form("txtPhone")
strEmail = Request.Form("txtEmail")
%>
<%
Dim objrsUsers
Set objrsUsers = Server.CreateObject("ADODB.Recordset")
objrsUsers.Open "Orders", strConn,adOpenForwardOnly,adCmdTable
objrsUsers.Filter = "Email= '" & Request.Form("txtEmail") & "'"
If objrsUsers.EOF then 'Create New Record
objrsUsers.AddNew
End If
objrsUsers("Title") = strTitle 'populate a new record or
modify current one
objrsUsers("Category") = strCategory
objrsUsers("Product") = strProduct
objrsUsers("LastName") = strLast
objrsUsers("FirstName") = strFirst
objrsUsers("Address") = strAddress
objrsUsers("City") = strCity
objrsUsers("Province") = strProvince
objrsUsers("PostalCode") = strPostalCode
objrsUsers("Telephone") = strTelephone
objrsUsers("Email") = strEmail
objrsUsers.Update
objrsUsers.Close
objrsUsers=Nothing
objConn.Close
objConn.Nothing
%>
<BR>
<HR>
Welcome, <% Response.Write strFirst %> <% Response.Write
strLast %>
<BR>
You product(s) have been ordered, and your information has been
updated in our database.
<BR>
<% Response.Write strCategory %>
<% Response.Write strProduct %>
<% Response.Write strFname %>
<% Response.Write strLast %> <BR>
<% Response.Write strAddress %> <BR>
<% Response.Write strCity %> <BR>
<% Response.Write strProvince %> <BR>
<% Response.Write strPostalCode %> <BR>
<% Response.Write strTelephone %> <BR>
<% Response.Write strEmail %> <BR>
<%End If%>
<% Response.Redirect "Order.html" %>
</BODY>
</HTML>
NOTE: File not attached is access database. Table under "Orders" and
field name - Category, Products, First Name, Last Name, Address, City,
Province, Postal Code, Telephone and E-Mail.
Can any one help? Thank you Tag: Adding a site to the Intranet Zone Tag: 159650
Excel Range Deletion and shift left
Hello,
I am in need of deleting a certain range (known) in an EXCEL spreadsheet
and shifting over to the left once the range has been deleted. The below
code is provided by excel, I however cannot seem to make it work on WSH
(VBSCRIPT). Can anyone help.
Range("B1:B22").Select
Selection.Delete Shift:=xlToLeft
Thank you Tag: Adding a site to the Intranet Zone Tag: 159649
CDOSYS.DLL generating Visual C++ Runtime Error
I am using the CDOSYS.DLL (CDO for Windows 2000 Library) to send email by
using Win2K Server's SMTP Service from within Windows Script written in
VBScript.
I am receiving errors when attempting to create a CDO Message object
(CreateObject("CDO.Message")). Actually, I receive the same error if I try
to create any object within the CDOSYS library, not just the Message object.
The entire application errors out with the following message:
"Microsoft Visual C++ Runtime Library. Runtime Error! Program <program
name>. abnormal program termination."
The name of the program matches the name of my application, but the error
(to the best of my knowledge) is actually being generated from the CDOSYS
libraries.
* Running Win2K SP4 with IE 6 SP1.
* Several other machines with similar (if not seemingly exact)
configurations do not receive the error.
* Nothing in the Event Logs to indicate an error
* The SMTP Service is running (however since the message isn't even getting
created, I don't think this matters)
* There is nothing in Drop or any other mailroot folder
Because CDOSYS is installed with the OS, we attempted to reapply SP4 - no
luck.
Any other suggestions? Anyone else seen this before?
Ron Cuirle
Adv IT Systems Analyst
FirstEnergy Corp. Tag: Adding a site to the Intranet Zone Tag: 159645
WIA script
Hi folks,
I know this is not the exact place to post this question, but I am
having problems using the MSDN example for Windows Image Acquisition API.
I have a XP SP1, and the following script fails with "cannot provide
requested class" or something like that (error 80040111).
dim obj
set obj=CreateObject("Wia.Script")
Any help is very welcome!!
Regards
Rafael Tag: Adding a site to the Intranet Zone Tag: 159644
vbscript ADSI question
I have this query for discovering if a user has the &H10000 flag set
(Password never expires). I'd like to convert it to querying all users
in my domain.
<code>
Dim Users
Dim UserName
Dim UserDomain
Dim Flags
UserDomain = "Domain_To_Manage"
UserName = "Target_User_Name"
Set user = GetObject("WinNT://" & UserDomain & "/" & UserName & ",user")
Flags = User.Get("UserFlags")
If (Flags And &H10000) <> 0 Then
Response.Write "The specified user accounty is configured so that the
password never expires."
End If
</code> Tag: Adding a site to the Intranet Zone Tag: 159643
passing array from VC++ COM to VBScript
Hi,
Thanks for checking out my post.
I am trying to send a SAFEARRAY from a Visual C++ ATL COM component to a
VBScript client.
I have managed to get this working with a "[out,retval] VARIANT *" on the
server side and reading a 1D (one dimesional) array on the VBScript client.
I create a SAFEARRAY, filled it with VARIANTS of type BSTR and then send it
off to the client via a VARIANT *
But I can't seem to get it working with a 2D array?? I get that typical
"Type mismatch error" when I try to access a member of the array on the
client side, like this :-
###################### begin client code
########################################
Set objArray = CreateObject("ArraySamp.Array") aArray =
objArray.Fetch()
aArray = objArray.Fetch()
Response.write aArray(0)(0) <-----THIS ERRORS
####
The server (VC++) code is below. Thanks for any help!
Mike
########################### begin server code
###########################################
STDMETHODIMP CArray::Fetch(VARIANT *pAray)
{
SAFEARRAYBOUND saBound[2];
SAFEARRAY *psa;
//first dimension
saBound[0].cElements = 2;
saBound[0].lLbound = 0;
//second dimension
saBound[1].cElements = 2;
saBound[1].lLbound = 0;
//create a 2D SAFEARRAY
psa = SafeArrayCreate(VT_VARIANT, 2, saBound);
//the data we will add to the array
CComBSTR str(_T("mike"));
VARIANT vVal;
vVal.vt = VT_BSTR;
vVal.bstrVal = str.Copy();
CComBSTR str2(_T("fred"));
VARIANT vVal2;
vVal2.vt = VT_BSTR;
vVal2.bstrVal = str2.Copy();
//vector of indexes for each dimension of the array
//which is used to traverse the array and to add
//elements to the array
long aiIndex[2];
HRESULT hr = S_OK;
//traverse the rows
for(aiIndex[0] = 0; aiIndex[0] < 2; aiIndex[0]++)
{
//go along the columns for this single row
for(aiIndex[1] = 0; aiIndex[1] < 2; aiIndex[1]++)
{
//this is just to put either "fred" or "mike"
//in each string
if (aiIndex[0] == 0)
{
hr = SafeArrayPutElement(psa, aiIndex, &vVal);
}
else
{
hr = SafeArrayPutElement(psa, aiIndex, &vVal2);
}
}
}
VariantInit(pAray);
pAray->vt = VT_ARRAY | VT_VARIANT;
pAray->parray = psa;
return S_OK;
} Tag: Adding a site to the Intranet Zone Tag: 159641
Folder watch using wild card
I found this posting which had a script I could use for watching a folder
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&safe=off&selm=7vpb87%243dvo%241%40newssvr04-int.news.prodigy.com
I have tweaked it for my needs but don't know how to use it to watch for any
files with a particular extension, in this case *.tif. I have the following
line calling the procedure but it is not working. How do I handle this?
Call WatchFolder("J:\Documents\Received Faxes\","*.TIF")
Thanks
Tony
full modified script
******************************************
Set System = CreateObject("Scripting.FileSystemObject")
'Substitute the complete path of the folder to be watched for the
'parameter Arg1. Substitute the complete path of folder X for
'the parameter Arg2. Substitute the complete path of folder Y
'for the parameter Arg3. Substitute the name of the file to be
'moved to folder X for the parameter Arg4. Substitute the name
'of the file to be moved to folder Y for the parameter Arg5.
'Note that you don't have to specify the complete path of the file
'names; you can pass just the filename as an argument. All parameters
'must be passed as strings, and they must be passed in the exact
'order specified above in order for this routine to work correctly.
Call WatchFolder("J:\Documents\Received Faxes\","*.TIF")
Wscript.Quit
Sub WatchFolder(FolderToWatch,FiletoWatch)
Dim FileNameX
'Check to ensure that the folder names that were passed as
'arguments actually exist. If not, give error message and exit.
If ValidateFolder(FolderToWatch) = False Then Exit Sub
'Adds trailing backslash to folder paths if neccesary.
FolderToWatch = AddBackslash(FolderToWatch)
FileNameX = FolderToWatch & System.GetFileName(FiletoWatch)
If ValidateFile(FileNameX) = True then
if msgbox("New fax(es) in the Received Faxes
folder.",vbyesno+vbquestion+vbdefaultbutton2,"New Faxes") = vbyes then
msgbox "ok"
end if
End if
' Set System = Nothing
' Wscript.Sleep 300000 'Sleep for 5 minute.
'Subroutine starts a new instance of the running script and
'terminates the current instance.
' Set Shell = CreateObject("Wscript.Shell")
' Shell.Run "wscript " & """" & Wscript.ScriptFullName & """"
' Set Shell = Nothing
' Wscript.Quit
End Sub
Function ValidateFile(FiletoValidate)
msgbox FiletoValidate
If System.FileExists(FiletoValidate) Then
ValidateFile = true
Else
ValidateFile = False
End If
End Function
Function AddBackslash(ThisFolderPath)
If Not Right(ThisFolderPath,1) = "\" Then
ThisFolderPath = ThisFolderPath & "\"
End If
AddBackslash = ThisFolderPath
End Function
Function ValidateFolder(FolderToCheck)
Const Message = " is not an existing folder on your"
If Not System.FolderExists(FolderToCheck) Then
MsgBox FolderToCheck & Message & " system."
ValidateFolder = False
Else
ValidateFolder = True
End If
End Function Tag: Adding a site to the Intranet Zone Tag: 159640
Newbie: Update Excel Chart with new range of values
Have a script which creates an Excel chart from a range of values. The
script runs daily and adds a new cell value in Column B. That all works
fine.
What I'm attempting to do is update the Chart range values to include the
new cell. What I have so far instead creates a new series with the new cell
value - as a result, I'm just getting single points as a different series.
After researching this problem for a couple of days, I am still unsure
whether I need to somehow update the SeriesCollection values, the Range
values of the chart itself, or use the SetData, SetSourceData, or Extend
methods. Either way, I have difficulty understanding when to use what, when
and where. Hope you can help clear it up. Here's the relevant code.
strExcelRowValue increases by 1 cell every time I run it. So I need to
update the range values of SeriesCollection(1): B2:B3 on day 3, B2:B4 on day
four, B2:B5 on day 5, etc...
objXLApp.Sheets(strExcelChartName).Select
Set objChartObject = objXLApp.ActiveChart
' Set objSeries = objXLApp.ActiveChart.SeriesCollection(1) - Commented
out, though I can access if needed
objChartObject.SetSourceData
objXLApp.Sheets(strExcelSheetName).Range("B2:B" & strExcelRowValue)
Thanks in advance Tag: Adding a site to the Intranet Zone Tag: 159636
Enumerate Table
Hi,
I have a html page with table and a cell in the table can have a background
image (as in www.sonyericsson.com ). I wish to enumerate all such table
cells and change the background image url from my script. Is there any way I
can do that ?
Thanks,
-Vengidi Tag: Adding a site to the Intranet Zone Tag: 159634
accessing VSS programmatically ?
Hi,
does VSS has a COM object that can be instantiated in a VB script?
among the things I want to be able to do from the script is to copy a file /
files from a VSS project to a folder. is this is documented? or shall I just
use the VSS command line?
thanks Tag: Adding a site to the Intranet Zone Tag: 159633
Forcing internet explorer to download everything
I have been playing with Heidi Fleischer's system:
http://www.dougstaples.com
It is obvious that the little pictures are little because Heidi wants
them downloaded quickly, IE on the other hand (on a slow system)
insists on loading big pictures first and the little ones late if at
all!
Is there any way of forcing IE to give equal time to all downloads? Tag: Adding a site to the Intranet Zone Tag: 159625
User Logon Script
Guys
I need to create a logon script using VBS but know very little about coding.
I know a little VB and VBA so hopefully I will not be completely lost. Does
anyone know of any tutorials available...?
--
-----------------------------
Michael Mason
Arras People
www.arraspeople.co.uk
----------------------------- Tag: Adding a site to the Intranet Zone Tag: 159621
Error 80070005 in vbscript
Hi
I'am writing a script from which the user himself or herself can
change his or her password.
A major part of this script is here:
"Private Function SetPW(Usr, PW)
Dim oUser
Set oUser = GetObject("WinNT://" & Location & "/" & Usr &
",user")
If Err.Number = 0 Then
Call oUser.SetPassword(PW)
oUser.SetInfo
Set oUser = Nothing
SetPW = True
Else
SetPW = False
End If
End Function 'SetPW"
At one domain it works fine, but in 3 other domains I get the error:
Genereal protection error - 80070005
in the "Call oUser.SetPassword(PW)"-line.
What is generating this error ? Is it any security settings in AD ?
Any help or suggestions are very appreciated.
Thanks.
Hans Peder Nielsen
DK Tag: Adding a site to the Intranet Zone Tag: 159620
Writing background process
Hi,
Can I run a windows script as a background process on Windows 2000? If yes,
how do I do that? Your help would be much appreciated.
Regards,
Gilbert Tag: Adding a site to the Intranet Zone Tag: 159619
Returning Unicode value of the character
In JScript, the function charCodeAt(n) returns an integer
representing the Unicode encoding of the character at the
n+1 position as shown in the following example.
How can we do the same using VBScript or Visual Basic?
Thanks,
Bob
///////////EXAMPLE///////////////////////
<html>
<head>
<script language="jscript">
function charCodeAtTest(n){
var str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
var n;
n = str.charCodeAt(n); //Get the Unicode
value of the
// character at
position n+1.
alert(n);
}
</script>
</head>
<body onload="charCodeAtTest(2)">
Test for charCodeAt(2). The function will return 67 --
the integer representing Unicode encoding of the
character "C"
</body>
</html>
//////////////////////// Tag: Adding a site to the Intranet Zone Tag: 159611
Remove Leading Zeroes
They want me to remove the 0's (Zeroes) in fron of the test ratings on teachers.
No teacher can be 1.000. The Field is defined as Single.
Here is the Code.
<Table Border=3 Frame=All CellPadding=5 CellSpacing=2 Cols=8>
<TR><TD>City</TD><TD>School</TD><TD>F/L</TD><TD>Educator</TD><TD>#</TD><TD>NM Rate</TD><TD>TX Rate</TD><TD> Hgt </TD></Tr>
<TD NoWrap><%Response.Write rsTeachers("Brtg")%></TD>
How do I remove the leading 0 in the Brtg Field.
They appear as 0.993, 0.995, 0.996, 0.999, etc.
I need them to appear as .993, .995, .996, .999 or
993, 995, 996 or 999 will do.
Thank You for Your Help in Advance
Bill Barber Tag: Adding a site to the Intranet Zone Tag: 159608
Syntax Problem
I have a previous page where I have to create the field names. Everything work sperfect except when I go to request the data on the next page. The field I am creating is a checkbox field.
I need to know if I can do what I am trying to do? I have been at this for about 15 days straght.
I am a teacher who does a little VB programming, but very little ASP.
Here is my code
IX = IX + 1
NameOfField = "FL" & IX
ZZ = Request'"( & "NameOfField" & )'" <!-- Line I am having Problems With -->
Response.Write "This is FL7 " & Request("FL7") & " " & "| " & ZZ & " |" & NameOfField <!-- This line for testing code only! -->
Thanks a Lot for any constructive help.
Tony Tag: Adding a site to the Intranet Zone Tag: 159605
SQL constraint rule probelm
Hi there,
I'm having a hard time automatically editing some users to my SQL DB.
I established it is because the surname of the people I am adding
contains an " ' ", eg surname = O'Connel
What I am sending SQL looks like:
sQLUpdateString = "UPDATE Users SET " & updateString & _
" WHERE (UserName='" & userName & "')"
conWrite.Execute(sQLUpdateString)
My script generates updateString automatically and in the case where
it updates the users full name;
updateString = FullName='John O'Connel'
In this case userName = "JohnO"
This normally works fine, (I can update all the other users in my DB
this way), however in cases like this where the surname includes the "
' " the full name in read in as being "John O" then an error because
the "Connel" part still remains and is invalid SQL. I am told that I
should probably use a rule or a constraint to fix this, however SQL is
not really my strong suit, so any pointers on how to go about this
would be greatly appreciated.
Thanks in advance Tag: Adding a site to the Intranet Zone Tag: 159603
GetObject for IE
I'm trying to use the GetObject Method in VScript to copy information into a
custom Outlook form:
Set objIE = GetObject(,"InternetExplorer.Application")
objIE.Visible = True
Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set objFolder = objNS.GetDefaultFolder(6)
Set objItem = objFolder.Items.Add("IPM.Post.GenericDocument")
objItem.Display
Set objPage = objItem.GetInspector.ModifiedFormPages("Message")
objPage.Controls("txtURL").Value = objIE.LocationURL
objPage.Controls("Subject").Value = objIE.LocationName
objItem.BodyFormat = 2
objItem.HTMLBody = objIE.Document.Body.innerHTML
Set objItem = Nothing
Set objIE = Nothing
Set objApp = Nothing
Set objNS = Nothing
Set objFolder = Nothing
Set objPage = Nothing
I get an "Unspecified" error is at
objItem.HTMLBody = objIE.Document.Body.innerHTML
but none of the information ends up in the proper fields and, as far as I
can tell, the script is failing to properly assign the objIE object. Could
someone give me a clue as to what might be wrong?
Thanks,
Tom S.
--
Talent hits a target no one else can hit; Genius hits a target no one else
can see.
-- Arthur Schopenhauer Tag: Adding a site to the Intranet Zone Tag: 159598
How to overwrite target file no prompt?
I save .xls file with "saveAs" method,
for example.
ThisApplication.ActiveWorkbook.SaveAs("C:\MyWorkbook.xls")
But ,Because the file of the same name exists in the goal position
system always asks me whether I overwrite it.
How to overwrite target file no prompt,save directly?
Thank in advance.
-- Tag: Adding a site to the Intranet Zone Tag: 159596
VBScript and Standby mode
This is a multi-part message in MIME format.
------=_NextPart_000_000A_01C456AC.A9CFFB80
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
My computer (running XP Home) is set to enter standby mode after 20 =
minutes of inactivity.=20
I have a background (vbscript) script running, which works in =
conjunction with a background activex object (that makes a couple of API =
calls), that works fine when the computer is 'active', so to speak, but =
fails mysteriously (stopping wscript.exe ) without error message =
whenever the computer enters standby mode.
Can anyone think of a reason that the script fails as soon as standby =
mode sets in (bearing in mind that other applications running resume =
functioning just fine after rewaking the computer) or failing that is =
there a test within a script that can determine whether a computer is =
awake or not?
Thanks for any pointers in the right direction
Jon
------=_NextPart_000_000A_01C456AC.A9CFFB80
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.1400" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial>My computer (running XP Home) is set to enter =
standby mode=20
after 20 minutes of inactivity. </FONT></DIV>
<DIV><FONT face=3DArial></FONT> </DIV>
<DIV><FONT face=3DArial>I have a background (vbscript) script running, =
which works=20
in conjunction with a background activex object (that makes a couple of =
API=20
calls), that works fine when the computer is 'active', so to =
speak, but=20
fails mysteriously (stopping wscript.exe ) without error =
message whenever=20
the computer enters standby mode.</FONT></DIV>
<DIV><FONT face=3DArial></FONT> </DIV>
<DIV><FONT face=3DArial>Can anyone think of a reason that the script =
fails as soon=20
as standby mode sets in (bearing in mind that other applications running =
resume=20
functioning just fine after rewaking the computer) or failing that is =
there a=20
test within a script that can determine whether a computer is awake or=20
not?</FONT></DIV>
<DIV><FONT face=3DArial></FONT> </DIV>
<DIV><FONT face=3DArial>Thanks for any pointers in the right=20
direction</FONT></DIV>
<DIV><FONT face=3DArial></FONT> </DIV>
<DIV><FONT face=3DArial>Jon</FONT></DIV></BODY></HTML>
------=_NextPart_000_000A_01C456AC.A9CFFB80-- Tag: Adding a site to the Intranet Zone Tag: 159595
Weird VBscrip Win2k explorer problems
Hello All,
Well my issue is my inventory script which I have made from other peoples
scripts and modified for my own use is having some issues on our desktops.
Little about our environment, Windows 2000, SP3 & SP4 with most patches
applied.
And worm patches etc. mostly our users aren't & can't be local
administrators of there machines.
Anyway I originally had a VBScript which did the inventory but I was having
the following problems so I tried making a KIXTART Script which also made
the exact same problems as described below.
1) Logged on as a normal user the PC's Internet Explorer 6 w/sp1 works first
time then you close the app and open it again and it says "Detecting proxy
settings" and just sits there forever and you have to reboot again for it to
work. If you're lucky.
2) After the internet explorer starts playing up I can't get into control
panel its like the whole "explorer" craps out.
3) The Computer generally becomes unstable, App's play up Outlook doesn't
work media player etc.
4) If I load a patch on the machines which is MS04-011 Latest updates.
(May/June) I think it is, and make the user a local administrator everything
's fine. If I load this patch and don't make the local user an administrator
it still doesn't work properly ie: Media player doesn't load internet
explorer and explorer still has issues.
Making all our users local Admin's isn't an option for us. So I'm guessing
it has to be something with the script which is causing the hassle.
Or something I'm doing somewhere, So I had my kix script checked out and its
fine apparently and the VB Script works perfect on a number of machines but
then I hit a number of pc's which It doesn't work and causes the problems
above. But once you disable to script at logon. The machine is perfect so it
's defiantly something strange when running these scripts but the scripts
are fine..
All the scripts basically do is some WMI Queries and other Reg Queries
nothing real hi-tech but it seems to make the machine unstable..
If any of you can think of anything that might be contributing to this issue
please let me know! Btw: I'm using kixtart 2001 4.21 and I've tried updating
to Windows Scripting host 5.1 I think the latest, Still the same problems.
Thanks,
Quenten Tag: Adding a site to the Intranet Zone Tag: 159594
Newbie, How to pass data from one vbscript to another?
I have a vbscript that I would like to call from another script and at the same time pass some data of various types from the "calling" script - is that possible?
What I would like to achieve is exactly what a function does, only that instead of referring to the function's name, I would like to be able to refer to a script file and pass my variables to that
I come from an Macintosh/AppleScript background and there one could use:
"run script [path to script] with parameters [the parameters you like] "
Is that possible in vbscript? Or if not, Is there any other easy of achieving the same effect.
All suggestions are much appreciated
/ Richard Tag: Adding a site to the Intranet Zone Tag: 159593
Is it possible to add a site to the Intranet Security Zone on a remote users
computer?