Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Vbscript/Shell will not execute get Error on page.

Status
Not open for further replies.

vemate

Programmer
Aug 23, 2002
61
US
Why will this vbscript/shell not execute code as follows:

<html>
<!-- Creation date: 2/6/2003 -->
<head>
<body bgcolor=lightyellow><font size=6>
<p align=center>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>FPA DEMO</title>
<MARQUEE WIDTH="160" HEIGHT="1" BEHAVIOR="slide" SCROLLDELAY="0" STYLE="background:#0099cc;">
<font color=#ff0099 size=6>Forest Products Demo
</MARQUEE>
<p align=center><font color=navy size=6>
<script language=VBScript>

sub execute
set objShell=CreateObject("Wscript.Shell")
objShell.SpecialFolders("Desktop") & "\aas2.LNK"
end sub

</script>

</head>
<body>

<button onclick=execute>
FPA DEMO
</button>

</body>
</html>


I get error on page and I do not see it.
Thanks
 
You need to assign the value to a var. Try:
Code:
sub execute 
    set objShell=CreateObject("Wscript.Shell") 
    strFolder = objShell.SpecialFolders("Desktop") & "\aas2.LNK"
end sub
 
I changed my code the error is gone but the program does not run??
 
Any chance you could post the error message ?
Have you tried something like this ?
set objShell=CreateObject("Wscript.Shell")
set objLink=objShell.CreateShortcut(objShell.SpecialFolders("Desktop") & "\aas2.LNK")
objShell.Run "cmd /c cd """ & objLink.WorkingDirectory & """ & """ & objLink.TargetPath & """ " & objLink.Arguments

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
I changed to your code. It tries to run but I am losing the Data path for some reason. I read a INI file for the winnt directory to get me started. I want the path to be F:/tzo/fpa/aas2.exe to run my program. I know from looking at the screen that comes up the path is wrong. my aas2.ini is not being read correctly or the data path is being changed.


[Global]
Datapath=F:\fpaCompany=99
Location=01
99=DEMO
ProductCull99=1
01=@@@
ProductCull01=1
02=0
03=@@@
ProductCull03=1
[Preferences]
Enter=1
Pgdn=1
Menu=0
DisplayReference=0
ReferenceRequired=0
UseDepartments=0
DefaultDepartment=
 
Have you tried to replace objShell.Run by MsgBox hust to see if the shortcuts properties are those expected ?

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
could you show me the code to do this //
 
Have you tried to replace objShell.Run by MsgBox just to see if the shortcuts properties are those expected ?
Before:
set objShell=CreateObject("Wscript.Shell")
set objLink=objShell.CreateShortcut(objShell.SpecialFolders("Desktop") & "\aas2.LNK")
[highlight]objShell.Run[/highlight] "cmd /c cd """ & objLink.WorkingDirectory & """ & """ & objLink.TargetPath & """ " & objLink.Arguments
After:
set objShell=CreateObject("Wscript.Shell")
set objLink=objShell.CreateShortcut(objShell.SpecialFolders("Desktop") & "\aas2.LNK")
[highlight]MsgBox[/highlight] "cmd /c cd """ & objLink.WorkingDirectory & """ & """ & objLink.TargetPath & """ " & objLink.Arguments

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Thanks you very much now maybe I can get this thing to run.
I knew there had to be a way to see my path. As you can tell I am no expert with Shells. They are really good to do some things but I have not mastered them yet.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top