?
Solved

Starting exe's on server using wshell

Posted on 2003-03-12
7
Medium Priority
?
249 Views
Last Modified: 2012-08-14
Hello,
I'm trying to start an instance of Notepad on my server using wshell. Notepad will start, but it remains a background process - I can't bring it to the foreground.
This is what I've been using:
<code>
Set WShShell = Server.CreateObject("WScript.Shell")
RetCode = WShShell.Run ("c:\WINNT\NOTEPAD.EXE",1,false)
WShShell.AppActivate RetCode
</code>
It's seems like such a simple thing to do, but it's driving me nuts!
I'm using IIS.5 - is it likely to be a server setting that's stopping it or am I missing something really obvious?
Thanks in advance,
Ross
0
Comment
Question by:theboyross
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 14

Expert Comment

by:aelatik
ID: 8121238
It's not possible, ASP doesn't have a GUI. It will do what you want but wont show it. Use Active X Controls instead, they run client side.

0
 
LVL 19

Expert Comment

by:webwoman
ID: 8121240
What do you EXPECT it to do? It's running on the SERVER -- you're never going to see it.
0
 
LVL 3

Expert Comment

by:DRY_GIN
ID: 8125068

are you sure vbNormalFocus is 1 ?

Maybe you need to put delay and call AppActivate after few milliseconds so the notepad will be ready to become active.

also:
Try
 WshShell.SendKeys "{%TAB}"
I don't think it will work, but it be a  Alt+TAB so you will switch you app's and notepad will become active app
...

Also you can try wshshell.Exec instead of .run

..
Also AppActivate can have two parameters, second parameter is wait and i have no idea what does it mean.

..
and a Last one
You can run "cmd.exe notepad.exe" this also should work..


I can't test anything here , so i'm only guessing ;(


0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:theboyross
ID: 8135615
Thanks everyone.
webwoman - I can see that this looks like a rather strange thing to do. The reason is rather unconventional but I'll try and explain it. We give out laptops to our employees - these employees are largely computer illiterate and we don't want them using them for any other business, but we do want them to run one or two exe's (I used notepad in this example). I want to set up a webpage on each machine that gives the user choices of which exe's to run. ASP is used as it is fairly simple technology to set up and maintain and IIS is included with our Win2K builds - we can also lock down access to anything else on the machine. Therefore, each machine acts as server and the exe's need to open up server side.
DRY GIN - Thanks for the suggestions. I've had a crack at each of them and I'm still getting the same output unfortunately.
aelatik - I think ActiveX may be the way forward - Could you suggest anywhere I could find more information?
thanks again
Ross
0
 
LVL 14

Expert Comment

by:aelatik
ID: 8136524
Here's a simple tutorial,

http://www.geocities.com/SiliconValley/Horizon/3950/ActiveX.htm

More Tutorials at : http://www.tutorgig.com/showurls.jsp?group=5454&index=0

If you want more tutorials just type 'ACTIVE X Tutorial VB' in www.google.com

Happy programming,
Ayhan Elatik
0
 
LVL 19

Accepted Solution

by:
webwoman earned 200 total points
ID: 8140600
I really, really wouldn't set it up that way. There are MUCH much better ways of locking down machines. Set a profile for them that doesn't have access to anything but what you want.

It will work regardless of their level of expertise, and they not only won't be able to run unauthorized software, they won't be able to install anything either. Nor will they be able to DELETE any software or make any system changes.

I work in a college, where we have tons of machines available for students and staff. Most users do NOT have the ability to install anything, change any system settings, or run any software that hasn't been set up for them. And the student machines don't even save anything -- all changes get trashed on reboot. You can certainly do most of this with Win2K -- that's what most of our machines run.

So there ARE better, way more secure ways.
0
 
LVL 58

Expert Comment

by:Gary
ID: 9352378
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept Answer by webwoman

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
GaryC123
EE Cleanup Volunteer
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question