vbscript

VBScript : format of a date used for initialisation

In a VBS script, I need to initialise a variable with a date. In my country, we usually specify a date with this format : day month year Here is what I'm trying to do in my VBS script : Date = #07-06-1973# MsgBox FormatDateTime(Date, vbLongDate) but the date I get is July the 6th, where I was expecting June the 7th ! Now, as it see...

Calling a vb script from a asp.net / C# webpage

Hi all, I have written an ASP.NET web page with C# behind that runs an existing vb script. The idea is that the user uploads an Excel spreadsheet (.xls) using the web page, the C# does a few basic checks on the file (file type, file name etc) then saves the .xls to a network location. The C# then passes the network path of the .xls to...

Classic ASP "ExecuteGlobal" statement acting differently on two servers

I have a strange problem that I don't really know how to handle. In addition to developing a new ASP.NET site, I have to support the old "Classic ASP" site. It's written in VBScript with a batch of Javascript functions as well. Many of the Javascript functions are in 'include files'. Debugging these hasn't been a problem once I learn...

Restricting Save Location in Web Application?

I have a web application (ASP.NET MVC, running on IIS7) that exports files to CSV. All was fine and well, until the client requested that due to security concerns, only specific directory locations should be valid targets for the resulting "save" dialog when I send the correct MIME type and send all the data. Is this possible? An alter...

Dictionary/Client VS Application Variables

Hi i got a question about my server performance ... i got a classic asp cms hosting ~250 websites, for each website we build a Classic ASP dictionary using set dict = CreateObject("Scripting.Dictionary") dict.add "test1","Value Test1" dict.add "test2","Value Test2" dict.add "test3","Value Test3" that dictionary is then loaded on eve...

Dictionary Type mismatch in VBScript

The error I'm receiving is: Type mismatch: 'stylesheets' Stylesheets is defined as: sub stylesheets(collection) for each key in collection.Keys response.write(stylesheet(key, collection.Item(key))) next end sub ' returns a link tag for each object in the collection function stylesheet(asset, media_type) if (media_type...

VBScript: Check if the script has administrative permissions

I would like to check (by VBScript) whether the context in which the script runs allows me to perform administrative tasks. Requirements: The solution should work on all Windows operating systems starting with Server 2003. (This rules out solutions which just check for membership in the Administrators group -- remember that there's UA...

IE VBScript HTC Behavior - Static Variables between all Instances of Behavior?

I'm not 100% sure what question I should ask - as I'm too sure on the best way to do this .. so let me describe what I'm trying to do (using a simplified example) and we'll go from there. You have arbitrary HTML Elements (IMG, A, TD, whatever). Via the CSS they are assigned an HTML Behavior .BoldSelection { behavior: url(SelectBo...

I need help with VBscript.

I'm working on a vbscript program and I have got and "Expected Statement" Error. I cannot find the error. I've seen some samples of this error but they didn't help me. I am new to vbscript. Here is the code. Sub SetText(tx, lw) Dim t, l, r, a t = -1 l = Len(tx) r = "" a = 0 While t < l t = t + 1 ...

How to Run VBS script from cmd?

I have the following vbs script from Microsoft Support for adding Excel add-in: Dim oXL As Object Dim oAddin As Object Set oXL = CreateObject("Excel.Application") oXL.Workbooks.Add Set oAddin = oXL.AddIns.Add("c:\Program Files\MyApp\MyAddin.xla", True) oAddin.Installed = True oXL.Quit Set oXL = Nothing I save the above script to a fi...

VBScript LDAP query to return mailserver property

Using the command line tool, ldapquery, the command is this: ldapsearch -h myldapserver uid=myloginname mailserver That returns a line like this: mailserver=CN=mymailserver/OU=xxx/O=xxxx I've tried every variation I can think of using VBS and I can query and get results returned from many other available properties, but some fail ...

Document Not Saved Error in Excel.

This is my code snippet for comparing 2 excel files. I call this function from my QTP scripts. I get this error quite often which causes my test script to fail. Any pointers will be appreciated. Set objExcel = CreateObject("Excel.Application") objExcel.Application.Visible = False objExcel.DisplayAlerts = False Set objWorkbook1= objExcel...

How can I add metadata to MP3s for Windows Media player from a script

I previously asked this question, but now I've gotten lazy and I'm trying to figure out how to do it from script (vbscript specifically). Specifically what I want to know is: How can I set Artist, Song Title, Genre, etc on a mp3 file from vbscript? Thanks ...

Get Application Installation Directory

I'm using some custom actions to install plugins into Firefox in an Installer project. Quickest path to ground thus far has been to use VBScript. Currently, I've been assuming the FireFox installation directory is "%PROGRAMFILES%/Mozilla Firefox". Obviously, this needs to change to cope with people doing non-standard installs. So, th...

HTTP Data Transfers

I am working on a method to transfer files using XmlHttp in VBS. The generic approach, set HTTP = WScript.CreateObject("Microsoft.XMLHTTP") Set Streamer = CreateObject("ADODB.Stream") Streamer.Type = 1' set to binary Streamer.Open Streamer.LoadFromFile(FSO.GetAbsolutePathName(Filename)) HTTP.open "POST", FinalUrl, true HT...

InfoPath Form Registration and Case-Sensitive File Path Strangeness: What's going on here?

Recently I had to troubleshoot a very strange issue with a fully-trusted InfoPath 2007 form at a customer site. The form is part of a records management application and users launch the form from within the application. However, because the form is subject to frequent updates, we store a "master" copy of the form file on the customer's...

asptear with webservice

Hi, I'm trying to get data from a web serivce with asptear. Does any one have an example for using asptear with asmx ? I'm using vbscript. thanks. ...

Changing the current directory of a FileSystemObject

When using a FileSystemObject you can reference the directory the script was run from by using the path ".". Is it possible to change what the FileSystemObject thinks is the current directory so you can use the "." path syntax for other directories? Example: Set fso = CreateObject("Scripting.FileSystemObject") Set f1 = fso.GetFold...

Psexec not outputting to log file in VB script

Hi all, I have a VB script which needs to run psexec to launch an app called md5 on a remote server. Md5 generates a hash key of a file and takes one parameter - the file path\name. I need to retrieve the has key that is generated to store in a variable. Below is the code I am using: Set objShell = CreateObject("Wscript.Shell") strcomp...

How to port BrowseForFolder from VBScript to C#/WPF?

I need some kind of dialog for browsing the local SMB network for file shares. VBScript does it like this. Set application = CreateObject("Shell.Application") Set folder = application.BrowseForFolder(0, "Moo!", &h250, &h12) ' &h12 sets ' Network as the root folder. So I added a reference to Forms and tried to do it with FolderBrowserD...