VBScript Regex Lookbehind: Ever? Before I retire?
I'm implementing PowerPoint macros in VBA and call upon the VBScript
regex support. I continually bump up against the
no-lookbehind-in-VBScript-regex wall.
Is there any expectation that VBScript regex will ever be enhanced to
add this functionality? If so, when? If not, what does the rest of
the world do in VBA when they want to check for strings not preceded by
some other string?
Is there any way at all to get regex support from VBA that *does*
support lookbehind (negative, esp.)?
Thanks... Tag: How to count the number of linked objects in MSWord? Tag: 193724
date of file modification
Hallo,
I'm looking for BVScript (or Java Script) to recive date modification of
file.
From main site i want read date modification of frame.
I know in js document.lastModified, but i don't know how it run for frame or
any file.
Thx, Max Tag: How to count the number of linked objects in MSWord? Tag: 193719
What does "set objFile = nothing" mean?
Hello:
I am trying to understand the meaning of a certain line of code for a
script that queries the event log and then writes it to a text file. I
found the script on the web. I would appreciate if someone could
explain the function of the following command in this script:
set objFile = nothing
set objFolder = nothing
What does the above do and what's it for? The relevant parts of the
script deailing with the file system object is listed below. THank you.
TIA
- Raheem
PS. The script below is from this excellent site on scripting
http://www.computerperformance.co.uk
----> Begin Script
Option Explicit
Dim objFSO, objFolder, objFile ' Objects
Dim strComputer, strFileName, strFolder, strPath ' strings
' --------------------------------------------------------
' Set the folder and file name
strComputer = "."
strFileName = "\Event672.txt"
strFolder = "e:\logs"
strPath = strFolder & strFileName
' -----------------------------------------------------
' Section to create folder and hold file.
' Create the File System Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
' Check that the strFolder folder exists
If objFSO.FolderExists(strFolder) Then
Set objFolder = objFSO.GetFolder(strFolder)
Else
Set objFolder = objFSO.CreateFolder(strFolder)
WScript.Echo "Just created " & strFolder
End If
If objFSO.FileExists(strFolder & strFileName) Then
Set objFolder = objFSO.GetFolder(strFolder)
Else
Set objFile = objFSO.CreateTextFile(strFolder & strFileName)
Wscript.Echo "Just created " & strFolder & strFileName
End If
' --------------------------------------------------
' Two tiny but vital commands (Try script without)
set objFile = nothing
set objFolder = nothing
' ----------------------------------------------------
' Write the information to the file
Set strFileName = objFSO.CreateTextFile(strPath, True)
strFileName.WriteLine("Computer to test " & strComputer)
Wscript.Echo "Check " & strPath
WScript.Quit
' End of Guy's FSO sample VBScript
<---- End Script Tag: How to count the number of linked objects in MSWord? Tag: 193718
Connect to remote machines and reset password for local admin a/c
Hi guys,
if lets say I have a variety of different workgroups and domains.
And I need to reset the password of each individual machine's local admin a/c,
can I do something like this?
Set objDSO = GetObject("WinNT:")
Set objUser = objDSO.OpenDSOObject _
("computername", "userid", "currentpassword")
objUser.SetPassword("newpassword")
In the above, will I be able to connect to each individual machine with the
correct credentials and reset the password? Tag: How to count the number of linked objects in MSWord? Tag: 193715
Regular Expression error
Hi.
I have one script of Regular Expression on two ASP-pages, but it only
works on one of them. The code is exactly the same (copy/paste) on both
pages still this error occurs on one page:
Microsoft VBScript runtime error '800a1399'
Syntax error in regular expression
/admin.asp, line 7
The code:
Dim re
Set re = new RegExp
re.Pattern = "<main>/.*(?</main>)"
re.Global = true
set Matches = re.Execute(text) <-- this is where the error occurs...
newTex = Matches.Item(0).Value
The text is a normal HTML page, where I want to find the contents
between the main-tag.
Is there anybody who may explain this? Is there really a syntax error
in my code?
Looking forward to your answers!
royend Tag: How to count the number of linked objects in MSWord? Tag: 193712
How to sense popup closings from the parent window?
Hello,
My main window (parent) pop ups a child. Child includes different pages
from web. Client doing some thing in this popup (surfing) and want to
close after. How can parent sense this action and reaction against
this.
Actually i intent to return main menu on the parent window when popup
closed.
Thank you
Caglar ORHAN (=C7aglar ORHAN) Tag: How to count the number of linked objects in MSWord? Tag: 193707
Export registry key 'Last Write Time'
Hi,
I'd like to export a registry key to a text file like regedit. (export >
save as > text file)
I already found examples to save a key as text, but not in the same way
regedit does.
Regedit also saves the keys 'Last Write Time' to a text file. (Last Write
Time: 14-7-2006 - 16:06)
As you see, i'am interrested in the keys 'Last Write Time', so maybe there's
another solution for this.
Robertico Tag: How to count the number of linked objects in MSWord? Tag: 193692
Internet Explorer 6 and Registy Check
Hi All,
I need two scripts:
1. That would set the a binary registry value like
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Non-Driver Signing\Policy" from 1 to
0.
2. Check to see if Internet Explorer 6.0 is installed on the local (Windows
2000 Professional) computer.
I appreciate any help.
Regards,
Yaman Tag: How to count the number of linked objects in MSWord? Tag: 193690
vbscript for ADAM
I am a sys admin for a small/medium size company and would like to
investigate utilizing vbscript to automate tasks on an ADAM install.
Ex. How to create an OU object via vbscript, user object etc... Tag: How to count the number of linked objects in MSWord? Tag: 193681
return the sums of all integers
How do I return the sum of all integers from two text boxes. If the end
user inputs 5 in the first textbox and then 10 in the second textbox my
answer needs to be 45.
5+ 6+7+8+9+10=45? I am using VB.NET 2003 Tag: How to count the number of linked objects in MSWord? Tag: 193679
Resizing An Array...
Hello,
It's me again. I have a string (s) that I turned into an array (strArray)
using the split command.
How do I eliminate elements 1-5, assuming "Time (HH:MM)->" is element 0 and
"00:00" is the 6th element starting out?
The string below happens to contain "" in those places, but some of the
other strings may have info in them that I would also want to just yank and
get rid of.
Any direction you can give would be appreciated!
Thanks!
s = "Time (HH:MM)
->,,,,,,00:00,00:05,00:10,00:15,00:20,00:25,00:30,00:35,00:40,00:45,00:50,00:55,01:00,01:05,01:10,01:15,01:20,01:25,01:30,01:35,01:40,01:45,01:50,01:55,02:00,02:05,02:10,02:15,02:20,02:25,02:30,02:35,02:40,02:45,02:50,02:55,03:00,03:05,03:10,03:15,03:20,03:25,03:30,03:35,03:40,03:45,03:50,03:55,04:00,04:05,04:10,04:15,04:20,04:25,04:30,04:35,04:40,04:45,04:50,04:55,05:00,05:05,05:10,05:15,05:20,05:25,05:30,05:35,05:40,05:45,05:50,05:55,06:00,06:05,06:10,06:15,06:20,06:25,06:30,06:35,06:40,06:45,06:50,06:55,07:00,07:05,07:10,07:15,07:20,07:25,07:30,07:35,07:40,07:45,07:50,07:55,08:00,08:05,08:10,08:15,08:20,08:25,08:30,08:35,08:40,08:45,08:50,08:55,09:00,09:05,09:10,09:15,09:20,09:25,09:30,09:35,09:40,09:45,09:50,09:55,10:00,10:05,10:10,10:15,10:20,10:25,10:30,10:35,10:40,10:45,10:50,10:55,11:00,11:05,11:10,11:15,11:20,11:25,11:30,11:35,11:40,11:45,11:50,11:55,12:00,12:05,12:10,12:15,12:20,12:25,12:30,12:35,12:40,12:45,12:50,12:55,13:00,13:05,13:10,13:15,13:20,13:25,13:30,13:35,13:40,13:45,13:50,13:55,14:00,14:05,14:10,14:15,14:20,14:25,14:30,14:35,14:40,14:45,14:50,14:55,15:00,15:05,15:10,15:15,15:20,15:25,15:30,15:35,15:40,15:45,15:50,15:55,16:00,16:05,16:10,16:15,16:20,16:25,16:30,16:35,16:40,16:45,16:50,16:55,17:00,17:05,17:10,17:15,17:20,17:25,17:30,17:35,17:40,17:45,17:50,17:55,18:00,18:05,18:10,18:15,18:20,18:25,18:30,18:35,18:40,18:45,18:50,18:55,19:00,19:05,19:10,19:15,19:20,19:25,19:30,19:35,19:40,19:45,19:50,19:55,20:00,20:05,20:10,20:15,20:20,20:25,20:30,20:35,20:40,20:45,20:50,20:55,21:00,21:05,21:10,21:15,21:20,21:25,21:30,21:35,21:40,21:45,21:50,21:55,22:00,22:05,22:10,22:15,22:20,22:25,22:30,22:35,22:40,22:45,22:50,22:55,23:00,23:05,23:10,23:15,23:20,23:25,23:30,23:35,23:40,23:45,23:50,23:55"
strArray = Split( s, ",", -1, 1) Tag: How to count the number of linked objects in MSWord? Tag: 193670
Placing MIN, MAX, AVERAGE Value in Excel Chart Legend...
Hello,
I have a columns of data that I have been able to automate into creating
charts for each, and thought it would be nice to be able to include the
minimum, maximum, and average value of that column in the chart legend. I
have two places that I am stuck at (at least at this point)!
1. I have figured out that I can use Excel functions as follows:
varMINValue = objExcelApp.MIN()
But how can I specify the used range of cells in a column in the MIN brackets?
2. How do I get these Excel function values into the the chart legend?
I found the following link:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/off2000/html/xlobjLegendEntry.asp
But I am stuck as to how I can assign a legend key a value.
Any help you can give would be most appreciated!
Thanks! Tag: How to count the number of linked objects in MSWord? Tag: 193667
Selecting Used Cells In a Column...
Hello,
I have been messing with this for a while, and decided I need professional
help!
I would like to select the used cells in a column.
I I can do it by being at the top (or bottom) of the column, then using
CTRL+SHIFT+Up (or Down) arrow to highlight the range, but that seems sort of
cludgy to me!
It seems that the .UsedRange command is the way to go, but I can't figure
out what needs to go before and/or after it to only select that columns used
range of cells!
Any help would be appricated! Tag: How to count the number of linked objects in MSWord? Tag: 193663
WshScriptExec mangle stdout characters
I have a VB script who starts Diskpart using WshShell.Exec.
Commands are sent to diskpart via WshScriptExec.Stdin and the output from diskpartis read from
WshScriptExec.Stdout.
All work just fine in an English-US environment. However under a french or italian environments, the
accented characters like "é à è ..." are translated to some other characters within the EN-US
character set when the script reads the output of diskpart from stdout.
Is there a way to configure VBScript to create Unicode based streams (stdin/stdout) when creating
the process to execute?
Alternatively, is there a known workaround to this design limitation of VBScript?
Regards,
Gaetan Tag: How to count the number of linked objects in MSWord? Tag: 193662
Disable DCOM
Does anyone know if there is a way to disable DCOM using a vbscript? I dont
want to disable the service, just uncheck the box that says Enable Dcom on
this computer.
Thanks
Gavin... Tag: How to count the number of linked objects in MSWord? Tag: 193661
Map Drives Based on User Login Name
I need a help creating a vbs script to map network drives based on user login
name Tag: How to count the number of linked objects in MSWord? Tag: 193646
cmd to open event viewer
Anyone know of a cmd I could put into a VBscript that will open the event
viewer showing the system log?
Thanks Tag: How to count the number of linked objects in MSWord? Tag: 193637
Enabling the Admin$ Share using VBS and Domain Policy
I have recently tried my very shaky hand at scripting....
And this is how it all began.. We currently have a problem with Admin$
Shares. On some of the computers the Admin$ share no longer exists.
Affects 2000 pro and Windows XP.
The registry location for this is as follows:
"HKLM\System\CurrentControlSet\Services\lanmanserver\parameters\"
ValueName = "AutoShareWks"
REG_DWORD = 1 (Admin$ is active)
REG_DWORD = 0 (Admin$ is not available)
So The problem that I have, is that I have created the following
script:
_______________________________________________________________________
Set oShell = CreateObject("WScript.Shell")
sRegKey = _
"HKLM\System\CurrentControlSet\Services\lanmanserver\parameters\"
sRegValueName = "AutoShareWks"
' enable AutoShareWks to 1
oShell.RegWrite sRegKey & sRegValueName, 1, "REG_DWORD"
_________________________________________________________________________
This script has been implemented using group policies as a startup
script. The script runs on windows XP but not on Windows 2000.
How do I trouble shoot this or find a workaround that works on 2000 and
XP.
Thanks. Tag: How to count the number of linked objects in MSWord? Tag: 193635
Find/Replace in Excel
Hello,
I have a couple of files that do a web query. I need to add a function to do
a find and replace before the .SaveAs
I want to find all the "unch" and replace it with the number 0. I have added
the working code and the new attempt.
There could be multiple instances of the unch but I don't know how to setup
the loop. Any help would be greatly appreciated.
thanks,
Rogue
*********************WORKING CODE*************************
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
Set objWorkbook = objExcel.Workbooks.Open("C:\base\high.xls")
Set objWorksheet = objWorkbook.Worksheets(1)
objWorkbook.Sheets("sheet1").QueryTables(1).Refresh
WScript.Sleep 10000
Dim strNOW
strNOW = Now
Dim strYMD
strYMD = Right(100+DatePart("m",strNOW),2) &"-"
strYMD = strYMD & Right(100+DatePart("d",strNOW),2) & "-"
strYMD = strYMD & DatePart("yyyy",strNOW)
objWorkbook.SaveAs("C:\data\high" & strYMD & ".xls")
Set objWorkbook = objExcel.Workbooks.Open("C:\base\low.xls")
Set objWorksheet = objWorkbook.Worksheets(1)
objWorkbook.Sheets("sheet1").QueryTables(1).Refresh
WScript.Sleep 10000
objWorkbook.SaveAs("C:\data\low" & strYMD & ".xls")
objExcel.Quit
*********************END WORKING CODE************************
*********************TEMPORARY CODE*************************
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
dim txt
txt = "unch"
Set objWorkbook = objExcel.Workbooks.Open("C:\base\high.xls")
Set objWorksheet = objWorkbook.Worksheets(1)
objWorkbook.Sheets("sheet1").QueryTables(1).Refresh
WScript.Sleep 10000
Dim strNOW
strNOW = Now
Dim strYMD
strYMD = Right(100+DatePart("m",strNOW),2) &"-"
strYMD = strYMD & Right(100+DatePart("d",strNOW),2) & "-"
strYMD = strYMD & DatePart("yyyy",strNOW)
objWorksheet.write(Replace(txt, "unch", "0"))
objWorkbook.SaveAs("C:\data\high" & strYMD & ".xls")
Set objWorkbook = objExcel.Workbooks.Open("C:\base\low.xls")
Set objWorksheet = objWorkbook.Worksheets(1)
objWorkbook.Sheets("sheet1").QueryTables(1).Refresh
WScript.Sleep 10000
objWorksheet.write(Replace(txt, "unch", "0"))
objWorkbook.SaveAs("C:\data\low" & strYMD & ".xls")
objExcel.Quit
*********************END TEMPORARY CODE********************* Tag: How to count the number of linked objects in MSWord? Tag: 193632
DEP Disabled but still intercepting script files referenced on sha
Hello All,
Am hoping that someone here will be able to provide some insight on this
problem:
VBS scripts that run locally without issue (after DEP disabled) will not run
when referenced from their remote (file server share,
\\server\share\whatever.vbs) location. The DEP type message box pops up even
though DEP is disabled globally on the server via the boot.ini file.
When run within a scheduled job, the scripts just die silently and fail to
complain in any log file. On non SP1 2003 machines without DEP the scripts
function normally when referenced from their remote location as indicated
above.
Platform: Windows 2003 SP1, Intel XEON processors - Hardware DEP support,
DEP turned off with /AlwaysOff switch in boot.INI. Verified on server by
running wmic OS Get DataExecutionPrevention_SupportPolicy.
Anyone have any insight as to what I am missing here?
--
FourEyes
www.fixitcrew.com Tag: How to count the number of linked objects in MSWord? Tag: 193631
set wallpaper image from URL
I want set Windows desktop Wallpaper picture via vbscript.
Here is two scripts, but both take image from local drive; instead, I
want upload image from URL. How to implement this?
'--------------------8<----------------------
Set oShell = CreateObject("WScript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")
sWinDir = oFSO.GetSpecialFolder(0)
sWallPaper = sWinDir & "\Coffee Bean.bmp"
' update in registry
oShell.RegWrite "HKCU\Control Panel\Desktop\Wallpaper", sWallPaper
' let the system know about the change
oShell.Run _
"%windir%\System32\RUNDLL32.EXE
user32.dll,UpdatePerUserSystemParameters", _
1, True
'--------------------8<----------------------
'---------------------8<------------------------
Dim WshShell
Set WshShell = WScript.CreateObject("Wscript.Shell")
WshShell.RegWrite "HKCU\Control Panel\Desktop\Wallpaper", mybitmap.bmp
WshShell.Run "%windir%\System32\RUNDLL32.EXE user32.dll,
UpdatePerUserSystemParameters", 1, False
Set WshShell = Nothing
'--------------------8<----------------------
mistral Tag: How to count the number of linked objects in MSWord? Tag: 193629
Need suggestion how to hide ugly black command prompt window
There are some scripts we use for transfering data, and they look
something like this:
...
Function CMDResults(cmdline)
Set oShell = CreateObject("WScript.Shell")
Set oExCmd = oShell.Exec(cmdline)
Set oExCmdStdOut = oExCmd.StdOut
Do: WScript.Sleep 10
Do Until oExCmdStdOut.AtEndOfStream
CmdResults = CmdResults & oExCmdStdOut.ReadAll
Loop
Wscript.Sleep 1000
Loop Until (oExCmd.Status <> 0 and oExCmdStdOut.AtEndOfStream)
Logiraj cmdline
Logiraj CMDResults
End Function
...main program starts here...
Do While Not (txtStream.atEndOfStream)
Linija = txtStream.ReadLine
sExec = "cmd /c copy X:\transfer\tra\out\" & Linija & " c:\tran\S" &
p_sifra & "\PRIHVAT /Y" & Chr(13) & Chr(10)
sResult = CMDResults(sExec)
If InStr(1,LCase(sresult),"1 file(s) copied") > 0 Then
...what to do if copying a file succeded...
End If
Loop
Set oFSO = Nothing
...
What this script does it copy file via plain "cmd /c copy" and retrieve
result, so if result incorporates "1 file(s) copied" then copying a
file if considered success, otherwise not.
The problem is with this ugly black command prompt that pops up.
Is there a way i can hide the command prompt window or could I have
done this some other way?
Thank you,
Drazen Tag: How to count the number of linked objects in MSWord? Tag: 193626
Dial with a serial modem via vbScript?
How can I dial a certain number with a modem that is connected to COM1
(serial port)?
Is there a way to do this with vbScript? ... or do you know of a free
command line tool that can accomplish this?
Thank you in advance! Tag: How to count the number of linked objects in MSWord? Tag: 193625
Read httpPOST response in .hta form
I was hoping someone could help me figure out how to get the response from an
http POST request when using a form-based submit in an HTML application (hta).
This may not even be the right approach... what I really need is to use an
hta to obtain a cookie from a website, and then use that cookie as
authentication on another website where I will submit data via another POST
request with XML content. Both sites are in the same domain.
This is my first complex hta and first time coding http requests, so I am
slightly confused:
How can I securely collect the logon credentials from the user, and submit
that to the first site, parse the response without opening a new window or
overwriting the current hta window, 'store' the cookie included with the
response, and then use that cookie to POST to the second site?
If I collect the user/password info using text boxes in a form, and use a
submit button, what object or property do I reference to obtain the response
and the cookie?
Won't the submit action from a form cause the hta window body to be
overwritten with the response?
ANd I have looked into using the XMLHTTP object, but can not seem to find
the reference API for the one INCLUDED with IE (I cant depend on the latest
version of MSXML being installed). Plus, if I go that route, I am confused
how I parse the login and password fields into the XMLHTTP.Send method.
Any help to me going in the right direction on this would be highly
appreciated. TIA.
Keith Jakobs Tag: How to count the number of linked objects in MSWord? Tag: 193623
Weird error in MID / LEFT functions
Hi everybody
I want to use transactions in my asp pages. In order to assess whether
it is a successful transaction or not, i check for the ASP Error
Object, if there are errors, changes are rolled back. a common approach
(and the only one i know of..)
Now this is my problem:
When I try to read form data I get an error, the transaction is rolled
back. This is the code i am using:
stockFieldname = "stock_" & itemArrSize(i) & "_" & itemArrShop(j)
numOfUnits = Request.Form(stockFieldname)
The issue is with the second line. I tried everything I could think of,
even extracting the value from the whole Request.Form string, but i
failed: the MID function raised an error.
I am at the end of my imagination of how to resolve this. Any help is
very much appreciated!!
Thanks
Claude Scagliola Tag: How to count the number of linked objects in MSWord? Tag: 193617
60 plus accounts but I am not a network admin
Hi there gurus
May be some one can help me
In my company I am responsible for lots of non user accounts, which are
being used for various purposes. I don't have access to AD or any
thinglike that. each time we are suppose to change the password, I
will go a machine, hit CTRL, ALT DEL and select chnage password.
Since I know the existing password, I will plug in old password and
then twice the new password for all these accounts.
Is there a way I can automate this, I am not a network admin and don't
know the OU for these accounts, all I know is the password.
Can some one give me some hints Tag: How to count the number of linked objects in MSWord? Tag: 193616
create text file from script
I was under the impression that creating a text file from script was
"prohibited," yet the following code [embedded in a web page] allows me
to do so. The code was taken from the following page:
http://www.microsoft.com/technet/scriptcenter/scripts/misc/web/mswbvb43.mspx?mfr=true
Sub RunScript
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CreateTextFile("test.htm")
Set objFile = objFSO.OpenTextFile("test.htm", 2)
objFile.WriteLine DataArea.InnerHTML
objFile.Close
End Sub
Is the above code breaking any rules of any kind in application
development? I would like to employ something like this in my hta if
it's not deemed inappropriate application development.
Thanks for sharing your thoughts on this. Tag: How to count the number of linked objects in MSWord? Tag: 193614
Useing result from GetAbsolutePathName as source for FileCopy??
I am attempting to write a script to automate a file copy step in an
installation process. Specifically to copy a .dll file from the installation
folder to the System32 folder. The problem is that I cannot be certain of the
path of the source file. My thought was to use GetAbsolutePathName to return
the path of the file then use the result as the source for FileCopy.
Unfortunately, that didn't work. Can anyone assist?
Thanks
Debra Tag: How to count the number of linked objects in MSWord? Tag: 193612
Disconnected Recordsets
I'm working on a script that is grabbing the UNC path, the date last
modified, and the creator owner for all folders and files in a specific
directory and feeding this data into a disconnected recordset. Pretty
much using the code as given in the Windows 2000 scripting guide to
populate the recordset and do a sort. The goal is to sort by
creator/owner and then feed each unique user ID into an array to be
used later in the script. Since a creator owner can appear in the
Owner column for each file they own, I need to have a way to have that
ID only appear in the array once. SQL has a "distinct" clause which
would do the trick, but I have no idea how to do this in a disconnected
recordset. Any samples I've seen in the MSDN are for VB and I'm not
sure how to translate those into script. My guess is that SQL command
would look something like "SELECT DISTINCT [column] FROM [table]".
However, I don't know which method/property to use to create the SQL
command, and a disconnected recordset doesn't seem to have a table
name... Tag: How to count the number of linked objects in MSWord? Tag: 193607
Get Hostname from FQDN from DNS
Hi,
I am using sysprep to install Windows XP on computers in computer
laboratory at my school.
My problem is that each box have same computer name or randomly
generated one by sysprep. I would like to have specific hostname on
each box based on it's FQDN from DNS server. I figured out that I
should use WMI for that and rename method from W32_ComputerSystem
Class. But I don't know how I can resolve hostname from IP/FQDN. Could
anyone show me the way to resolve the problem?
P.S. Sorry for my poor english
--
Maciej Nadolski Tag: How to count the number of linked objects in MSWord? Tag: 193603
Dismissing annoying popup alert by script
Ok, so I have this Microsoft wizard which i can configure to execute in
unattend fashion. However, in true MS style, the unattend wizard throws up a
dialogue box requiring user intervention once it completes. This causes my
script to never continue executing and complete. I would like to find a way
to dismiss this dialogue box through script. I've been reading up on SendKey
method, and this sounds like it would do what i want. The problem though, is
that I'm not sure how best to get this to execute. I've copied my code below.
I'm calling the wizard through the 'Run' Method with the WaitOnReturn value
set to 'false', so as soon as i kick it off, the script continues to execute
and i can call the SendKeys method. Now the wizard that i've just invoked
performs a lot of file copying, and as such the time this takes could vary
from server to server. I've invoked a DO While loop immediattely after
invoking the wizard, but not sure how best to set a condition for the loop
to, well loop. :)
I've thought about using the return code from the Run method, but I'm not
sure if this is ever updated, once i've invoked the wizard. Anyway, i'm
babbling now. Any chance someone can look at the below for me :
Function fnCompRisetup(strScriptDir)
Dim ObjRunSh, ObjSendKey, strAppName, strSendKey1, strRunCmd, intRetCode,
intCount
set ObjRunSh = CreateObject("Wscript.Shell")
Set objSendkey = CreateObject("Wscript.Shell")
strAppName = "Authorizing DHCP"
strSendKey1 = " "
strRunCmd = "risetup.exe /AUTO " & strScriptDir & "\rissetup.inf"
intRetCode =0
fnWriteLog("Executing " & strConfiguration)
intRetCode = ObjRunSh.Run(strConfiguration, 1,false)
fnwritelog("Return Code :" & intRetCode)
fnwritelog("Starting Loop until condition equals ")
Do While intRetCode=0 '1
or
Do While intCount < 100000
fnwritelog(strRetCode & " Returned.")
fnwriteLog("Switching to Application" & strAppName)
ObjSendKey.AppActivate(strAppName)
fnwritelog("Sleeping...")
sleep 100
fnwritelog("Sending SendKey 1" & strSendKey1)
ObjSendKey.SendKeys(strSendKey1)
fnwritelog("Complete SendKeys - Exiting")
intCount = intCount+1
Loop
Set ObjSendKey = Nothing
End Function Tag: How to count the number of linked objects in MSWord? Tag: 193602
edit local security or audit policies
I have a script which configures a lot local settings when we build a new
Windows (2k3) server. About the only thing I haven't been able to configure
with the script is the local security and audit policies that our SOP
requires.
I've been searching the net for a week and haven't found anything yet.
How can I script to edit local security or audit policies for WinSvr 2k3?
Thanks for any help or suggestions!
-Steve Tag: How to count the number of linked objects in MSWord? Tag: 193600
Single logon script per user, multiple computers
Hi,
I have a network which consists of desktop PC's, Workstations, a Server
and some Laptops.
Each platform has Win XP Pro SP2 deployed on it.
The Server contains the data and files for all users and each user has
a roaming profile.
If a user logs onto the network at a desktop they need to have their
data uploaded from the Server. When they logoff the Server is updated.
Same story for Workstations and Laptops.
However, the startup and startmenu needs to be different and depends on
the platform that the user is logging onto. For instance, when a user
logs onto a Laptop the software for the Mobile Office Card (3G) needs
to initialise. When the user logs onto a Workstation they need to have
the software compilers in the Applications Menu and no MOC
initialisation as the workstations have no MOC. When they are on a
Desktop they need the entertainment software and not the compilers and
MOC and so on.
How do I create a logon script that recognises the platform that the
user is logging onto and then puts the right applications at their
disposal? Tag: How to count the number of linked objects in MSWord? Tag: 193595
VBScript Writting to the Event log
Is there a way to write to the event log but be able to specify the
"Computer" field?
Using the Shell.LogEvent we only have type and description available to us
to use and the eventcreate command line utility does not have this field
either.
This problem comes in when you write an event to a remote computer, The
"Computer" field will show up as the souce computer and not the remote
computer. Tag: How to count the number of linked objects in MSWord? Tag: 193594
Getting window handles...
Hi...
I have a script that opens an IE window using:
Set objIE = CreateObject("InternetExplorer.Application")
And then I'm doing:
intHWND = objIE.HWND
To get the window handle.
Then, in another part of the script, I want to check that the window
hasn't been closed before trying to modify its properties. Is there
some sort of dream function that works something like:
boolIEWindowOpen = GetWindowHandle(intHWND)
...that'll return true or false if a window with the supplied handle is
open or closed?
Here's hoping!
//Plankmeister Tag: How to count the number of linked objects in MSWord? Tag: 193581
setting home director using vb script
Hi,
I am a newbie to scripting.
Im try to set homedirectory for particular users in a group using
script.(using wsh)
Can anyone provide me the solution for it.
cheers,
Nuti Tag: How to count the number of linked objects in MSWord? Tag: 193577
Patches
Looking for a script verify patches install on a server or multiple servers.
thx Tag: How to count the number of linked objects in MSWord? Tag: 193576
wScript.Shell Problems
I am in the process of building a script to FTP files to another
location. What i am curious to know is how can i dump what is being
sent displayed in the comand window to a text file. Here is my code.
And you will see that i am not getting anywhere.
The two variables being sent to the Function just contain FTP Commands
and the OutputFileName such as
strCMD = "PUT test.txt rmdirectory/test.txt" & vbCrLf
oFile = "C:\output.txt"
Function FTP( strCMD, oFile )
Dim objFSO
Dim strFile, objTempFldr, objFile, objRegExp
Dim objShell, WSX, ReturnCode, Output, strLog, strErrorLog
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set oFileFSO = objFSO.OpenTextFile(oFile,2,True)
set objTempFldr = objFSO.GetSpecialFolder( 2 )
strFile = objFSO.GetTempName
strFile = objTempFldr & "\" & left(strFile,Len(strFile)-4) & ".ftp"
if not objFSO.FileExists( strFile ) then objFSO.CreateTextFile(
strFile )
Set objFile = objFSO.OpenTextFile( strFile, 2, True )
objFile.WriteLine( strUser )
objFile.WriteLine( strPass )
objFile.WriteLine( Mode )
objFile.WriteLine( strCMD )
objFile.WriteLine( "bye" )
objFile.Close()
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run "cmd /c " & COMMAND_FTP & strFile & " " & strHost,1,TRUE
set objFSO = nothing
End If Tag: How to count the number of linked objects in MSWord? Tag: 193569
MS Visual C++ Debug Library
Serveral workstations in my network receive a 'debug assertion failed' alert,
when browsing the web and / or using word, outlook etc, how ever you respond
to this 'alert' it simply closes whatever your working on, web page, word
document etc and your work is lost!! but then you can go back to the same web
page and every thing will work fine?
'debug assertion failed'
Program: C:\Program Files\Internet Explorer\iexplorer.exe
File: dbgdel.cpp
Line: 47
Expression: _Block_Type_Is_Valid(pHead->nBlockUse)
For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.
Can you help!!
is it some thing left over fron a spyware/anti spam program now uninstalled? Tag: How to count the number of linked objects in MSWord? Tag: 193568
list templates in MS Word files with VBScript
Hello All,
I am trying to write a script that scans a drive, and searches for all
*.doc files, and then prints out the file name of the DOC file along
with it's attached template (as we are currently having problems with
non-existing templates on the network).
This is what i have so far, but it is not giving me the desired result.
Any help would be greatly appreciated!!
SCRIPT:
'===================================================================
Dim file, template
Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Add()
objWord.FileSearch.FileName = "*.doc"
objWord.FileSearch.LookIn = "C:"
'objWord.FileSearch.SearchSubfolders = True
objWord.FileSearch.Execute
For Each objFile in objWord.FileSearch.FoundFiles
file = objFile
'Send filename to Sub
FindTemplate file
Next
Sub FindTemplate(byVal Template)
wscript.echo "File: " & template
Set objDoc1 = objWord.Documents.Open(Template)
For Each objTemplate in objWord.Templates
Wscript.Echo "Template:", objTemplate
Next
End Sub
'================================================================== Tag: How to count the number of linked objects in MSWord? Tag: 193566
Error handling bug on GetObject?
Hi,
I seem to have hit a bug in the error handling of VBScript. I ran into the
problem when trying to assign a user to a group, but the group doesnâ??t exist.
If Error Handling is not turned on, then the script crashes on the GetObject
statement as expected. However, I want to catch and log the error, and
continue on with the script. So, I used the normal code:
Set objGroup = GetObject(â??LDAP://cn=Sales,cn=Users,dc=fabrikam,dc=comâ??)
If Err.Number <> 0 Then
WScript.Echo â??Error â?? unable to bind to groupâ??
Else
WScript.Echo â??Group boundâ??
End If
In a main routine, this code behaves exactly as expected. However, if I put
this code into a Function, like so:
On Error Resume Next
If SetGroup() Then
WScript.Echo "Set Group Fine"
Else
WScript.Echo "Set Group Failed"
End If
Function SetGroup()
SetGroup = FALSE
set objGroup = GetObject("LDAP://cn=Sales,cn=Users,dc=fabrikam,dc=com")
WScript.Echo "Did we get to this line?"
If Err.Number <> 0 Then
WScript.Echo "Error"
SetGroup = FALSE
Else
WScript.Echo "Fine"
SetGroup = TRUE
End If
End Function ' Set Group
The Error Handling code no longer runs. Instead the Script drops out of the
function back to the main routine. The WScript.Echo directly after the
GetObject was added to verify that the problem was on the GetObject line, not
with the Error Handling afterwards. In this simplified sample program, the
program does not crash at the GetObject (though it will, as expected, without
the On Error Resume Next), instead it simply drops back to the main routine.
In this particular case, reporting â??Set Group Fineâ??.
The full script where I ran into this problem is much more complicated, and
the GetObject is in nested routines. The main routine calls a subroutine,
which calls another subroutine, which calls the function that contains the
GetObject statement. In this complex program, the script drops all the way
back to the main routine, not just out of the Function.
So far, I have not found any code examples for testing for the existence of
a Group the way I can test for the existence of a file. With the GetObjectâ??s
incorrect behavior when an error occurs Iâ??m not even sure how such a test can
be written and incorporated into real-world scripts, as such error handling
belongs in a Function or Subroutine. In most complex scripts you probably
wouldnâ??t even know the data you are looking for until you were into a
subroutine or function.
Any help would be greatly appreciated.
Jim Winner
Program Manager
The Catholic University of America Tag: How to count the number of linked objects in MSWord? Tag: 193562
VBS Output for Multiple Video Cards
I am currently working with a systems inventory script & database. I am
running into a problems where computers have multiple video cards (for
dual displays) an I am unable to place them in an access table
correctly. Any help would be greatly appreciated, thank you in advance.
The current section of my script that deals with video is:
Set colVid = objCallWMI.ExecQuery ("SELECT * FROM
Win32_VideoController")
For Each objVid In colVid
recADO.Fields("VideoCard1").Value = objVid.Name
(The following line is not in my code but a sample of what I am trying
to do)
recADO.Fields("VideoCard2").Value = objVid.Name
recADO.Fields("VideoRAM").Value = Int(objVid.AdapterRAM/1048576) & "MB"
recADO.Fields("VideoDAC").Value = objVid.AdapterDACType
Next Tag: How to count the number of linked objects in MSWord? Tag: 193557
Change Shortcut icon via Vbs
Hi , I need change the icon of a ShortCut via Vbs on login Scripts.
Ex: This is the Script than i use to create the ShortCuts
Set objShortcut = objShell.CreateShortcut(DesktopPath & "\" & CompanyName &
" New Corporate Website.url")
objShortcut.TargetPath = "ht*p://xxxxxx/"
objShortcut.Save Tag: How to count the number of linked objects in MSWord? Tag: 193555
Edit a remote registry help
Hello,
I'm looking for a code sample to edit some registry values on remote
Win2k / win2k3 servers. I'll need to connect to the remote machines
using different credentials than those running the script.
Got any samples for me?
Thanks,
Troy Tag: How to count the number of linked objects in MSWord? Tag: 193554
Change drivers ACPI to Standard PC
Hello
I've got a need to change a driver and was hoping I could do it via a
vbscript instead of going through the Windows Hardware Update Wizard.
In device manager, my computer is set up as a ACPI Pc and I need to change
that to a standard pc.
Anyone know how to accomplish that.
Thanks Tag: How to count the number of linked objects in MSWord? Tag: 193552
changing COM+ application settings
Is there a way to use VBS to change the Identity information on the
properties of an application in component services?
We have to change the password of the account that is in use for this
identity, and it's locally set on my clients. I'm looking for a way to
change this setting without having to visit each client.
Thanks! Tag: How to count the number of linked objects in MSWord? Tag: 193544
RE: http://cwashington.netreach.net/
What happened to W32scriping ...
http://cwashington.netreach.net/main/default.asp?topic=library
did the sight move or did something else happened to it? it was a great
resource for scripting.
Marcus Tag: How to count the number of linked objects in MSWord? Tag: 193535
need to post form data via vbs (not asp)
lets say i have a webpage with the following very simplified form:
<form action="somepage.asp">
<input name="username">
<input name="password">
</form>
so when this form is submitted the values in the 2 input fields get sent to
the asp page.
i want to do this without using a browser by simply clicking a vbs file on
the desktop.
can i do it simply? Tag: How to count the number of linked objects in MSWord? Tag: 193525
Error compacting access database
I'm trying to compact an access database from a vbs script with the
following code:
Set objAccess = CreateObject("Access.Application.11")
objAccess.DbEngine.CompactDatabase strDB, strTempDB
Set objScript= CreateObject("Scripting.FileSystemObject")
objScript.CopyFile strTempDB, strDB, True
objScript.DeleteFile strTempDB
It worked great while I executed it in my Windows XP, but from the moment
it's running on a Windows 2003 Server, I get a 424 error (Object required)
most of the times (not always)... What could be the cause??
Thank you in advance !!
Bernardo Achirica Rodriguez
IBERIA L.A.E. - Dirección de Sistemas
Subdirec. Producción / U. Producción Red
Tfno. +34 91 587 56 72
bachirica [at] iberia [dot] es Tag: How to count the number of linked objects in MSWord? Tag: 193519
script for getting os version
hi,
how can we ge the version of os installed using script. Tag: How to count the number of linked objects in MSWord? Tag: 193517
How can I find the number of total object links(excluding hyperlinks)
in a word documents?
Thanks so much.