This topic is locked

Does anyone know how to call a batch file from ASPR?

7/4/2009 10:04:46 AM
ASPRunnerPro General questions
hichem author


[font=Calibri]I was wondering if anyone else in this forum has done something like this and may be able to help?
app_name and ack_sent are table fields

I want to send an ack to an external application when status=closed. The call of the external batch needs only to happen once even if the closed status is selected a number of times. Once the batch file is called I want to set the ack_sent field to 1
here's what I tried so far but it is not working

-When I select a value other than "closed" for my status I get the error"Multiple Step OLE DB Operation generated errors. Check each OLE DB status value if available. No work was done here"

-When i select "closed" in my status field (which is supposed to trigger the call of the batch file) I get the error: "MS VBScript runtime error '800a000d'. Type mismatch: 'Shell' ".

---



' Before record updated

Function BeforeEdit(ByRef values,where,ByRef oldvalues,ByRef keys,ByRef message,inline)
Dim dict

Set dict = values
Dim appname, status

appname=values("app_name")

status="green"
if values("error_status")="closed" then

values("date_closed") = now()

if values("ack_sent")<>1 then

Shell("C:\Mypath\output\test.bat "& appname &" "& status &" ")

values("ack_sent") = 1

end if

else

values("date_closed") = NULL

end if
BeforeEdit=true

End Function ' BeforeEdit


[/size][/font]

Sergey Kornilov admin 7/6/2009

I guess this article pretty much covers the whole topic:

http://classicasp.aspfaq.com/general/how-d...e-from-asp.html