vbscript

Remove MS Word macro using VBScript

I want to remove all vba-modules from an MS Word template using VBScript. I wrote the following script. const wdDoNotSaveChanges = 0 WScript.Echo "starting Word..." Dim oApplication, doc Set oApplication = CreateObject("Word.Application") WScript.Echo "opening template..." oApplication.Documents.Open "path\to\test.dot" Set doc = oApp...

16-Bits BMP Validation

I'm developing a script using VBScript and I need to validate the input file as a 16-Bits BMP. At the time my script is like this: Const OverwriteExisting = TRUE Set objFSO = CreateObject("Scripting.FileSystemObject") objFSO.CopyFile "C:\16bmp.bmp" , "D:\test.bmp", OverwriteExisting But How can I validate the input file as a 16-Bits...

Writing a VBScript serializer

I need a purely text serialization of an object in VBScript. Does VBScript provide any built-in support for serialization or is it up to me to enumerate the properties and put them in a string? ...

VBScript implicit conversion in IF statement different from variable to literals ?

We are currently having an issue due to implicit conversion in an IF statement in VBScript (Classic ASP) that don't do implicit conversion the same way when dealing with a variable or a literal. Can someone explain this behavior to me, why do VBScript acts this way ? Here is a sample of what I mean : Const c_test = 3 Dim iId : iId = 3 ...

VBscript - Add list of computers to domain group

Hi, this is probably pretty simple, but I've got this text file containing a bunch of computernames that I want to add as members of a certain AD Group. Thing is, I don't know the CN or full path of the computer names, because the computers may lie on three different OUs in the Domain structure. So, I the code I've got so far is this (...

Count what number that appears the most. In VBScript

Hello I got this comma separated file with a bunch of numbers The only thing that I need to be able to do is to find what number that appears the most time Ex: 817;9;516;11;817;408;9;817 then the result will be 817 I hope you understand what I am trying to do. ...

Adding byte to the recordset works, adding same to a stream does not

A file is submitted, that file is put into a blob in a database (.AppendChunk), and that file should also emailed. What I want to do is: File is parsed from the form data into a variable (done). Variable is inserted into database (rs(key).AppendChunk var) (done). That variable is attached to an email (failing). However, if I read back w...

MS-Word bookmarks with VB script

Hi All, I have a classic ASP application which inserts some values into a word file using bookmarks. I can insert text on the bookmarks. The only problem is checkboxes, I have some checkboxes in document. I have created bookmarks on checkboxes. Can someone tell me how to tick the checkboxes through VB script? Thanks. ...

Get first record from WMI ExecQuery

I have a simple vbscript for retrieving Windows version: Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2") Set colVersions = objWMI.ExecQuery("Select * from Win32_OperatingSystem") For Each objVer in colVersions ver = objVer.Version Next Is is possible to get the first record or do I have to loop o...

How do I determine if VBScript is running in RDP Console?

I have an MSI installer that fails if it is running over remote desktop. (Unless it is run with the /admin or /console option so that it gets session 0) I want to use a VBScript custom action to determine if I am running as Session 0. I've learned that I can use two WMI calls to determine this: GetCurrentProcessID() ProcessIdToSessi...

Copying Files Using NSBasic/CE 7.0

I'm using NSBasic/CE 7.0 and I'm needing to copy a file, but I don't know how to copy using this program, but at the time I already have this: AddObject "cecomdlg.commondialog.1", "ComSvDlg", 0, 0, 0, 0 Sub saveDialog() ComSvDlg.CancelError = 0 ComSvDlg.DialogTitle = "Copy" ComSvDlg.Filter = "All Files|*.*" ComSvDlg.ShowSave ...

CDOSYS and Unicode in the from field - vbScript.

I've got the code below, and I'm trying to set the from field to allow unicode. Currently in my email client I get "??". The subject line and any content shows the unicode correctly. And looking at the MSDN the property should be "urn:schemas:httpmail:from". Anyone solved this issue? Thanks M Dim AC_EMAIL : AC_EMAIL = "[email protected]...

How can I send an e-mail from a vbs script

How can I send an e-mail from a vbs script - on a machine that cannot connect to the internet (it's in my non-internet zone). I've hacked the following together from my googling, but is seems to require a call to Microsoft's server. What about the situation where I'm not able to reach microsoft.com? sch = "http://schemas.microsoft.com/...

automation of data format conversion to parent child format

This is an excel sheet which has only a single column filled for each row. (explanation : all CITY categories fall under V21 , all handset categories fall under CityJ and so on ) V21 CITYR CITYJ HandsetS HandsetHW HandsetHA LOWER_AGE<=20 LO...

Clearing clipboard using VBScript

How to clear clipboard using VBScript on Win32? ...

how to get image width with server-side vbscript? Asp classic

Hi, I have been trying for days to find a way to get the image width of .png files which reside on our server. I am trying to read the first 24 bytes of the file and parse out the width from bytes 17-20. I have found several routines on the web but have not been successful. Strangely enough, it seems I am getting the height from byte...

jquery datatables using classic .asp

Hi there, I am trying to get the jquery datatables plugin pulling data using VBScript instead of PHP as shown on their website. Has anybody any advice on where to start or maybe seen this already implemented somewhere else? Any assistance would be great! Cheers! Decbrad ...

VB Script - how to spoof referring URL in Firefox programmatically?

Hi All. I am working to enhance some features of a web based apps. Sometimes for legitimate purposes you may want to spoof the referring URL when opening a web page. Constraints: Javascript disabled (as a company policy), browser: Firefox. Language: VB scripting is a must. I tried: Option Explicit Dim objShell, url, referringUrl url="ht...

Does COM automatically unload DLLs when there are no more object references?

For example, in language X: let x = CreateOject( "MyProgID" ) x.LateBoundCall() x.Release() // (or setting x to Nothing in VB-like language, etc) What happens to the DLL MyProgID lives in? Does COM unload DLLs automatically? EDIT This is assuming that the code above is in an executable that does not expose any COM. ...

How to solve "catastrophic failure" with 32-bit COM component in SysWOW64\cscript or wscript

I'm trying to run a VBScript script that uses a 7-year-old 3rd-party 32-bit COM component on Windows Server 2008 R2, with the command-line 32-bit script host, SysWOW64\cscript.exe. When I call CreateObject on the class, it appears to be successful, but the very first time I try to use a property or method (I've tried several different ...