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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Issue with this not calling the Sub in Classic ASP page

Status
Not open for further replies.

Ambientguitar

Programmer
Apr 23, 2006
31
GB


Code:
<a href="#" onclick="PrintPdf()" class="d-none d-sm-inline-block btn btn-sm btn-primary shadow-sm"><i class="fas fa-download fa-sm text-white-50"></i> Generate Report</a>

Okay Guys If I run this I am getting zilch, nada, nothing, null!

I have tried using onclick=PrintPdf() - onclick="PrintPdf();" - onclick="call PrintPdf()" All to no avail. I am trying to run a batch file. If I change this to Javascript and click teh button it calls
a Javascript but I need the Vbscript.



Code:
<script language="vbscript"> 
        Sub PrintPdf()
        Dim oShell,strPath
        Set oShell = CreateObject ("WScript.Shell")
        strPath1=Server.MapPath("PDFSaveTest.bat")
        oShell.Run strPath1 
        set OShell= (Nothing)
        End Sub
 </script>
 
Are you running in IE - VBScript only works in IE: it will not work in Chrome, Firefox, Opera or any other browser.
 
I thought VBScript in ASP pages ran on the server so the browser doesn't make any difference.

Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016
 
It depends on whether the vbscript is in the served page or is actually on the server. From the script posted, it looks like it is the served page. This wouldn't make a lot of sense on a server. Also you can't click a button on a server.

The other thing about it is that the batch file would have to be on the client. Maybe the script does work but it needs the batch file on the client.

Try adding a message box to print out what strPath1 is.
 
I thought VBScript in ASP pages ran on the server so the browser doesn't make any difference.

Server-side script would be encapsulated with <% %>


Mark

"You guys pair up in groups of three, then line up in a circle."
- Bill Peterson, a Florida State football coach
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top