vbscript

vbscript optimization : how to get faster file writing

The following is the usual log function I utilize in alot of my vbscripts which I modify accordingly. I feel it writes too slow. I got 3 questions: Any ideaas on how to optimize this so it writes faster? Would it be faster to store all text in a string first then run the function OutputToLog or would it be faster to execute Output...

Can I replace content in an ASP (Classic) include?

Say I have "default" content on the left side of my application, which is included in a header page: a search box and a login box. If the user is on the search page, I want to also add a list of search filters (e.g. brand, price) to the left side of the page; in this case the left side needs to access the parameters given to the search ...

Read user rights using VBscript

I'm trying to determine whether a user (the one running the script, with or without run as) has certain user rights policies applied. Since secedit /analyze refers only to the actual setting and ignores privilege propagation by group membership, it is useless in this case. I'm referring to these privileges: SeTcbPrivilege SeIncreaseQuot...

Base64 Encode String in VBScript

I have a web service load driver that's a Windows Script File (WSF), that includes some VBScript and JavaScript files. My web service requires that the incoming message is base64 encoded. I currently have a VBScript function that does this, but it's very inefficient (memory intensive, mostly due to VBScripts awful string concatenation) ...

How do I return an array from a Visual FoxPro 9 OLEPUBLIC class?

As a newbie to FoxPro (but an old-hand at Clipper), I'm a bit at a loss to figure out how to return an array from the following OLEPUBLIC class. edit: I've modified the code belw to take into consideration the remarks made by @Stuart below. DEFINE CLASS db AS CUSTOM OLEPUBLIC DIMENSION ada(1) && public scope for later return FUNCTI...

Using CreateObject("Excel.Application") - issues with unsigned control

Hi all We have a legacy ASP page that writes content to an excel file by generating client-side VB script based on data from the database. It uses set app = CreateObject("Excel.Application") to initialize Excel. The problem is that this is an "unsigned activex control", and some clients are now saying they wont change their IE settings...

IIS Permissions for Saving Word Documents

Our ASP.NET/C# lets users edit and manage Word (OpenXML) documents that are hosted on a server. I am using client-side VBScript functions to handle some of the editing functions including saving the document to a folder on the server. For the save functionality, I am using the following function call : Document.SaveAs "http://server/sav...

full screen mode (25*80) command line scripting

when you run a script (such as vbscript) from 25*80 (full screen mode of dos prompt) and that your script call a windows application (such as notepad), at the end of the operation, focus remains on the desktop (although "command prompt" at the taskbar minimized and wait for only one "{enter}" to go back in 25*80 full screen command promp...

vbscript: test for existence of a column in a recordset

Bah, vbscript. I'm trying to figure out how to get this statement to work: if (not rsObject("columnNameThatDoesntExist") is nothing) then ' do some stuff end if ' else do nothin Where rsObject is a RecordSet and columnNameThatDoesntExist is ... well you know. I'm looking for something like rsObject.Columns.Contains(string). But of...

Windows - VBScript - Determine IP address of computer on network

I have written some VBScripts to automate tasks that I perform on computers over the network. These work great for most tasks however within our network we have problems with the IP address in DNS being correct all the time. This mainly occurs with laptops where we have different IP ranges for machines on the wireless and wired network...

code critique - am I creating a Rube Goldberg machine?

I'm making a fair amount of calls to database tables via ADO. In the spirit of keeping things DRY, I wrote the following functions to return an array of values from a recordset. Is this hare brained? I use it mainly for grabbing a set of combo-box values and the like, never for enormous values. Example Usage (error handling removed for...

Dynamically creating Office Open XML documents: update all fields on open

I am programmatically generating an Office Open XML document (Word 2007 format), and would like to have all the fields updated when the document I generate is first opened in Word. When I researched this a while ago, the only way to do this was to run VB Script when the document opens. But VB Script doesn't run by default, and for this ...

Get the URL string a user entered when using .htaccess

I'm currently using an htaccess file to redirect users from detail.asp?CategoryID=XX&SubCategoryID=XX&ProductID=XX to catid-XX-subcatid-xx-productid-xx but I now need to check they've arrived at the correct page. I'm doing this by checking that the query string values are correct. However I'd rather check that the user arrived at "...

How to compare locale dependent float numbers?

I need to compare a float value entered in a web form against a range. The problem is that the client computers may have various locale settings, meaning that user may use either "." or "," to separate the integer part from decimal one. Is there a simple way to do it? As it is for an intranet and that they are only allowed to use IE, a ...

OpenTextFile on a remote computer

Hello I'm trying to read remote text files using this code: function defdate(ipaddress) deffilePath = chr(34) & "\\" & ipaddress & "\c$\" & deffileName & chr(34) wscript.echo deffilePath set deffile = objFSO.OpenTextFile(deffilePath) do while not deffile.endofstream s=deffile.readline wscript.echo s loop deffile.c...

How do I run a .vbs file from within Microsoft Script Editor?

Is it possible to open Microsoft Script Editor, then from within the editor open a .vbs (VBScript) file, then run/debug it? I know I can use the command-line cscript (filename) //X to launch the file, allowing me to select Microsoft Script Editor as the debugger, but I want to do everything from within Microsoft Script Editor. I am awa...

Can you declare a constant array in VBScript?

I want to use an array that I declare once at the top of my code several times. Ex. Const Quarters = ["Q1", "Q2", "Q3", "Q4"] For each Quarter q q.Do some work Etc. Can this be done in VBScript? ...

Are there restricted characters in ADO varchars?

We have a simple file browser on our intranet, built using ASP/vbscript. The files are read by the script and added to an ADO Recordset (not connected to a database), so we can sort the contents easily: Set oFolderContents = oFolder.Files Set rsf = Server.CreateObject("ADODB.Recordset") rsf.Fields.Append "name", adVarChar, 255 r...

VB Type Mismatch issues - inArray()

...

Visual Studio Project Template for JavaScript/VBScript?

Has anyone had luck finding a Visual Studio Project Template for JavaScript and/or VBScript? I would like to use VS as my script IDE but get frustrating with the lack of integration. I'm hoping someone else was just as frustrated as me and already came up with a solution. ...