473,626 Members | 3,389 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

running VBS files

Anyone think of a cleaner/nicer/eleganter way of running VBS file in
ASP than this example?

(Goal is to re-use typical VBS code that uses 'wscrip.echo' without
having to re-write everything to use 'response.write '.)
<script language="vbscr ipt" runat="server">

class wscript_class
function echo(s)
response.write( s & "<br>")
end function
function quit()
' do nothing for now
end function
end class

dim wscript
set wscript = new wscript_class

Include "VBSCRIPT_TO_RU N_HERE.vbs"

Function Include (Scriptname)
Set oFSO = CreateObject("S cripting.FileSy stemObject")
Set oFile = oFSO.OpenTextFi le(Scriptname)
ExecuteGlobal oFile.ReadAll()
oFile.Close
End Function

</script>

Try it with this single line VBS file:

wscript.echo("i ncluded vbscript that uses Wscript.Echo")
(The code works; any errors would be from typos introduced while
posting here.)

Jul 22 '05 #1
1 1977
better version as it works as expected:

<%

class wscript_class
function echo(s)
response.write( s & "<br>")
end function
function quit()
' dummy
end function
end class

set wscript = new wscript_class

function runscript(file)
dim fso,fo,script
set fso = CreateObject("S cripting.FileSy stemObject")
set fo = fso.OpenTextFil e(file)
script = fo.ReadAll()
fo.Close
execute(script)
end function

%>

<html><head><ti tle>Run Script</title></head>
<body>

<%
runscript("c:\t emp\test.vbs")
%>

</body>
</html>

Jul 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2865
by: Rolfe | last post by:
Hi, I struggled, and got mod_python running on Apache/Win2k. Follow these instructions verbatim and you shouldn't have any trouble. These instructions are based on "http://www.modpython.org/live/current/doc-html/inst-testing.html". I've added specific information such as Windows filepaths and filenames so there's no ambiguity on what you should do. I encourage you to copy and paste to avoid typing errors. Cheers, Rolfe
5
5309
by: Shalen chhabra | last post by:
Hey, Can anyone give me a snippet for running a python program over all the files in the directory. For ex: I have ten files in a directory and I want to run a python program against all of these files, I wish to do the same using another python code instead of running each of these files one by one, which would be cumbersome giving the argv of each file every single time. This can be easily done using a shell script but I just...
4
11494
by: MLH | last post by:
I am having failures processing the following command and I wonder if you can tell me what I must do in order to have success. When I try to run source mysql_dump.sql.txt ==> it is a problem for me. 1) I put the file in /home/mlh/public_html/credifree/sql_script/. 2) I made that directory my current directory 3) I typed mysql and pressed ENTER 4) I then typed source mysql_dump.sql.txt and pressed ENTER A bunch of error...
17
4827
by: JStemper | last post by:
On one of my localhost sites I'm getting a message to run aspnet_regiis -c to correct some scripting issues. When I try to run the listed command I get another error: "You must have administrative rights on this machine in order to run this tool." I have verified that I have administrative rights on the box as my normal login. I have also logged in as the local administrator, tried the same thing and get the same message.
16
2579
by: TB | last post by:
Hi all: If you think that the following comments are absolute amateurish, then please bear with me, or simply skip this thread. A couple of months back I made the decision to initiate a gradual upgrade of my web programming skills from Classic ASP / VBS to ASP.NET / VB.NET. While the study of the language differences and all the new features in .NET has so far not been a traumatic experience, I am a bit shell-schocked after
4
4662
by: Jeremy S. | last post by:
We're in the process of writing a new Windows Forms app and the desktop support folks want for it to be run from a network share. I know it's possible (i.e., just have the framework on the clients and a desktop shortcut to the exe out on the network)... but is it really a good idea? What are some arguments for and against running a .NET Windows Forms client from a network share? Here is my initial list... I'd appreciate any additions,...
1
3472
by: Aaron West | last post by:
Try this script to see what queries are taking over a second. To get some real output, you need a long-running query. Here's one (estimated to take over an hour): PRINT GETDATE() select count_big(*) from sys.objects s1, sys.objects s2, sys.objects s3, sys.objects s4, sys.objects s5 PRINT GETDATE()
4
2846
by: commander_coder | last post by:
Hello, I write a lot of CGI scripts, in Python of course. Now I need to convert some to long-running processes. I'm having trouble finding resources about the best practices to do that. I've found a lot of email discussions that say something like, "You need to educate yourself about the differences when you have long- running processes" but I've not had a lot of luck with finding things that explain the differences. I've seen some...
2
1779
by: Steve | last post by:
Hi guys, I have a test solution (called TP2) which is checked in to a Team Project (also called TP2). The solution contains: * DLL (containing a single test class) * Unit Test project (which trivially tests the class in the DLL) * ASP.NET application (which exposes simple web-service and a single ASPX page, both of which use the class in DLL) * Windows application (which calls the simple web-service above)
5
2538
by: Christopher Brewster | last post by:
I am running the same script on the same data on two different machines (the folder is synchronised with Dropbox). I get two different results. All the script does is count words in different files and perform a simple set operation on the word lists. The laptop is a Macbook Pro (2 1/2 years old) running OS X 10.5.5 with Python 2.5.1 The desktop is an iMac (brand new) running OS X 10.5.5 also with Python 2.5.1 I have tried running the...
0
8202
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8707
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8366
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7199
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5575
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4202
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2628
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1812
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1512
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.