Linking Scripts
Hi
Since many of my .htm pages use the same scripts I store them in a textfile
(.inc) in a separate "_Script" directory.
The main reason for this (besides making the code easier to maintain) is
that I don't want the users to by able to see what the scripts are doing.
I use the following syntax to link the scripts:
<Script Language="VBS" SRC="../../_Script/Utils.inc"></Script>
The Script tag is also present in the Utils.inc file.
On my localhost this works fine, on the webserver this produces a Type
mismatch error.
Any ideas?
PO Tag: GPO's Tag: 166560
remembering the link that was clicked
On my site the homepage is accessible by all. The other pages need a password.
When a visitor clicks a link, they get redirected to the login page instead
of the page that they want to see. That part is under control.
If they provide the right password, they need to be sent to the page that
they clicked. How do I do that?
I'm using ASP and Access. Tag: GPO's Tag: 166556
Easy (?) One - Fill Frame and Print
Hi.
I've got a button that uses Window.MyFrame.Location = "page2.html" to display a page within a frame. Works no problem. However, as apart of the same button click, I want to print the new frame content using Window.MyFrame.Print. Unfortunately, if before my button is clicked, MyFrame is displaying "page1.html", that is the page that gets printed, THEN "page2.html" is displayed.
Is there a way to refresh the frame to get it to display "page2.html" before the print command fires? If not, is there a convenient work-around?
Thanks, Terry
**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources... Tag: GPO's Tag: 166549
SQL-DMO reference
Hi,
I am interested in a good SQL-DMO reference. I have solved my issues so far
by searching help in Visual Studio 2003 and finding code snippets; however,
rather than finding the magic line of code to do what I want, I would like
to see a hierarchical reference of the different SQLDMO objects, their
methods and properties, etc., etc. I can not seem to find it. Can anyone
help?
Thanks in advance,
Chris Hough Tag: GPO's Tag: 166545
Sorry
Could someone please tell me why this is not working, sorry for the question.
@echo ON
CD C:\Program Files\SiteSafe\MAPX
COPY F:\DATA\MAPS\MapX.exe
This is my first batch file, I just need to copy the MapX into the previous
directory.
Thanks. Tag: GPO's Tag: 166543
Toolbar visibility problem with Excel in WSH running vbscript
I am writing a vbscript running under WSH which starts Excel and
writes some stuff into some cells. This all works just fine. I am
using Excel as an output window for the script because it is easy to
do and its easy to format the data. However, there is no need to
display the toolbars, formula bar, and status bar in my Excel output
window. I am able to turn these off with vbscript code.
Here is my problem. When Excel terminates, by the user clicking the
red X to close the window, Excel remembers that the toolbars, formula
bar, and status bar were not visible. The next time the user launches
Excel to do his own thing, all he sees is the menu bar. He must
manually make the other bars visible again.
I have not been able to come up with a solution to this problem. If
vbscript could sit in a loop waiting for the user to close the Excel
window that the script created, I could then open another hidden Excel
window and reset the visibility of the hidden bars. However, I cannot
figure out how to detect when the Excel window is closed.
Creating a VBA Excel macro to reset the visibility of the bars is not
practical since my script will be distributed to a large number of
users and I don't want to mess with that sort of thing. The solution
must be contained within the vbscript program.
Any suggestions as to how I can restore the visibility of the hidden
bars would be appreciated.
By the way, is there a way to turn off the menu bar as well? I really
don't need that either. Tag: GPO's Tag: 166530
ASP - pivot table
Hello all!
I have the following problem. Is it possible to display a text using ASP
which is a pivot table. I mean,
GROUP 200401 200402 200403 200404
GR_1 1 2 3 5
GR_2 4 1 5 3
GR_3 9 7 8 7
How to achieve such display while source data looks like this???:
GROUP WEEK VALUE
GR 1 200401 1
GR 1 200402 1
GR 1 200402 1
GR 1 200403 3
GR 1 200404 5
GR 2 200401 4
GR 2 200401 1
....
VALUE in the pivot table is a sum of VALUE.
Kind regards
Thank you in advance for your help
Marcin Tag: GPO's Tag: 166528
How to get the company name in Windows?
Hi, all,
in vbs the owner name of windows can be read or written. But how can
one do the same with company name? I mean with owner and company
the description one can receive in Windows explorer through "info":
...licenced for
{owner}
{company}
Many thanks
--
Weichao Wang Tag: GPO's Tag: 166522
Alternative to http-referer
Hi
I run a website that has authentication "provided" by another site -
basically we supply a username, password and destination page to the
other site and, once the user is authenticated, they get put on the
page on our site they originally requested (this is a client
requirement so there's no changing it).
This had been working fine until XP SP2. We've been using
Request.ServerVariables("HTTP_REFERER")
to check the referer, but now IE (only on XP SP2) returns an empty
string. Other browsers (NS, FF) return the referer. I created just to
show the referer string to confirm this and indeed the page was blank.
Funny thing is if I refresh that page, the original referer shows up!
Ayway, I now need some alternative way to find out the referring
domain that will accommodate IE XP SP2.
Any ideas?
Thanks Tag: GPO's Tag: 166519
Returning my own completion code from a VbScript
Hi,
I would like to have two scripts, one of which calls the other, and have the
one that is called return a status value (set by the called script) to the
caller.
I assume I must use either Run or Exec from my 'master' script. True ?
Is there some way of using ExitCode for my purpose?
Thanks in advance,
Chris Hough Tag: GPO's Tag: 166518
Altering an Add User script to Add Contact script for Active Directory import
Hi,
I found the below script which allows me to import Users into AD from an
Excel file:
http://www.rlmueller.net/CreateUsers.htm (about the VBScript)
http://www.rlmueller.net/Programs/CreateUsers.txt (the code)
I've managed to get this working so it creates a User in my domain, but I
need to alter this so it creates a Contact instead. Can anyone tell me how
to do this? My knowledge of scripting is VERY basic so the more detail you
can give me the better.
Thank you,
Curtis.
====================================
When replying by email please remove the X
==================================== Tag: GPO's Tag: 166517
VB-script multiple return or reference type?
Hello all,
I want to bring VB scripting support to my MFC aplication. Therfore I need
to provide COM interface to my C++ functions. Now the problem seams that VB
script does not provide reference types or pointers. But how can I have a
function in VB-script that modifies more than one variable and retuns it to
the calling function?
Like C++ function:
void MyFunction(int iValue, int &iWillModifyA, long & lWillModifyB);
How can I express this in VB-script?
Best Regards
Thomas Tag: GPO's Tag: 166515
Exchange General
Hello, Anyone knows how to make a script to automatically create a outlook
configuration in a machine ? For example, a new user was created, and I have
to create his profile on the user's machine. But I always have to configure
his account on Outloolk XP for our Exchange 2000. This script have to put the
username logged in, exchange host name server and save it.
Tnks for any help. Tag: GPO's Tag: 166511
Re: Help Finding a Good eCommerce and Project Book
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft DHTML Editing Control">
<TITLE></TITLE>
</HEAD>
<BODY>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">Hi Tom!<SPAN
style="mso-spacerun: yes"> </SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"> <?xml:namespace prefix = o
ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">I hope this makes it to you.<SPAN
style="mso-spacerun: yes"> </SPAN>I will send a few times to be sure you
get it!</P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"> <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">The URL for the book you are
looking for is below.<SPAN style="mso-spacerun: yes"> </SPAN>Yes, it?s a
good resource, and it?s cheap!<SPAN style="mso-spacerun: yes"> </SPAN>We
use it for our Entrepreneur clientele projects, and it has saved us a lot of
time, and I?m sure money too!</P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"> <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">Best regards,</P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">Randy</P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"> <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><A
href="http://www.wiremarkltd.com/gybol/book.html">http://www.wiremarkltd.com/gybol/book.html</A></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"> <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"> <o:p></o:p></P>
<DIV
style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1.5pt solid; PADDING-TOP: 0in; BORDER-BOTTOM: medium none">
<P class=MsoNormal
style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-border-left-alt: solid black 1.5pt; mso-padding-alt: 0in 0in 0in 4.0pt"><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"> <o:p></o:p></SPAN></P></DIV>
<DIV
style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: black 1.5pt solid; PADDING-TOP: 0in; BORDER-BOTTOM: medium none">
<P class=MsoNormal
style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt 3.75pt; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-border-left-alt: solid black 1.5pt; mso-padding-alt: 0in 0in 0in 4.0pt"><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">----- Original Message -----
<o:p></o:p></SPAN></P>
<P class=MsoNormal
style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; BACKGROUND: #e4e4e4; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt 3.75pt; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-border-left-alt: solid black 1.5pt; mso-padding-alt: 0in 0in 0in 4.0pt"><B><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">From:</SPAN></B><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"> Tom Jeffers <o:p></o:p></SPAN></P>
<P class=MsoNormal
style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt 3.75pt; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-border-left-alt: solid black 1.5pt; mso-padding-alt: 0in 0in 0in 4.0pt"><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">November 29, 2004 3:37
PM<o:p></o:p></SPAN></P>
<P class=MsoNormal
style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; MARGIN: 0in 0in 0pt 3.75pt; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-border-left-alt: solid black 1.5pt; mso-padding-alt: 0in 0in 0in 4.0pt"><B><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Subject:</SPAN></B><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"> Help Finding a Good eCommerce and
Project Book<o:p></o:p></SPAN></P></DIV>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"> <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">Hello,</P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"> <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">Can anyone tell me where I can
find the eBook Getting Your Business Online?<SPAN
style="mso-spacerun: yes"> </SPAN>If I remember correctly it was compiled
by individuals working for a consulting company, but I do not recall which
one.<SPAN style="mso-spacerun: yes"> </SPAN>We used the book for a lot of
our web development and software projects at my other job, and I think a few of
the construction or building companies we worked with used the project
management section for their projects.<SPAN style="mso-spacerun: yes">
</SPAN>The book was an invaluable project tool, was very easy to read and
understand, and covered just about everything you could imagine!<SPAN
style="mso-spacerun: yes"> </SPAN>I?m sure someone out there has seen or
heard of it.<SPAN style="mso-spacerun: yes"> </SPAN>I would like to review
this book before I plan to go online with a business I am starting.<SPAN
style="mso-spacerun: yes"> </SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"> <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">Any help would be greatly
appreciated!</P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"> <o:p></o:p></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">Thanks!</P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt">Tom</P>
<P> </P>
</BODY>
</HTML> Tag: GPO's Tag: 166506
Invalid CurrentPageIndex value problem ! Urgently
Hi all,
I have to using 2 radiobuttons to control 2 datagrid summay and detail
representively. when I click detail radionbutton, there are 10 pages records.
when I click summary radiobutton, I select 3rd pages it display the following
error. In the summary report just only 1 page record.
"System.Web.HttpException: Invalid CurrentPageIndex value. It must be >= 0
and < the PageCount. "
Would you like to please give me instruction how to handle this error ?
Please comment. Tag: GPO's Tag: 166504
Creating a log file of a vbscript's activity
Hi guys,
Id like to be able to generate a log file that pumps out all the steps that
a vbscript does.
Similar to using a batch file >> log.txt
And all errors.
Can someone steer me in the right direction?
Thank you.
Simon Tag: GPO's Tag: 166501
Script Encoder Error: "Expected Statement"
SCENARIO:
I have a very simple application that queries a database.
All my web pages are .ASP files.
I was able to successfully encode all the files.
Each file starts with the <% @LANGUAGE="VBScript"%> statement.
WHEN I RUN THE APPLICATION:
I get the following error:
"Expected Statement" line 2.
Line2 happens to be the first statement following the LANGUAGE
statement note above. So I tried removing this line of code and
re-encoding....SAME problem.
WHO HAS A "REAL" ANSWER?
I've seen posts in here talking about "VBS" and "VBE" files and
statements such as <script language="vbscript"
scr="file1.vbs">......but these make no sense to me? I saw a posting
from a Microsoft fellow that indicated that all encoded files had to
be "renamed" to "vbe" file extensions.
Well guess what? That doesn't work either. My host (localhost on a
Win2K SP4) doesn't interpret the .VBE file and instead prompts me with
a "download" dialog.
HELP:
What gives? My code is fine. The files are encoded correctly (from
what I can see). It just seems that the host can't interpret the
encoded files now.
????????????????????? Tag: GPO's Tag: 166496
Sample to check share, set up share
Hi,
I am not familiar with much of WSH, and would like to see a sample script or
scripts that:
1) Checks to see if a given network share exists
2) Delete a network share
3) Create a network share
4) Move files to the recycle bin (as opposed to deleting them)
I am trying to use WshShell.Exec with the DOS net share command but the
correct syntax and error handling eludes me.
Are there any other objects I could use that would make this task easier?
For example, I have been able to find and use SQLDMO objects to do things
like backing up and restoring SQL Server databases.
I would appreciate any pointers to useful samples or books.
Thanks in advance.
Chris Hough Tag: GPO's Tag: 166494
true false in quotes?
Hi,
Are there any rules for using or not using quotes around true or false.
Witness the following: (Hold the alt key and click the document)
<html>
<head>
<script language=vbs defer>
sub document_onclick()
if d1.contentEditable=true then 'doesn't work
msgbox "d1.contentEditable=true"
else
msgbox d1.contentEditable=true
end if
if d1.contentEditable="true" then 'works
msgbox "d1.contentEditable=""true"" "
else
msgbox d1.contentEditable="true"
end if
if window.event.altKey=true then 'works
msgbox "window.event.altKey=true"
else
msgbox window.event.altKey=true
end if
if window.event.altKey="true" then 'doesn't work
msgbox "window.event.altKey=""true"" "
else
msgbox window.event.altKey="true"
end if
end sub
</script>
</head>
<body>
<div id=d1 contentEditable=true> </div>
</body>
</html> Tag: GPO's Tag: 166493
WMI Survey
Folks,
For those of you using WMI today or just knowing a bit about it, please
participate to the survey and spread the word about it!
Survey life link is at:
http://support.microsoft.com/common/survey.aspx?scid=sw;en;1236&p0=&p1=&p2=&p3=&p4=
As you may know, this survey is very critical for Microsoft to correctly
prioritize new features, updates, etc. Please participate and spread the
word !
Many Thanks.
Have a great day!
Alain LISSOIR
--------------------------------------------------------------------------------
Alain.Lissoir@LissWare.Net
Home Page: http://www.LissWare.Net Tag: GPO's Tag: 166489
Open Files
hi,
i need to know who is connected to some file on my server, i try to make
this but i can't; i'm wait for your help
thank Tag: GPO's Tag: 166481
ADODB.Recordset: Operation is not allowed when the object is closed
Hi there
I get the above message when trying to write to a SQL 2000 database. Can
anyone perhpas shed some light on this for me?
In theory I am tryng to create a generic subroutine which I can simply pass
my INSERT/UPDATE/DELETE statements to, and then have it executed. The
following subroutine gets called for each server that I am running through.
The error above is returned on the line "objRecordSet2.Close"
My code excerpt is as follows:
Sub AccessDB()
' Set the database connection information
sServer = "test"
sLogin = "logon"
sPwd = "pwd"
' Create the ADO Connection and Recordset objects.
Set objConnection2 = CreateObject( "ADODB.Connection" )
Set objRecordSet2 = CreateObject( "ADODB.Recordset" )
' Set the connection string, open the connection and execute the statement
objConnection2.ConnectionString = "PROVIDER=SQLOLEDB" & _
";SERVER=" & sServer & _
";UID=" & sLogin & _
";PWD=" & sPwd & _
";DATABASE=ServerSupport"
WScript.Echo & SQLString
objConnection2.open
objRecordSet2.Open SQLString, objConnection2
objRecordSet2.Close
objConnection2.Close
End Sub Tag: GPO's Tag: 166480
UDL File
Hi All.
I have a very basic doubt.
How, in the name of GOD, I create a UDL file that works, using
vbScript?!
I've been trying to accomplish that usign FileSystemObject with no
success...
Thanks in advance!!
Rodolfo
Sao Paulo - BR Tag: GPO's Tag: 166477
changing existing local user flag "never expires"
Hello
I'm searching for a usable script to change the flag "password never
expires" on two local users.
No domain, no OU, or so - simple local accounts.
System is Windows XP Prof SP2
I found two scripts - no one seems to work for me.
Script 1:
Set objUser = GetObject("WinNT://image/trulli")
objUserFlags = objUser.Get("UserFlags")
objPasswordExpirationFlag = objUserFlags OR ADS_UF_DONT_EXPIRE_PASSWD
objUser.Put "userFlags", objPasswordExpirationFlag
objUser.SetInfo
Script 2:
Const ADS_UF_DONT_EXPIRE_PASSWD = &H10000
Set objUser = GetObject("WinNT://image/trulli,user")
lngFlags = objUser.Get("userFlags")
If (lngFlags And ADS_UF_DONT_EXPIRE_PASSWD) <> 0 Then
lngFlags = lngFlags Xor ADS_UF_DONT_EXPIRE_PASSWD
objUser.Put "userFlags", lngFlags
objUser.SetInfo
End If
Both scripts runs on doubleclick without error, but the flag seems not
been set.
System/User/Properties.... is the flag unchecked after the scripts.
What can i do?
Greetings
Chris Tag: GPO's Tag: 166474
If Not Debug Then
Hi,
I am trying to use 'If Not' condition when the variable = 0.
Debug = 0
If Not Debug Then
Wscript.echo "hi"
End If
In this we VBS will step into the condition. Is there a way like in 'c'
language to use if(!Debug) ? Tag: GPO's Tag: 166466
Windows Image Acquisition (WIA) Automation Resources?
Hi,
Does anyone know of any good resources (books, websites other than MSDN, or
newsgroups) for Windows Image Acquisition (WIA) Automation?
I'm having trouble getting it working, and the info on MSDN isn't working
for me.
Thank you,
Robert Tag: GPO's Tag: 166462
How can I get computer name
Hi there
Does anyone knows how can I get the computer name in a workstation domain
where there is no login at the server and then pick up all the computers
name's one by one and create a directory in a shared directory at the server
with the same the of the clients computer's?...
I hope someone could help me out with a script that have already made or
give me some tips.
Thanks
Nuno Tag: GPO's Tag: 166458
ASP, looping, and stored procedures.... error '800a0bb9' ...
Hi all, thanks in advance.
Ok, heres the story.
What is happening......
--------------------------------
I've got an ASP page that loops.
It loops in order to get data in different, sequential date ranges. I.E.
from 9/1/2000 - 10/1/2000 then 10/1/2000 - 11/1/2000 etc etc etc.
It calls SPs using the 2 dates and an integer used for companyid reference.
Let's just do this for 2 SP's (there are like 6 on the page.)
One SP has 3 params, one has only 2.
Now, the first iteration of the loop, it works. (because I'm
response.writiting out the dates it's using to verify they are ok.
The second time through I get the following error when I try to execute the
following ASP:
Set rstStoredProc = cmdStoredProc.Execute(, Array(GroupChoice, fromdate,
todate))
______________________________________________
ADODB.Command error '800a0bb9'
Arguments are of the wrong type, are out of acceptable range, or are in
conflict with one another.
_______________________________________________
What I need to do.........
--------------------
In the loop, I am trying to reuse my command/connection objects instead of
reinstantiating them for each iteration of the loop.
***Currently, it must use ODBC not OLEDB so keep that in mind.***
Here's the code for the SP's
--------------------
CREATE Procedure proc_getPageHits
(
@GroupID int,
@FromDate datetime,
@ToDate datetime
)
As
SELECT sum(counter) as hitcount
FROM tblTracking
WHERE CreateUserID in (select UserID from tblUser where GroupID=
@GroupID)
and (CreateDate between @FromDate and @ToDate)
GO
CREATE Procedure proc_getUserCount
(
@GroupID int,
@ToDate datetime
)
As
SELECT count(UserID) as usercount
FROM tblUser
WHERE (GroupID = @GroupID) and (CreateDate < @ToDate)
GO
Here's the ASP
----------------------------------------------
Set cmdStoredProc = Server.CreateObject("ADODB.Command")
cmdStoredProc.ActiveConnection = dbConn
do while DateCompare(currentsearchdate,todaysquarterend) = "smaller"
cmdStoredProc.CommandText = "Proc_getUserCount"
cmdStoredProc.CommandType = adCmdStoredProc
Set rstStoredProc = cmdStoredProc.Execute(, Array(GroupChoice, todate))
cmdStoredProc.CommandText = "Proc_getPageHits"
cmdStoredProc.CommandType = adCmdStoredProc
Set rstStoredProc2 = cmdStoredProc.Execute(, Array(GroupChoice,
fromdate, todate)) '(**THIS IS WHERE IT ERRORS**)
loop
----------------------------------------------
Why does it error on the SECOND procedure of the SECOND iteration of the
loop?
It makes it past the first loop ok.
Then it makes it past the first SP of the second loop but errors in the
second SP....??...
The dates are verified correct and in format.... so what the heck is the
prob?
If I re-create the command object each iteration (i.e. put the Set
cmdStoredProc = Server.CreateObject("ADODB.Command") line inside the loop)
it works fine. but it's so much slower. The results of the page are coming
back in 13seconds. (there's alot more calls and alot more stuff going on,
but these procedures should pick it up a bit.
Also, if you have any suggestions on the SQL select statements, feel free to
enlighten me. I am using the 'IN' method whereas some people have told me of
the 'where exists' SQL method. I have not received any examples though.
Thanks again in advance.
-Beau
www.worlddoc.com Tag: GPO's Tag: 166442
Outlook Scripting
We have recently moved our internet email from an SMTP server to our exchange
server. Now we have the task of removing the service from every user's
profile. Is there a way to do this using some form of scripting? We are
already running many scripts here and I would love to write one to do this.
Touching each individual machine is not something I would prefer to do.
Thanks in advance for your assistance. Tag: GPO's Tag: 166439
how to bypass a known-bad SSL certificate
I'm writing a VBScript to download some content from a number of internal
webservers. I'm downloading both secure (https) and non-secure (http)
content. One of these webservers (a test machine) has a number of problems
with its SSL certificate, not the least of which is that the certificate has
expired. Every time my script tries to download from the webserver with the
bad SSL certificate, Windows helpfully gives me a warning dialog that I must
click through before the script can continue. Is there any way to avoid
this warning for a specific certificate and/or webserver? I'm aware that
the certificate has issues, but it won't be replaced and/or renewed any time
soon (largely because it's on a test machine), so how can I work around it?
I have already tried:
* adding the site to Internet Explorer's "Trusted Sites" (didn't help)
* changing the system date to a period before the certificate expired when
accessing the problem webserver, then changing it back afterward (still saw
the warning dialog, because of another problem with the certificate)
I am using WSH 5.6 on WinXP SP2, with MSXML 4.0 SP2.
Code follows:
Sub CheckLink(strURL, strOutput)
Dim objHTTP, objStream, tStart, tElapsed
Set objHTTP = WScript.CreateObject("MSXML2.XMLhttp.4.0")
objHTTP.Open "HEAD", strURL, False
objHTTP.Send
WScript.Echo "Headers from " & strURL
WScript.Echo objHTTP.getAllResponseHeaders
WScript.Echo
objHTTP.Open "GET", strURL, False
objHTTP.Send
tStart = timer()
Set objStream = CreateObject("ADODB.Stream")
objStream.Type = adTypeBinary
objStream.Open
objStream.Write objHTTP.ResponseBody
objStream.SaveToFile strOutput, adSaveCreateOverWrite
Set objHTTP = Nothing
Set objStream = Nothing
tElapsed = timer() - tStart
WScript.Echo "Saved: " & strURL & vbCRLF & "To: " & strOutput & vbCRLF &
"Time: " & tElapsed & " seconds..." & vbCRLF
End Sub
Any assistance would be greatly appreciated!
Rob Shaw-Fuller
robshawfuller@hotmail.com Tag: GPO's Tag: 166438
Check if connected using Terminal Services
Hi,
I would like to create a script which is able to check if it is being run in
an terminal service session.
It should only be allowed to run locally and not remotely.
Anyone any ideas?
Many thanks,
Jo Tag: GPO's Tag: 166437
get File from "C:\"
Hi@all
i use the Function
[code]
set oShell = CreateObject("Shell.Application")
set oFolder = oShell.BrowseForFolder(0, "File load", 16384,rootdir)
[/code]
on a HTML Page
and if i try to get a file from "c:\" or "d:\" (no subfolders), i get a
error.
What can i do, ca i use a other function to get the file or ???,
thx for help,
cya Thommy
(sorry my english is not the best) Tag: GPO's Tag: 166432
formating a date string in vbscript
how can I get a date in the following format
dd-mmm-yyyy
ie 01-APR-1999
in visual basic I can use the formatdate function and the formatting
is flexible enough to create this string. In vbscript the
functionality seems more limited. Is there a simple way to do this?
thank you for your help
cheers
john Tag: GPO's Tag: 166422
is it possible to lock desktop (like you can from task manager) with vbscript?
I bet it is and I have done a search but found nothing. Anyone do
this? Seems like I saw a script a long time ago to do this. I just
want to duplicate the functionality of [ctrl-alt-del/task man/lock
workstation] and I am not looking to write a whole passworded screen
saver app or anything.
Thanks all! Happy Turkey day! Tag: GPO's Tag: 166419
Return code=0 even if runtime error
The code:
File.Copy(FichierCible)
Produce this error:
C:\win32app\exploit\HFTrader-PDL\HFTPDL.vbs(89, 4) Microsoft VBScript
runtime error: Path not found
But the return code of the script is 0.
I can handle this specific error with the "on error" clause but how can I
do to exit with a return code <> 0 when i have an unhandled error? Tag: GPO's Tag: 166410
Executing a batch file only if the laptop is located on a particular subnet.
Hi guys,
Hope you can help.
Requirement/s:
- Back up a folder on a laptop daily to a network location.
- Only run the backup task IF the user is located on subnet 10.60.10.x, Id
like the script to be able to check for a network connection, and if none,
to abort the running of the backup.
- System in question is a laptop that gets a DHCP address.
I can generate the backup script, but what Id like help si the following:
1. How to code the script so that it only runs IF the laptop is given a DHCP
address of 10.60.10.x and not another DHCP address, meaning it is on a
different subnet
2. If the user is not connected to the LAN, and the task runs, to not run
the script at all. That is, Id like the script to be able to check for a
network connection, and if none, to abort the running of the backup.
Any help would be greatly appreciated.
Thank you..
Simon Tag: GPO's Tag: 166407
Getting multiple selected items from ListView
Hi,
I'm facing a problem, in multiselect listview control I'm not able to get
all the selected items in it.
Please let me know how can I do it using VBScript.
Thanks. Tag: GPO's Tag: 166406
Creating share on Home-directory : fails on workstation ... works on server ...
Hi all,
I'm writing a GUI-application whixh is in fact the program which
'replaces' the User Manager in our shops.
So, It works almost ... just a last 'problem'.
In fact, when creating a user, I create also the Home-directory and a
share on the folder (all created on the server).
The application runs as well on the server as on the workstations. We
work with Server 2003 / XP.
I can create the home-directory and share when the application runs on
the server.
But when it runs on the WORKSTATIONS, I CAN'T create the SHARE.
An error does always occur !
Does anyone has an idea why it doesn't work ?
I'm looking for a 'script'-solution : I mean, I do not want to use
some 'external' EXE's like RMTSHARE.EXE (if possible).
Here's the code :
For the folder :
On Error GoTo ERROR_HANDLING
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.CreateFolder(as_folder) 'UNC-name like :
'\\S099C01\Home$\test001'
For the share :
On Error GoTo ERROR_HANDLING
Set objWMIService = GetObject("winmgmts:" &
"{impersonationLevel=impersonate}!\\" & as_server & "\root\cimv2")
Set objNewShare = objWMIService.Get("Win32_Share")
nReturn = objNewShare.Create(as_directory, as_sharename,
FILE_SHARE, Null, as_comment)
'with 'as_server' is the servername : ex. : 'S0999C01'
' 'as_directory' is the LOCAL path on the server : ex. :
'U:\Home\test001'
If nReturn <> 0 Then
Select Case nReturn
...
End Select
Else
End If
Thanks,
Marc. Tag: GPO's Tag: 166404
parsing
Hi,
I've some textfiles which i would like to import. In one textfile there are
over 1024 columns when separated. This exceeds sql server's maximum columns.
Let call this the resultfile.
In the other texfile i've got a descriptionfile about the resultfile. The
description contains the columnnames of the resultfile (see below for
example). The problem with the resultfile is that it doesn't contain any
columnnames, but the columns appear in order of the descriptionfile.
The tricky part is that there are columns which really represents 1 column
(those columns has the same name but with an indexnumber). The values in
those columns need to be changed into the indexnumber, but start from zero.
Then data should be transformed
For example (never mind the values):
id | field1_1 | field1_2 | field2 | field3
1 | empty 1 1 2003
Above should be:
id | name | value
1 field1_1 | empty
1 field1_2 | 1 (should be 2, but i want i the index to start from 0, so it
is 1)
1 field2 | 1
1 field3 | 2003
Descriptionfile example:
formid fieldnr fieldname idx length
1 1 field0 0 2
1 2 field1 1 1
1 3 field1 2 1
1 4 field2 0 2
1 5 field3 0 4
Can someone help me on this, i want to use a vbscript in a sql dts package?
This bustin my brains for weeks Tag: GPO's Tag: 166394
Trip to Disney
GET YOUR TRIP
TRIPS TO DESNEY
TRIPS TO HAWAII
http://travelexpert2004.us
http://travelexpert2004.biz
http://gotraveling85.us Tag: GPO's Tag: 166391
Edit/Delete section of an ini file
I need to write a string value to a section of an ini file. I managed to
write to it but it appends to existing values. I need to either edit the
current value or delete the values in the section in question before I write
new values
For example:
file ="C:\VBS\myConfig.ini"
Section = "ORACLE TO SQL SERVER"
item = "CASE_X"
Value = "XYZ"
ini file output:
[ORACLE TO SQL SERVER]
CASE_X=ABC
CASE_X=XYZ
CASE_X=XYZ
DB_NAME=YYY
LSNAME=orclDB
DTSERROR_O2S="C:\sqlConfig\dtsError\orcl_2_mssql\xxx.txt"
How do I edit the original value of ABC to XYZ without having to write new
lines as I need only I line for CASE_X Values. Any input would be greatly
apreciated
--
fhillipo Tag: GPO's Tag: 166389
way to put clipboard information into file txt....please
hello,
i would like to know if it's possible to put clipboard information into file
txt or worksheet excel cell.
i m beginner in vbscript and i don't understand how to make object and
class....etc.
My code is :
Set Fmobject = CreateObject("Scripting.FileSystemObject")
Set Fm1 = Fmobject.createtextfile("c:\text.txt") 'création file txt
Text = "hello, i'm french " 'i would like past the clipboard information
Fm1.WriteLine (Text)
Fm1.Close
thank for your help !!! Tag: GPO's Tag: 166387
Way to recursively Find pre-defined files (from list) and Copy to new Dir?
Hi - haven't had any luck finding this type of script:
1. I have a pre-defined list of filenames (stored in a plain txt document
called 'files.txt')
2. I'd like to write a script that will search the file system For each
file in the plain txt document (could be nested in sub-directories) and copy
them to a new location
I've found plenty of examples for finding types of files (i.e. .mp3's,
.zip's, etc.) but nothing that will let me pass in specific (& unique)
filenames.
Thanks for your help! Tag: GPO's Tag: 166369
Interrogating Active Directory Computers
Hi,
The problem is that the script stops (in error) when a computer is not
powered on.
I want the script to move on to the next computer in the active directory.
Maybe I can test on a pingresult ? But how to implement a ping ?
And what is the exactly output when a computer i powerd on ?
Greetz,
Wim.
'*********************************************
'*
'* Search adressbooks in Active Directory computers, via FileSystemObject
'*
'*
'**********************************************
on error resume next
Dim objDSE, strDefaultDN, strDN, objContainer, objChild
Dim Fso, Drives, Drive, Folder, Files, File, Subfolders,Subfolder 'First
of all, you have declare the variables and create the FileSystem object.
Dim strComputer
'***************************
' Create Excel File
'***************************
Set objExcel = WScript.CreateObject("Excel.Application") 'Create Excell
file
objExcel.Visible = True
objExcel.Workbooks.Add
objExcel.ActiveSheet.Name = "Adresbooks"
objExcel.ActiveSheet.Range("A1").Activate
objExcel.ActiveCell.Value = "PC" 'col header 1
objExcel.ActiveCell.Offset(0,1).Value = "Location 1" 'col header 2
objExcel.ActiveCell.Offset(0,2).Value = "Location 2" 'col header 3
objExcel.ActiveCell.Offset(0,3).Value = "Location 4" 'col header 2
objExcel.ActiveCell.Offset(0,4).Value = "Location 5" 'col header 2
objExcel.ActiveCell.Offset(1,0).Activate 'move 1 row down
'***************************
' Run through Active directory
' searching for computers
'***************************
Set objDSE = GetObject("LDAP://rootDSE")
strDefaultDN = objDSE.Get("defaultNamingContext")
strDN = InputBox("Enter the distinguished name of a container" & vbCrLf &
"(e.g. " & strDefaultDN & ")", , strDefaultDN)
If strDN = "" Then WScript.Quit(1) 'user clicked Cancel
Set objContainer = GetObject("LDAP://" & strDN)
Call ListUsers(objContainer)
wscript.echo "Script finished"
Sub ListUsers(objADObject)
Dim objChild
For Each objChild in objADObject
Select Case objChild.Class
Case "computer"
strComputer=objChild.cn
'wscript.echo strComputer
AdresboekZoeken(strComputer) 'search adressbook
Case "organizationalUnit" , "container"
Call ListUsers(objChild)
End select
Next
End Sub
'****************************************
'Search adressbook on remote computer
'****************************************
Sub AdresboekZoeken(Computer)
Set Fso=createobject("scripting.filesystemobject") 'Then, Set the Drives
object, so you can search in all the available drives of the computer
Set Drives=fso.drives
pc= "\\" & computer & "\c$"
wscript.echo pc
Dosearch pc 'Dosearch is the name of the function that we'll use to
search for files and subfolders.
wscript.echo "Finished searching on pc " & computer
End Sub
Function Dosearch(Path)
Set Folder=fso.getfolder(path) 'Get the folder where we have to work.
Set Files = folder.files 'Get all the files inside this folder
For Each File in files 'File is the current file where we are 'Now do a
for-each for each file
'wscript.echo fso.GetExtensionName(file.path)
If fso.GetExtensionName(file.path)="wab" then
msgbox file.path 'Just to do something
end If
Next
Set Subfolders = folder.SubFolders 'Get all subfolders in our main
folder
For Each Subfolder in Subfolders 'Now, for each subfolder
Dosearch Subfolder.path
Next
end function Tag: GPO's Tag: 166357
Parsing Links
Hi I have a script that someone helped me make. However it is just short of
what I need. The players data still has the html code around it. I want to
extract the name only with the statistics. I cant seem to get my head around
it - everything I have tried seems to come up with errors. Here is the
script.
I have left out my attempts at adding another Myvar mid statement that would
extract the player name. The script as you see it works.
<%
Dim objRead, objWrite, objShell, objXML, objFile, objFSO
Dim location, thisFolder, nbastats, strURL
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objXML = Server.CreateObject("MSXML2.ServerXMLHTTP")
Set ObjHttp = Server.CreateObject("Msxml2.XMLHTTP")
objHttp.Open "GET",
"http://www.tsn.ca/nba/Statistics.asp?category=Points&position=&division=&season=2005&type=player&endRow=520&startRow=1",
false
objHttp.Send
nbastats = objHttp.ResponseText
Set objHttp = Nothing
If Not objFSO.FileExists (Server.MapPath("nbastats.txt")) Then
objFSO.CreateTextFile (Server.MapPath("nbastats.txt"))
Set objFile = objFSO.GetFile(Server.MapPath("nbastats.txt"))
Set objWrite = objFile.OpenAsTextStream( 2,-2 )
'Response.Write( skaters )
'Response.End()
objWrite.Write( nbastats )
objWrite.Close()
Set objFile = Nothing
Set objWrite = Nothing
If Not objFSO.FileExists(Server.MapPath("csv.html")) Then
objFSO.CreateTextFile(Server.MapPath("csv.html"))
Set objFile = objFSO.GetFile(Server.MapPath("csv.html"))
Set objWrite = objFile.OpenAsTextStream( 2, -2 )
Set objFile2 = objFSO.GetFile(Server.MapPath("nbastats.txt"))
Set objRead = objFile2.OpenAsTextStream( 1, -2 )
MyVar = MID(nbastats, instr(1, nbastats, "bgcolor=""#F7EDE0""")-32,
LEN(nbastats))
MyVar = MID(MyVar, 1, instr(1, MyVar, "</table>")-1)
Dim myArray(17)
Dim ii 'col count
Do While instr(1, MyVar, "<tr") > 0
'// Now extract the 'record' from the table (like above code)
MyRec = MID(MyVar, instr(1, MyVar, ">")+1)
MyRec = MID(MyRec, 1, instr(1, MyRec, "</tr>")-1)
'// Now we should be left with all the <td>'s
ii = 0
Do while instr(1, MyRec, "<td") > 0
myValue = MID(MyRec, instr(1, MyRec, ">")+1)
myValue = MID(myValue, 1, instr(1, myValue, "</td>")-1)
'// We have successfully got a value from a <td>!
'// Maybe at this point you could load it into an array:
myArray(ii) = myValue
'// Now we have to clean the MyRec string up
MyRec = MID(myRec, instr(1, myRec, "</td>")+5)
ii = ii + 1
Loop
'// At this point we have a loaded myArray with all the values from the
record! You could build an SQL string at this point or anything really
objWrite.WriteLine Join(myarray,",") & "<br>"
response.Write ("All done")
'// Now we have to trim up the main string
Myvar = MID(MyVar, instr(1, MyVar, "</tr>")+5)
Loop
%>
</head>
<body>
</body>
</html>
I appreciate your input - thanks Tag: GPO's Tag: 166355
Search files on remote computer
Hi all,
I want to search on multiple remote computers (nt 4 & XP) for *.wab files.
Because the NT-machines, I can't use WMI.
Is there another way to do this ?
I add 2 scripts that I use now. 1 for a local machine (systemfileobject)
and 1 for remote machines (WMI)
Thank you all.
Greetz
Wim Heirbaut.
'********************************************************
'*
'* Search adressbooks (*.wab) in Active Directory Computers, via
FILESYSTEMOBJECT
'* How to do this on several remote computers ?
'*
'********************************************************
On error resume next
Dim Fso, Drives, Drive, Folder, Files, File, Subfolders,Subfolder 'First
of all, you have declare the variables and create the FileSystem object.
Dim strComputer
Set Fso=createobject("scripting.filesystemobject") 'Then, Set the Drives
object, so you can search in all the available drives of the computer
Set Drives=fso.drives
Dosearch "c:\" 'Dosearch is the name of the function that we'll use
to search for files and subfolders.
Function Dosearch(Path)
Set Folder=fso.getfolder(path) 'Get the folder where we have to work.
Set Files = folder.files 'Get all the files inside this folder
For Each File in files 'File is the current file where we are 'Now do a
for-each for each file
If fso.GetExtensionName(file.path)="wab" then
msgbox file.path 'Just to do something
end If
Next
Set Subfolders = folder.SubFolders 'Get all subfolders in our main
folder
For Each Subfolder in Subfolders 'Now, for each subfolder
Dosearch Subfolder.path
Next
end function
wscript.echo "Gedaan"
********************************
*******************************
***************************
'*********************************************
'*
'* Search adressbooks in Active Directory computers, via WMI
'* If there is a computer not powered on, the script ends unexpected :-(
'*
'**********************************************
on error resume next
Dim objDSE, strDefaultDN, strDN, objContainer, objChild
'***************************
' Create Excel File
'***************************
Set objExcel = WScript.CreateObject("Excel.Application") 'Create Excell
file
objExcel.Visible = True
objExcel.Workbooks.Add
objExcel.ActiveSheet.Name = "Adresbooks"
objExcel.ActiveSheet.Range("A1").Activate
objExcel.ActiveCell.Value = "PC" 'col header 1
objExcel.ActiveCell.Offset(0,1).Value = "Location 1" 'col header 2
objExcel.ActiveCell.Offset(0,2).Value = "Location 2" 'col header 3
objExcel.ActiveCell.Offset(0,3).Value = "Location 4" 'col header 2
objExcel.ActiveCell.Offset(0,4).Value = "Location 5" 'col header 2
objExcel.ActiveCell.Offset(1,0).Activate 'move 1 row down
'***************************
' Run through Active directory
' searching for computers
'***************************
Set objDSE = GetObject("LDAP://rootDSE")
strDefaultDN = objDSE.Get("defaultNamingContext")
strDN = InputBox("Enter the distinguished name of a container" & vbCrLf &
"(e.g. " & strDefaultDN & ")", , strDefaultDN)
If strDN = "" Then WScript.Quit(1) 'user clicked Cancel
Set objContainer = GetObject("LDAP://" & strDN)
Call ListUsers(objContainer)
objExcel.close
wscript.echo "Script finished"
Sub ListUsers(objADObject)
Dim objChild
For Each objChild in objADObject
Select Case objChild.Class
Case "computer"
strComputer=objChild.cn
AdresboekZoeken(strComputer) 'search adressbook
Case "organizationalUnit" , "container"
Call ListUsers(objChild)
End select
Next
End Sub
'****************************************
'Search adressbook on remote computer
'****************************************
Sub AdresboekZoeken(Computer)
teller=0
WScript.Echo "I start search on : " & Computer
Set objWMIService = GetObject("winmgmts:" &
"{impersonationLevel=impersonate}!\\" & Computer & "\root\cimv2") ' maakt
verbinding met wmi van computer
Set colDisks = objWMIService.ExecQuery ("SELECT * FROM Win32_LogicalDisk
WHERE Name = 'C:'")
For Each objDisk in colDisks
Set colFiles = objWMIService.ExecQuery ("SELECT * FROM CIM_DataFile
WHERE Drive = 'C:'")
For Each objFile in colFiles
If objFile.Extension= "wab" then
Wscript.Echo Computer & " ==> " & objFile.Name
objExcel.ActiveCell.Value = computer
objExcel.ActiveCell.Offset(0,1+teller).Value = objFile.Name
teller=teller+1
End If
Next
Next
wscript.echo "Finished searching on pc " & computer
End Sub Tag: GPO's Tag: 166353
Does anyone have a VBS script that searches GPO's for a specific security
group and then deletes that group?