spacer
cornerspacercorner
Reply
Regular Advisor
RKushner
Posts: 103
Registered: 05-20-2010
0 Kudos

Help! Server-Side vbScript w/Args

Could someone give me a very simple example of how to invoke server-side vbScript with an argument from the DoThis of an action?

 

Here’s a sample script that I am trying to call:

 

sub vbsArg(Argument)

   ework.Subject = Argument

end sub

 

And here are a couple of failed attempts to call it:

 

%Script(VBScript,,%Procedure.Name,%MapName,"vbsArg",Argument1)

 

%Script(VBScript,,%Procedure.Name,%MapName,%"vbsArg%",%"Argument1%")

Valued Contributor
Greg
Posts: 179
Registered: 05-19-2010
0 Kudos

Re: Help! Server-Side vbScript w/Args

Hi
I see that you are online and desperate :smileysad:
I don't remember this syntax unfortunatly, and it's friday after 10pm in Poladn, but, give me 5 minutes, I will try to find something :smileywink:
Valued Contributor
Greg
Posts: 179
Registered: 05-19-2010

Re: Help! Server-Side vbScript w/Args

I found something what is working in my very old solution, here you have some one example:

 

%Script(VBScript,,%Procedure.Name,%MapName,"FunctionName  %"%FolderID%",%"%VariableName%",%"%VariableName2%",%"%VariableName3%",%"%VariableName4%",%"%VariableName5%" ")):smileysad:)

 

And some more simple:

 

%Script(VBScript,,%Procedure.Name,%MapName,"FunctionName %Variable")

 

It's working for me, I hope it will help you.

Regular Advisor
RKushner
Posts: 103
Registered: 05-20-2010
0 Kudos

Re: Help! Server-Side vbScript w/Args

Many thanks. I will try it right now.

Regular Advisor
RKushner
Posts: 103
Registered: 05-20-2010
0 Kudos

Re: Help! Server-Side vbScript w/Args

I got problems! Here's mine:

 

%GRxAcct

:=%ScriptEval(VBScript,,%Procedure.Name,%MapName,"vbsEnterGRx %"%PatNameLast%",%"%PatNameFirst%",%"%PatNameMI%",%"%SSN%",%"%PatEmail%",%"%PatSex%",%"%PatDOB%",%"%Lang%",%"%PatHomeTel%",%"%PatWorkTel%",%"%PatCell%"")

And here's the Post Eval:

%ScriptEval(VBScript,,NewPatientReg,PatReg,vbsEnterGRx "Smith","Jack","D","","","M","3/15/2007","EN","(555) 123-6340","(555) 123-6341","(555) 123-6340")

 

Here's the error:

Unable to execute specified script expression. Reason 'Error(-2146827286) : Syntax error, at line 1, character 12. Source: vbsEnterGRx "Smith","Jack","D","","","M","3/15/2007","EN","(555) 123-6340","(555) 123-6341","(555) 123-6340".' Procedure ScriptEval call failed.  Position: 224

 

And here's the vbs proc declaration

function vbsEnterGRx (PatNameLast,PatNameFirst,PatNameMI,SSN,PatEmail,PatSex,PatDOB,Lang,PatHomeTel,PatWorkTel,PatCell)

 

Valued Contributor
Greg
Posts: 179
Registered: 05-19-2010

Re: Help! Server-Side vbScript w/Args

It's quite strange.

 

I was trying to run your script, and it works fine if I try to run it only via %Script.

If I l was trying to use %ScriptEval, it fails.

 

I was searching my old solutions and there are no %ScriptEval with VBScript. I have %ScriptEval with JScript, but not with VBScript!

 

The quicker solution I see is creating "sub", where you will pass every variable to function and assign result to proper variable.Than run with %Script syntax this sub.

 

I prefer to use JScript.NET instead. Syntax is horrible, but I hope it will be a little bit quicker when I will be migrating to v9 and c#

Valued Contributor
Greg
Posts: 179
Registered: 05-19-2010

Re: Help! Server-Side vbScript w/Args

EUREKA :smileyhappy:

It's quite obvious!

It's VBScript !!

 

The main problem is with strange VBScript syntax. If you try to execute procedure without returning value, you do it like you paste in your post. But if you try to return value, you have to add parenthesis!

 

Your expression should look like:

%GRxAcct

:=%ScriptEval(VBScript,,%Procedure.Name,%MapName,"vbsEnterGRx (%"%PatNameLast%",%"%PatNameFirst%",%"%PatNameMI%",%"%SSN%",%"%PatEmail%",%"%PatSex%",%"%PatDOB%",%"%Lang%",%"%PatHomeTel%",%"%PatWorkTel%",%"%PatCell%")")

 

I hope it will be working for you at least :smileyhappy:


line spacer line
spacerFollow Metastorm on:
spacer Twitter YouTube Blog iTunes LinkedIn Metastorm Community Central, MC2
spacer Copyright © 2011 OpenText Corporation. All Rights Reserved.spacer About Metastormspacer Privacyspacer Legalspacer Site Mapspacer RSSspacer Contact Us
Microsoft Gold Certified Partner
Powered by Windows Azure
line spacer line