Hello!
I tried to write a simple script that saving attached file to HDD and then run bat file to process them. First part works fine, but I cant run bat from the script, it just wont start, need help! Check Syntax shows "correct!".
Code:
Function SaveAttachments(oMessage)
Set oShell = CreateObject("WScript.Shell")
for i = 1 to oMessage.attachments.count ' attachment
oMessage.attachments.item(i-1).saveAs("C:\FOMS\FT\" & oMessage.attachments.item(i-1).filename)
path = "c:\FOMS\decript.bat"
Call oShell.Run(path, 0, TRUE)
next 'i - attachment
End Function
Code:
"DEBUG" 1944 "2012-07-06 14:18:35.211" "Delivering message..."
"APPLICATION" 1944 "2012-07-06 14:18:35.211" "SMTPDeliverer - Message 180520: Delivering message from oit@---.ru to Vitaliy@---.ru. File: C:\Program Files\hMailServer\Data\{D0FECF0E-4111-45E0-A5CC-4C715AAFB2DC}.eml"
"DEBUG" 1944 "2012-07-06 14:18:35.242" "Applying rules"
"DEBUG" 1944 "2012-07-06 14:18:35.242" "Applying rule"
"DEBUG" 1944 "2012-07-06 14:18:35.242" "Performing local delivery"
"DEBUG" 1944 "2012-07-06 14:18:35.289" "Applying rules"
"DEBUG" 1944 "2012-07-06 14:18:35.289" "Applying rule"
"DEBUG" 1944 "2012-07-06 14:18:35.289" "Performing rule action"
"DEBUG" 1944 "2012-07-06 14:18:35.289" "ScriptServer:FireEvent"
"ERROR" 1944 "2012-07-06 14:18:35.336" "Script Error: Source: "DEBUG" 1944 "2012-07-06 14:18:35.336" "ScriptServer:~FireEvent"
"DEBUG" 1944 "2012-07-06 14:18:35.336" "Saving message: C:\Program Files\hMailServer\Data\nmcs.ru\vitaliy\D0\{D0FECF0E-4111-45E0-A5CC-4C715AAFB2DC}.eml"
"DEBUG" 1944 "2012-07-06 14:18:35.367" "AWStats::LogDeliverySuccess"
"DEBUG" 1944 "2012-07-06 14:18:35.367" "Local delivery completed"