Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QLIKWORLD LIVE! MAY 16 - 19TH, EARLY BIRD DISCOUNTS! REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Execute .vbs file in Load Script


Is it possible to execute VB Script through Script editor.

I want to create a VB Script to send a mail by taking input as MailID from a field.

For that i should execute VB script from Script editor. How to Call a vbscript?

Call C:\...\SendMail.vbs  ?

execute C:\...\SendMail.vbs ?

anybody did work on?

7 Replies
Not applicable
Author

Can't you just include it using the Include statement and then refer to its functions or subs ?

Not applicable
Author

$(Include=.\lib\yourfile.qvs);

I believe the extension doesn't matter but let's see the opinion of others in the forum.

qvs stands for qlikview script but it contains vbscript subs and functions

rwunderlich

You can execute VBScript from within the script execution in one of two ways.

1. Use the script EXECUTE statement.

EXECUTE cscript c:\dir\sendmail.vbs parms

not sure I got the syntax exactly right, you'll have to experiment.

2. Functions that are included in the qvw module (Ctrl-m) can be called as script functions from within the script. For example, if you coded a function named sendmail that took a single parameter in the module.

LET x = sendmail(toaddr);

or

LOAD sendmail(toaddr) as X, ...;

For an example of creating and calling a script function, see:

Qlikview Cookbook: Regular Expression Pattern Matching http://qlikviewcookbook.com/recipes/download-info/regular-expression-pattern-matching/

-Rob

http://masterssummit.com

http://robwunderlich.com

Not applicable
Author

Hi Rob,

But if He only wants to send an Email chances are he just need to put the code internally in the edit module area right?  unless he will need to attach or do extra work at the OS level.

2015 MASTERS SUMMIT Wow!

rwunderlich

Hi Mario,

For sending mail I think EXECUTE may be easier. It can be a lot less code because you can use a command line program like blat or sendmail and just pass parameters.

Also,  the macro module cannot get System Access when run as a server reload. Usually to send mail in the module you have to do something like CreateObject() which requires System Access.

-Rob

Not applicable
Author

Thank you Mario and Rob for sending me the snippets.

One of them did work to execute the VBScript. It is

EXECUTE wscript c:\dir\sendmail.vbs parms

I just changed the cScript to wScript.

adcgermany
Contributor II
Contributor II

Hi ,

 

Could you please paste the load script for just executing one vbscript ..no parameters to pass.

 

Regards,

Gibin