Changing IE Proxy Settings
Hi
Can anyone give me a sample script to change IE proxy settings from one IP
address to another which will apply to all users in XP and Win2k?
Gordon Tag: script to determine display mode Tag: 162740
Unintentional ascii 0 (nulls) when creating file with FSO?
I'm creating files on an IIS 5.0 web server, and when I create files with
the FileSystemObject, it creates files that have ASCII 0's as every other
character.
For example, if I TextStream.Write("Hello"), the resulting file has:
(gibberish) H (null) e (null) l (null) l (null) o (null)
In a text editor, the output looks fine, like "Hello".
In a hex editor, the file looks like this:
FF FE 48 00 65 00 6C 00 6C 00 6F 00
Anyone have an idea what's going on? It's driving me nuts... I'm not sure
where the "FF FE" comes from either.
Thanks,
Dan
www.dantan.net Tag: script to determine display mode Tag: 162739
Kill processes and services
I'd like to creating a small vbs file to kill a short list of processes/tasks and services
before installing other software.
There are a lot of third party utilities (ie. exes) that do this, but I hoping I could do
it without calling a batch/command-prompt process and do it all in a single file.
Any feedback is appreciated.
Thanks,
--
Tony Pedretti
TransUnion LLC Tag: script to determine display mode Tag: 162736
regular expressions
I'm back with something that makes no sense to me .... as far as I can see
the three if statements are identical except for the input. One is the
regular phone, then cell phone and then the fax .....
function validForm( passform) {
<< other validation skipped >>
re = /^\(?(\d{3})\)?[\.\-\/ ]?(\d{3})[\.\-\/ ]?(\d{4})$/
validPhone = re.exec(passForm.fldPhone.value);
if ( validPhone ) {
passForm.fldPhone.value = "(" + validPhone[1] + ") " + validPhone[2] +
"-" + validPhone[3];
}
else {
errList += " a valid phone number\n";
if (!hasError) {
passForm.fldPhone.focus();
hasError = true;
}
}
if ( passForm.fldCell.length > 0) {
recell = /^\(?(\d{3})\)?[\.\-\/ ]?(\d{3})[\.\-\/ ]?(\d{4})$/
validCell = recell.exec(passForm.fldCell.value);
if ( validCell ) {
passForm.fldCell.value = "(" + validCell[1] + ") " + validCell[2] + "-"
+ validCell[3];
}
else {
errList += " if entered the cell must be a valid phone number\n";
if (!hasError) {
passForm.fldCell.focus();
hasError = true;
}
}
}
if ( passForm.fldFax.length > 0) {
refax = /^\(?(\d{3})\)?[\.\-\/ ]?(\d{3})[\.\-\/ ]?(\d{4})$/
validFax = refax.exec(passForm.fldFax.value);
if ( validFax ) {
passForm.fldFax.value = "(" + validFax[1] + ") " + validFax[2] + "-" +
validFax[3];
}
else {
errList += " if entered the fax must be a valid phone number\n";
if (!hasError) {
passForm.fldFax.focus();
hasError = true;
}
}
}
<< handle the error and redirect to the next form >>
}
THey shouldbe identical since I copied the first one and made the requisit
changes for the cell and fax. However the output (as show in the session
variables into which they are stashed)
Session("svPersonPhone") = Request.Form("fldPhone")
Session("svPersonCell") = Request.Form("fldCell")
Session("svPersonFax") = Request.Form("fldFax")
show up as follows:
SVPERSONZIPCODE - 123451234
SVPERSONPHONE - (123) 123-1234
SVPERSONCELL - 4564564567 <<== notice not formatted ...
SVPERSONFAX - 7897987890
SVPERSONEMAIL -
initially the regular expressions were all just 're' then when I started
looking at this I changed them to 'recell' and 'refax' on the off chance
that there might be a funny in re-using a regular expression.
as always other comments are appreciated, but please also address this
issue. ((I know "picky, picky....")) Tag: script to determine display mode Tag: 162733
Convert DWORD Value to dotted IP Address
does anybody have any code to convert a dword value to a dotted ip
address....
I know that DWORD Value 167788830 converts to 10.0.65.30 but i have no idea
how to do it Tag: script to determine display mode Tag: 162731
Convert from bat to vbs
Hope someone can help, I want to convert this bat file to vbs. Anyone have
any input on how to do this.
@echo off
if not exist alttiff.ocx goto bad
start regsvr32 alttiff.ocx
goto end
:bad
echo Error: Cannot find alttiff.ocx.
echo Note: Do not run install.bat directly from your unzip program.
echo You must create a folder and unzip everything into it.
echo Note: The current directory is:
cd
pause
:end
Thanks
Gavin... Tag: script to determine display mode Tag: 162729
ldifde and importing the output file into a sql database.
Is it possible to take the output of a ldifde query and import the data into
a sql database? If so does anyone know how?
Thanks. Tag: script to determine display mode Tag: 162724
Editing an Access table from VBscript?
I'm looking for a way to read from and write to a table within an MS-Access
database.
I'll explain why I need this.
In my company, I want to keep a logfile of the computers that have logged
into the network. If the computername is not in a list, I want the user to
enter some information on a popup screen, about the location of the computer
(room-number).
Once the computername is in the list, the script should continue without the
user noticing. It should then only write the current date and time.
Would this be possible with Vbscript?
Wouter. Tag: script to determine display mode Tag: 162713
Windows.Status throws error on some pages
I have a series of ASP pages that have some fairly heavy client-side VB
script in them. Recently I have noticed that a few of these pages don't
like setting the window.status property. The ones that complain will throw
an error with the following message:
error: Illegal assignment: 'Windows.status'
I can see no significant difference between the pages where the
window.status works and those where it doesn't. Can anyone suggest where
the problem may be for me?
TIA
Ron L Tag: script to determine display mode Tag: 162712
Setting Computer Description Field with UserName
Does anyone know how I can set the Computer Description Fields with the name
of the user (better current logged in user)? Thanks everyone! Tag: script to determine display mode Tag: 162710
vbscript and IIS
Hi,
I've got the following task to do: I need to check various settings of a
website files on IIS. This mainly involves type of access (anonymous, basic
authentication etc.) Up to now I've done it manually, I opened inetmgr,
browsed to my website and than I manually checked file by file, security
settings.
Now, since the task is rather tedious, I thought about a script which
would do this for me, but I'm not really sure how. I am dimly aware of
things like ADSI, but I don't have any experience with it.
Could anyone provide any example, how for instance I can check if the
anonymous access has been set for given aspx file?!
Thanks,
Piotrek Tag: script to determine display mode Tag: 162703
Help for my unused methods please
Does anybody know a tool that could help me finding unused functions
on my VB applications?
Thanks for your help.
Bernard Davest Tag: script to determine display mode Tag: 162701
VBS & Stored Procedure
Hi all,
I have a stored proc that write a string in a var. I want to get this
string in my vbscript and I don't succeed. here is my code :
(don't forget to modify connection string)
In SQL Server :
==========================================
CREATE PROCEDURE SP3 AS
DECLARE @toto varchar(255)
SELECT @toto = 'Voici le retour de ma proc'
GO
==========================================
In my vbscript i would like to get "toto" :
---------------------------------------------------
Option Explicit
Const adCmdStoredProc = &H0004
Const adParamOutput = &H0002
Const adVarChar = 200
Dim strData
Dim res
res = ExecuteStoreProc ("SP3")
MsgBox "res : " & res
'******************* Execute the stored proc ****************
Public function ExecuteStoreProc(ProcStocName)
Dim oConn, strSQL, oRs
Dim pbiz_op
Set oConn = CreateObject("ADODB.Connection")
oConn.Open "DRIVER={SQL
Server};SERVER=XXXXXXXXXXXXX;UID=XXXXXX;PWD=XXXXX;DATABASE=XXXXX"
Dim oAdoCommand
Set oAdoCommand = CreateObject("ADODB.Command")
oAdoCommand.ActiveConnection = oConn
oAdoCommand.CommandText = ProcStocName
oAdoCommand.CommandType = adCmdStoredProc
oAdoCommand.Parameters.Refresh
dim lngRecordsAffected
dim retour
Set oRs = oAdoCommand.Execute(lngRecordsAffected, , adCmdStoredProc)
ExecuteStoreProc = oRs.Parameters 0
End function
--------------------------------------------------- Tag: script to determine display mode Tag: 162695
OU's + Sub OU's enumerations
Hello,
How can I in an ASP page (with a VBScript) enumerate all the OU's (sub ou's
included) in a drop down list. I would like to do the same for the Storage
Grouops and Mailboxes Stores on my 2 EX2K.
Any Idea ???
Thanks
Oli Tag: script to determine display mode Tag: 162688
Text File
Hi
I am trying to open a file and file the last line in the file.
I then want to access text in the last line.
Once I know the number of the last line, I am trying to access. The code
errors and says I am trying read past the end of the file.
I guess I need to reset the AtEndOfStream.
Is there a function for doing this or do I have to close and reopen the
file?
Cheers
Geoff
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\FSO\daily.txt", 1)
Dim strMaxLineNumber
Dim LastLine
Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine
strMaxLineNumber = strMaxLineNumber + 1
Loop
Wscript.Echo strMaxLineNumber Tag: script to determine display mode Tag: 162684
Windows XP Wallpapers
Hi!!
Is there a way to change the windows xp wallpaper when a user logs on??
I have used the following script in windows 2000 and works fine however it
does not work in Windows XP
any Ideas???
Is there any other way to do that??
I hava a DC running windows 2000 AS and all the clientes are XP
thanx =)
Option Explicit
Dim CompleteImagesFolderPath
Dim ImageFileTypes
CompleteImagesFolderPath = \\path
ImageFileTypes = "jpg"
Dim WshShell
Set WshShell = Wscript.CreateObject("Wscript.Shell")
Dim ImageFiles
Dim Final
Dim strDesktop
Set ImageFiles = CreateObject("Scripting.Dictionary")
strDesktop = WSHShell.SpecialFolders("Desktop")
call RandomImage(CompleteImagesFolderPath,ImageFileTypes)
Function RandomImage(CompleteImagesFolderPath, ImageFileTypes)
'Declare variables
Dim FileSystemObject
Dim ImageFolder
Dim Files
Dim i
Dim File
Dim FileName
Dim FileExtension
Dim RandomNumber
Set FileSystemObject = CreateObject("Scripting.FileSystemObject")
If Not FileSystemObject.FolderExists(CompleteImagesFolderPath) Then
RandomImage = "Error 0: Cannot find requested folder"
Set FileSystemObject = nothing
Exit Function
End If
Set ImageFolder = FileSystemObject.GetFolder(CompleteImagesFolderPath)
Set Files = ImageFolder.Files
i = 1
For Each File in Files
FileName = File.Name
FileExtension = Right(FileName, Len(FileName) - (InStrRev(FileName, ".")))
If InStr(1,ImageFileTypes,FileExtension,vbTextCompare) > 0 then
ImageFiles.Add i, FileName
i = i + 1
End If
Next
Set ImageFolder = nothing
Set Files = nothing
Set FileSystemObject = nothing
Randomize
If ImageFiles.Count = 0 Then
RandomImage = "Error 1: Folder no existe"
Exit Function
End If
RandomNumber = Int((ImageFiles.Count) * Rnd + 1)
Final = CompleteImagesFolderPath&"\"&ImageFiles.Item(RandomNumber)
WshShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Internet
Explorer\Desktop\General\Wallpaper",Final,"REG_SZ"
WshShell.RegWrite "HKEY_CURRENT_USER\Control
Panel\Desktop\Wallpaper",Final,"REG_SZ"
'CompleteImagesFolderPath&"\"&ImageFiles.Item(RandomNumber)
Set ImageFiles = nothing
WSHShell.AppActivate strDesktop
WSHShell.SendKeys "{F5}"
End Function Tag: script to determine display mode Tag: 162675
Declaration order & onchange event referencing dialog box in asp page
Hello
I'm a novice vbs'er, but old hand (now rusty) coder, which is what makes this more frustrating. I'm trying to construct an .as page with a list box to call a new page. Lots of googling has not led me to solve this problem:
I can't get the onchange event of the list box to open a url with a query string containing reference to the listbox selected item (a simple task I'm sure)
1. populates list box (lbselect) from DB which works
2. attempts to call newpage with the selected index
This won't run as it says an "object is expected", when I reference lbselect in the onchange event
- i've noticed different behavour between mozilla (which i normally use) and opening in IE sometimes, but hoping that is not the major issue
- i've made something work using an additional button in the form, but then the user has to lclick
hope somecan can point me in the correct direction
many thanks
Oz
Code below
<form name="form1" method="post" action="">
<select name="lbselect" style="width:150px;" class="CountryListBoxContent" onChange="OpenNewWindow('Newpage.asp?Id='<%=lbselect.selectedindex%>)">
<%
While (NOT rs_CountryList.EOF)
%>
.. populates from DB - this works!!!
%>
</select>
</form>
**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources... Tag: script to determine display mode Tag: 162673
setting SRC in iFRAME
Probably a pretty basic question...how do I set the SRC property of an IFRAME in script? I''ve tried the following but don''t see an SRC property:
document.frames("myFrame").SRC = "abc.htm" <--this property doesn''t exist but where is it???
-----------------------------
This message is posted by http://asp.forumszone.com Tag: script to determine display mode Tag: 162672
Run ASP Script as Scheduled Job
Hi All,
I want to perform the simple task of running an ASP script as a scheduled
job.
Previously I've always either run a .vbs script via windows Scheduler, or
put some logic in my global.asa, both of which have worked fine.
Unfortunately there are technical reasons (too complicated to go into here)
which mean I can't use either the global.asa or a standalone vbs script for
this job. It really does have to be an .asp script running in the
application space.
Running a scheduled job that runs the command "explorer
http://www.mydomain.com/myscript.asp" does the job, but will leave a new
window open every day, which will cause problems when sat on a remote
server. (self.close() at the end of the script just gives the "app trying
to close window" message and leaves window open)
Does anyone have any suggestions as to how to achieve this on a W2K server ?
Some kind of opening IE, running script, closing IE via VBS maybe ?
Any help much appreciated,
Regards,
Larry. Tag: script to determine display mode Tag: 162664
vbscript library
I have about 20 scripts that do different tasks for me. These scripts share
a lot of the same procedures and functions. Is there any easy way to create
a libary of vbscript functions and procedures that I can then call from any
vbscript? Tag: script to determine display mode Tag: 162662
Using HTML Help
I have a vbscript that is used at the command line by several users. When a
user makes an error I want to launch a HTML Help file (*.chm) and have it
already browed to the correct page (context sensitive help). How would I do
this from the vbscript? How do you launch the help file? and how do you get
the help file to nagivate to particular pages? Tag: script to determine display mode Tag: 162661
Please help : Object Required Error
Why does the following sub in IE 6.0 returns :
Object Required : 'window.parent.frames(...).document.forms(...)
Isn't frm an object?
Sub btnSave_onClick()
Dim nRepID 'Report ID if existing
Dim sRepName 'Report Name
set frm = window.parent.frames(0).document.forms(0)
alert(window.parent.frames(0).document.forms(0).name)
'More code her like
if len(sRepName) > 0 then
SaveReport frm, nRepID, sRepName, ptable.XMLData, IsEmpty(nRepID)
end if
End Sub Tag: script to determine display mode Tag: 162657
net send across domains
Does anyone know if it is possible for a machine (application) on one domain
to do a NET SEND to a machine or user on another domain? Tag: script to determine display mode Tag: 162656
RecordCount Property
Hi:
I have code that does two separate queries via ADO and then prints out the
results. The first query is standard and if no records are returned it
prints nothing as expected. The second query contains a SUM function in the
query and if there are zero records I get the following error:
Error Type:
(0x80020009)
Exception occurred.
I tried using the RecordCount property which is returning -1. I've seen
articles about this but didn't want to test it because I didn't feel I
should need to test for zero records.
BTW, I am using Access and we're only talking about 30 records at the most
at a time here.
Thanks,
Blair Tag: script to determine display mode Tag: 162654
VBScript to fix file names of downloaded web page
Friends,
I usually download any interesting web page I come upon. I do not expect to
be able to find it a second time and I do want to make sure I can get at it
when I have enough time to read it. With my current financial condition I
never know how long I will have an Internet connection.
I usually save the downloaded pages and files to a CD-ROM. This presents a
problem because the CD-ROM has file name length limits that are often
exceeded by page names. This is accerbated by the need for associated files
from a like named folder.
This program allows the user to modify the page name. The program will
create a new page with the new name, a new folder with the correct name and
references in the new page pointing to files in the new folder. It does not
affect the current page or folder.
This is my first version. I expect to create a new version which will be
easier to use and overcome the limitations of this version. Until then you
may find this unteresting if not useful.
Phil Rist - prist@innernet.net - http://www.innernet.net/prist
' ----------------------------------------------
' Name: FixHTML.vbs
' Description:
' Fix Downloaded HTML File Names
'
' Author: Philip S. Rist
' Date:
' Copyright 2004 by St. Thomas Software
' ----------------------------------------------
' This program is freeware. It may be used
' for any moral purpose. You use it at your
' risk. St. Thomas Software makes no
' guarantees to its fitness to do anything.
'
' If you feel you must pay for it. Please
' send one million dollars to
'
' The International Rescue Committee
' 122 East 42nd Street
' New York, N.Y. 10168-1289
'
' Ok, it is only a demo. So make it a half
' million.
' ---------------------------------------------
' Purpose:
' This program renames downloaded HTML pages with
' excessively long names. It also finds and renames the
' associated directory and all references to that directory.
' Use:
' This program should be associated with an explorer verb
' allowing it to be executed from the context menu for
' a selected HTML file.
' Problem:
' 1) It only fixes one page at a time. Hopefully I will find the time
' to create a version that will fix a complete folder.
'
' 2) Sub-folders to the folder containing associated image files and
' other files are not automatically copied to the new folder. This
' must be done mannually.
'
' Syntax:
' c:\windows\WScript.exe ...\FixHTML.vbs "%1"
' ---------------------------------------------
Dim fso
' ---------------------------------------------
Dim WshShell
Dim WSHPath
Dim WSHName
Dim WSHVersion
Dim WSHScriptPathName
Dim MyScript
Dim MyScriptName
Dim MyApp
' ---------------------------------------------
Dim lProgram ' Name of program
Dim lOldName
Dim lOldFolder
Dim lPath
Dim lNewProgram
Dim lNewName
Dim lNewFolder
Dim lNewPath
Dim lPos ' Position of right most '.' in program name
Dim lNotes ' Name of notes file, same as file name
' except extension has been removed and
' _Notes.txt has been added
Dim lTestStream
Dim lText
' ------------------------------- Create objects
set WshShell = WScript.CreateObject("WScript.Shell")
set fso = CreateObject("Scripting.FileSystemObject")
MyApp = WScript.Application
WSHPath = WScript.FullName
WSHName = WScript.Name
WSHVersion = WScript.Version
WSHScriptPathName = WScript.Path
' WScript.echo WSHName + " Ver. " + WSHVersion
MyScript = WScript.ScriptFullName
MyScriptName = WScript.ScriptName
' --------------------------------- Get file name
set objArgs = WScript.Arguments
if objArgs.count > 0 Then
' ----------------------------- Get file name
lProgram = objArgs(0)
' ----------------------------- Get directory path
lOldFolder = vbnullstring
lPos = instrrev(lProgram,".")
if lPos > 0 then
lPath = left(lProgram,lPos-1)
lPos = instrrev(lPath,"\")
if lPos > 0 then
lOldName = mid(lPath,lPos+1)
lOldFolder = lOldName & "_Files"
lPath = left(lPath,lPos) & lOldFolder
end if
else
lPath = ""
end if
' ----------------------------- Get new name
lNewName = inputBox("Enter new name(No extension):","Input",lOldName)
lNewFolder = lNewName & "_Files"
lPos = instrrev(lPath,"\")
lNewProgram = left(lPath,lPos)
lNewPath = lNewProgram + lNewFolder
lNewProgram = lNewProgram & lNewName & ".html"
' ----------------------------- Create new folder with new names and
' copy contained files. Sub-folders to
' this folder must be mannually copied.
set lN = fso.CreateFolder(lNewPath)
fso.CopyFile lPath & "\*.*",lNewPath
set lTextStream = fso.OpenTextFile(lProgram)
lText = lTextStream.ReadAll()
lTextStream.Close()
' ---------------------------- fix references to sub-folder
lPos = instr(1,lText,lOldFolder,1)
lLen = len(lOldFolder)
do while (lPos > 0)
lText = left(lText,lPos-1) + lNewFolder + mid(lText,lPos+lLen)
lPos = instr(lPos+1,lText,lOldFolder,1)
loop
lPos = instrrev(lPath,"\")
lPath = left(lPath,lPos)
msgbox lNewProgram
' ---------------------------- Create page with new name
set lTextStream = fso.CreateTextFile(lNewProgram)
lTextStream.Write lText
lTextStream.Close
end if Tag: script to determine display mode Tag: 162653
Runbox written in VBScript
Friends,
Here is a simple runbox written in VBScript which can be run under Windows
Scripting Host.
Phil Rist - prist@innernet.net - http://www.innernet.net/prist
Option Explicit
' ----------------------------------------------
' Name: Runbox.vbs
' Description:
' Simple Runbox
'
' Author: Philip S. Rist
' Date:
' Copyright 2003 by St. Thomas Software
' ----------------------------------------------
' This program is freeware. It may be used
' for any moral purpose. You use it at your
' risk. St. Thomas Software makes no
' guarantees to its fitness to do anything.
'
' If you feel you need to pay for it. Please
' send one million dollars to
'
' The International Rescue Committee
' 122 East 42nd Street
' New York, N.Y. 10168-1289
'
' Ok, it is only a demo. So make it a half
' million.
' ---------------------------------------------
' Purpose:
' Windows runbox clone
' Use:
' This program should be associated with an explorer verb
' allowing it to be executed from the context menu for
' a selected file.
' Syntax:
' c:\windows\WScript.exe ...\Runbox.vbs "%1"
' ---------------------------------------------
Dim WshShell ' WSH Shell object
Dim objArgs ' Arguments passed to this script
Dim lFilePath ' Path to selected file
Dim lCommandLine ' Command line to be shelled to
Dim lRC ' returned from running command
Set WshShell = WScript.CreateObject("WScript.Shell")
' ------------------------------------------- Get name of file
Set objArgs = WScript.Arguments
lFilePath = objargs(0)
' ------------------------------------------- Allow user to modify command
line
lCommandLine = inputbox("Complete command:","My run box",lFilePath & " ")
' ------------------------------------------- If user has pressed Ok then
' execute program
if len(lCommandLine) > 0 then
lRC = WshShell.run (lCommandLine)
end if Tag: script to determine display mode Tag: 162652
STRING: Missing characters
I have a string named "email" that contains a new registering user email
address. My CSR receives an account request with the information that was
stored in a SQL table. Upon verifying the users profile, my CSR activates the
new user account and in the process, my script sends an account activation
message to the user (as stored in the "email" variable). The outgoing message
is simple and the "email" variable is correct in the "to" address. But, in
the body of the message, I have placed a link which allows the user to login
to their account that contains the "email" address variable (the same one
used in the "to" field) and it is somehow different. The difference being
ONLY when the email address contains a period "." in the name section.
Example; "first.last@myweb.com" ...produces "firstlast@myweb.com".
The period between "first" and "last" just drops off? Of course, the email
address is incorrect and when the user clicks the link and supplies their
password, logging in is unsuccessful. Any ideas? Tag: script to determine display mode Tag: 162648
Windows Script 5.6
I see that there is a new release of Windows Script (vbscript shows version
5.6.0.8825). I see downloads for XP, 2000, (and earlier OSes), but do not see
anything for Windows 2003.
I'd like to know how to get this on Windows 2003 as well so that I can test
it before deploying on a collection of Windows 2000/2003 servers.
Here's the XP/2000 release
http://www.microsoft.com/downloads/details.aspx?FamilyID=c717d943-7e4b-4622-86eb-95a22b832caa&displaylang=en Tag: script to determine display mode Tag: 162647
date less than current date.
Hey, I'm trying to compare a VAR "LastcommDate" to the current system
date. If that date is < current date then write that response to a
file Maintenance_Summary. I keep getting all records written to the
file no matter what the date is? Thanks. Tag: script to determine display mode Tag: 162646
fso and writeline
Hi,
I have an issue with the writeline function in the File System Object.
I am reading a field off a record in a SQL server db. If there is a carriage
return anywhere in the string of the field being pulled out to the writeline
will write it out as 2 lines. I need this to be written as 1 line. Is there
anyway I can do this?
Eg Data in field = "testesttestetsttes <CR> tewsttst"
tf.WriteLine("fieldname")
Data displayed as:
testesttestetsttes
tewsttst
Thanks In Advance,
Kevin. Tag: script to determine display mode Tag: 162637
Remote Lock Workstation for entire network
Hi guys 'n' gals...
I've found this script to remotely lock workstations specified in the
array:
dim RemoteProcess
dim arRemote, RemotePC
RemoteProcess = "rundll32.exe user32.dll,LockWorkStation"
arRemotePCs = array
(
"machinea",
"machineb",
"machinec",
"machinez"
)
for each RemotePC in arRemotePCs
StartProcess RemoteProcess, RemotePC
next
sub StartProcess (process, computername)
dim proc
set proc = getobject("winmgmts://" & computername
& "/root/cimv2").get("win32 process")
proc.create process
end sub
Now, what I want to do is populate the array with a list of all the
computers on the network (probably by using the NET VIEW)...
Is this possible and can anyone write the script I need to populate
it?
Thanks in advance
Adam Tag: script to determine display mode Tag: 162631
Calculating elapsed time
I am attempting to write a function that calculates the elapsed time to
download a page from the server.
I use the MSXML2.XMLHTTP object to GET a web page (in synchronous mode) and
note the time before and afterwards. However, the difference between these
values is generally = 0 which obviously can't be quite right. The web page
has instructions not to be cached.
The VBScript code is as follows - please point out where you think that I've
gone wrong. Thanks in advance.
Griff
----------
Private Function serverResponseTime(ByVal IPAddressOfServer)
Dim dStart
Dim dFinish
Dim oHTTP
Set oHTTP = CreateObject("MSXML2.XMLHTTP")
With oHTTP
' Start time
dStart = cdbl(Time)
' Set the connection synchronously
.open "GET", "http://" & IPAddressOfServer & "/default.htm", False
' Query site to download the page
.send
' Finish time
dFinish = CDbl(Time) 'Now()
' Determine response (in seconds)
serverResponseTime = ((dFinish - dStart) * 86400)
End With
Set oHTTP = Nothing
End Function Tag: script to determine display mode Tag: 162626
Class within a class
Hello out there,
Question: Set up a class in an class is not allowed in VBSCRIPT?
<!--#include file="classlib.asp"-->
class test
private Class_two
set Class= NEW class_lib ->> this line generates a syntax error why?
end class Tag: script to determine display mode Tag: 162619
session variables
((This is a repeat of a message I wrote earlier which seems to not have made
its way out -- it will, of course propogate its way across the net while I'm
typing this one .... ))
This is probably in the wrong group, but since you all have been so helpful,
here goes anyway.
the following code is the end of a routine which stashes data from one form
off to session variables and then redirects itself to the proper form /
procedure depending upon the state of two checkboxes. It work properly as
it stands.
Session("svPersoncbBoats") = Request.Form("cbBoats")
Session("svPersoncbFlood") = Request.Form("cbFlood")
if (Session("svPersoncbAuto") = "checkbox" ) then ' if cbAuto is schecked
this infact contains 'checkbox' ???
Response.Redirect("auto.asp") ' it appears
to since this works right
else
if (Session("svPersoncbHomeOwner") = "checkbox") then
Response.Redirect("HomeOwner.asp")
end if
Response.Redirect("PersonMail.asp")
end if
however, I get to the following code where I'm preparing the email to the
office:
Body = Body & "They have indicated interest in the following coverage:" &
vbcrlf
' the next two lines are displays so I can see what's really in the session
variables .... not!
Body = Body & "Session(svcbHomeOwner) [" & Session("svcbHomeOwner") & "]" &
vbcrlf
Body = Body & "Session(svcbAuto) [" & Session("svcbAuto") & "]" & vbcrlf
if Session("svcbHomeOwner") = "checkbox" then Body = Body & "
Homeowner coverage (see below)" & vbcrlf
if Session("svcbAuto") = "checkbox" then Body = Body & "
Automotive (see below)" & vbcrlf
if Session("svcbTenants") = "checkbox" then Body = Body & " Tenant
coverage" & vbcrlf
the out put from this looks like:
They have indicated interest in the following coverage:
Session(svcbHomeOwner) []
Session(svcbAuto) []
Notice nothing between the brackets which would seem to indicate they are
empty or non-literal - after I compared them to the literal 'checkbox'
above. How should I really be handling this?? What is the default value
returned by a checked / unchecked checkbox (using dreamweaver, btw) the
'value' clause says 'checkbox' and I've been operating under the assumption
that if the box is checked it will return that value, if not a null <???>.
Final comment, the timing factor for a session variable <default of 20
minutes ??> should not be a factor as I filled out the two pages I chose in
less than 10 minutes by thee computer clock.
Comments / suggestions ..... please
(( AL )) Tag: script to determine display mode Tag: 162617
Share deletions
Hi everyone;
I searched thru the site for a script that can stop and delete the
share and then delete the folder the share is associated with. Iwould
like the script to pull the information from a text file Tag: script to determine display mode Tag: 162615
hello, world
i have a need to practice some vbscript and would like to do it 'old style',
by running simple scripts at the dos command line. i can't figure out a way
to launch it. "cscript myCode.vbs" doesn't work.
what is the basic syntac to launch a script from the command line?
also, can someone jot down a "hello, world" code, along with how to launch
it form the command line.
many thanks,
JCR Tag: script to determine display mode Tag: 162611
inline 'if'
Since you all are so quick on the draw (thank you) :)
does VBScript have an inline 'if'?? I'm trying to do the followig:
txt = txt & "It " & if(fireplace) : "has" ? "does not have" & "a fireplace."
If it does, I can't find a reference to it (what's the proper name for it)
and I'm obviously doing something wrong with it.
Or do I have to build this as an if / then / else combination??
(( AL ))
(Make you happy /Al :) )) Tag: script to determine display mode Tag: 162610
Setting an image datatype in a recordset to NULL
I'm updating a record by opening a recordset, setting the fields and the
updating it with objRS.Update.
I need to set an image datatype to NULL. objRS("field") = NULL works for
datatypes int and varchar but not for datatype image, although there is no
error - the image field still contains the image!
I'm using SQL server and running an UPDATE statement including image = NULL
works.
Any help would be much appreciated. Tag: script to determine display mode Tag: 162609
How to replace an apostrophe with a quotation mark
I'm a vb scripting newbie. I can't figure out why the following line
triggers an error message:
strZipWhatNdHow = Replace(strZipWhatNdHow, "'", """)
I want to replace the single quote (aka apostrophe) with a double quote).
Does anyone know where I can find the answer?
If this is not an appropriate place to post this message, please tell me.
Thanks,
Marc Hankin Tag: script to determine display mode Tag: 162607
How to replace an apostrophe with a quotation mark
I'm a vb scripting newbie. I can't figure out why the following line
triggers an error message:
strZipWhatNdHow = Replace(strZipWhatNdHow, "'", """)
I want to replace the single quote (aka apostrophe) with a double quote).
Does anyone know where I can find the answer?
Thanks,
Marc Hankin Tag: script to determine display mode Tag: 162604
ADS User Add Problems: UserAccountControl
hello,
i wrotea little app in VB 6.0 to create users into ActiveDirectory.
but i can´t set the "userAccountControl" value to MUST CHANGE PASSWD.
if i use the value 16 (dez) or hex "0010" it´s checkmarked "account
diseabled"
what i do wrong ?
thank you for reading !
Set usr = sublevelup.Create("user", "CN=" & fullnam)
usr.Put "userPrincipalName", fullnam & "@" & fullydomain
usr.Put "profilepath", CStr(Me.txt_profilepath)
usr.Put "scriptPath", CStr(Me.txt_scriptpath)
usr.Put "sAMAccountName", CStr(fullnam)
usr.SetInfo
usr.SetPassword fullnam
usr.Put "userAccountControl", "0010"
usr.SetInfo Tag: script to determine display mode Tag: 162595
Is anybody know how to add or delete port on Windows XP Firewall for Sp1 ?
I have some problem when I use FwMgr ,Windows prompt some error o
Windows XP Sp1.
Is anybody know how to add or delete port on Windows XP Firewall fo
Sp1 ?
Thank you very much
-
motorw
-----------------------------------------------------------------------
Posted via http://www.codecomments.co
----------------------------------------------------------------------- Tag: script to determine display mode Tag: 162591
Save asp webpage as word doc on server using asp and vbscript
Hello,
I am not too sure how to go about this so am looking for a little
help.
I have the webpage user filling in a large form on an asp page which
populates a MySQL database.
I then want to create a word doc using the entered data.
I need to open the asp page in word on the server and save it as a
word doc.
Unfortunately I have no idea how to go about this and heavy internet
searching has found nothing.
Does anyone know how this is done, or can point me in the direction of
a source that will help me with this problem?
Thanks in advance for your help,
Graeme Wood Tag: script to determine display mode Tag: 162589
XCACLS.VBS - Help
Hi,
i using Windows Server 2003 Std (Brazilian Portuguese) with all hotfix
i downloaded the last version of xcacls.vbs (Version 5.2)
i try this command with administrator user
i try this command.
cscript xcacls.vbs e:\userdir /i copy
error:
**********************
Directory: e:\userdir
Error: -2147217404: ocurred setting RetVal =
objFileSecSetting.ExecMethod_("SetSecurityDescriptor", objInParam)
(Msg#4306)
Error description: Falha do Provedor (Provider fails)
in event viewer:
Category: 100
ID: 100
Description:
Aplicativo com falha cscript.exe, versao 5.6.0.8515, modulo com falha
oleaut32.dll, versao 5.2.3790.0, endereco com falha 0x0001bbae.
(Translated from Brazilian Portuguese):
Applicatory with imperfection cscript.exe, version 5.6.0.8515, module with
imperfection oleaut32.dll, version 5.2.3790.0, address with inperfection
0x0001bbae
any help??
raphael
**Sorry for my bad english.. Tag: script to determine display mode Tag: 162587
Double Quotes Problem with Command Line
Hi everyone,
been quite successful with vbs so far, but now I'm stuck with probably a
simple solution.
I want to send a command to the command line. It works fine if i run it
directly in a DOS-box. The double quotes are required in the command string.
How do I write the command string to avoid the "end of instruction expected"
error? It's probably a double quotes problem. But I cannot solve it. Tried
everything other than the solution :-)
CheckOutInCommand = "cmd for /f "tokens=*" %%i in (Checkout_in_TTXs.txt) do
ss checkin "%%i" -C"
Set oExec = WshShell.Exec(CheckOutInCommand)
Thanx for any help
Robert Tag: script to determine display mode Tag: 162584
ASP
Hi,
I have a Web page which is a Form. It has two fields, name and Designation. The name field is a select tag. Which displays all the values from a table. Based on the name selected, the corresponding designation should be displayed
-----------------------------
This message is posted by http://asp.forumszone.com Tag: script to determine display mode Tag: 162583
text to csv file help
hi all,
i have the following text file,
test1
test2
test3
test1
test2
ect
i want to create a csv file from this, with the script i already have i can
create a csv file, only all the test items are placed in one single row, so
test1|test2|test3|test1|test2
i want to have the empty row in the original text file as a delimited for a
new row in my csv file, so the output must be
test1|test2|test3
test1|test2
This is the script i have right now,
how can i convert the empty space to a new row in a csv file?
thankz
martijn
With CreateObject("Scripting.FileSystemObject")
Text = .OpenTextFile("temp.txt").ReadAll
CVSText = Replace(Replace(Text, vbNewLine, "|"), "||", vbNewLine)
WScript.echo Text ' for example or for use at command prompt
.OpenTextFile("temp.csv", 2, True).Write CVSText
End With Tag: script to determine display mode Tag: 162582
Copy File w/ New Modified Date
I need to copy some files to a backup directory. The modified date must be
the date they were copied. I have tried the FileSystemObject (and File
object that belongs to this model) to accomplish this. No matter how I get
the files copied, using the Copy or Move, then renaming, the modified date
does not change. Even if I change a property, like the read only or archive
flag, the modified date doesn't change.
I've even looked at DOS Shell commands, but they don't change the modified
date.
Does anyone know a cool trick to accomplish this w/in VB script? I have an
application that is written in C, and the author managed to find some
function to do this, because when it does a backup, the copied files carry
the current date and time, no matter what the original file's modified date
is.
Any help would be appreciated.
Regards,
Paul Tag: script to determine display mode Tag: 162574
Need help Comparing File Date with System Date
Hi there,
I must do a script that checks if a file in the "c:\trackitaudit.id" exists.
If not a batch file is called "audit.bat". But if allready exists I must
compare the last time the file has modified and accessed with the system
date. Is that possible?... I'm not sure if I pick up the right way!...
(please see the code above). Then finally it was supposed it the question
made before work right I should multiple or add the system date with a
number that were only modified if I had the intention to run the script
like:
i.e: if the fileDateLastAccessed < systemDate (* or +) with a "Number"
Imagine today is 1 of Setember so I would compare with the system date that
is 5 of Setember then the "Number" I've mention above should work like an
incremental day such as supposing one of the condition were the script only
run when the date of the file were older than the "systemDate" more "a
couple of days".
Thanks in advance
Nuno
Option Explicit 'Forces to declare all variables
Dim fso
Dim oFile
Dim fileCreated, fileModified, fileAccessed
Dim file
Dim
'Dim objArgs
'Dim attrib
systemDate=Now()
file="c:\trackitaudit.id" 'Specify default file
'Create FileSystemObject object to access the file system
'DOUBT:IF I DON'T USE THE 'WSCRIPT' WORD THE USER DOESN'T SEE THE SCRIPT
RUNNING?
Set fso = wscript.CreateObject("Scripting.FileSystemObject")
Set objShell=Wscript.CreateObject("Wscript.Shell")
'If the file doesn't exist call's the batch file track.bat to run for the
first time
If Not fso.FileExists(file) Then
'0: hides window and activates another one
objShell.Run("%comspec% /c track.bat \\serverName\script\"),0, True
Else
If fso.FileExists(file) Then 'Check if file exists
Set oFile=fso.GetFile(file) 'Get file handle object
'File dates (created, modified, accessed)
fileCreated = oFile.DateCreated
fileModified = oFile.DateLastModified
fileAccessed = oFile.DateLastModified
'DOUBT: here I wanted to multiple or add the date of the system by a
certain number
'of days but I don't know how to do that
If fileModified < systemDate and fileAccessed < systemDate
objShell.Run("%comspec% /c track.bat \\serverName\script\"),0, True
Else
Wscript.Echo "Error: File" &file& "not found"
End If
End If Tag: script to determine display mode Tag: 162567
Is there a way for a script to determine whether or not the video
display is in clone mode?