ardy8888
(Fresh Scripter)
2016-03-28 09:17 PM
Have kixtart call .vbs file and do something with the output

I've got a .vbs file that exits with specific numeric codes depending on what the .vbs finds. How can I have kixtart see this output and do something with it?

Here is a snipet of the the .vbs where it exits with code:

If InStr(response, "Non-Enrolled User") Then
result = 12
ElseIf InStr(response, "Enrolled User") Then
result = 47
End If
wscript.quit result

And here is a snipet from kixtart where I'm trying to do something based on the .vbs output:

if ingroup ("CheckEnroll")
SHELL "START /W C:\scripts\CheckEnroll.vbs"
if @ERROR = 12
$smtpto=inputbox("Would you like more information?","Enrollment")
MAILER($smtpto)
endif
endif

If I run the kixtart and print @ERROR, it returns the number 2. Maybe I'm misunderstanding @ERROR, but I'm expecting it to be either 12 or 47. Insights? Thanks in advance!!


Glenn BarnasAdministrator
(KiX Supporter)
2016-03-28 10:38 PM
Re: Have kixtart call .vbs file and do something with the output

Welcome to KORG!

ERROR 2 is "file not found", so likely Kix isn't finding your VBS script.

Also - "start" runs in a separate shell, so the result may not be passed back.

When I write
 Code:
Shell 'cscript //nologo C:\temp\tst.vbs'
@ERROR ?
and the tst.vbs contains
 Code:
result = 47
wscript.quit result
, Kix reports @ERROR of 47, as desired.

Glenn


ardy8888
(Fresh Scripter)
2016-03-29 10:41 PM
Re: Have kixtart call .vbs file and do something with the output

Thanks so much!! That worked perfectly!!