Page 1 of 1
How to pass a variable value to a execute command vbs .
Posted: Sun Apr 05, 2020 11:48 pm
by manu0521
Hi ,
I have a TI which calls a vb script to send some email .
ExecuteCommand('Cscript.exe D:\VBS\EmailScripts\SendLeaseApprovalRequest.vbs "Lease Approval Request" "Please review the lease that has been submitted" "ABC" "leaseApprover" LeaseIDString ',0);
I have a LeaseIdString which has a value like "98" which is a variable value in ti .
I tried passing the variable name but the output is passing the value itsself as "LeaseIDString"
Thanks,
Re: How to pass a variable value to a execute command vbs .
Posted: Mon Apr 06, 2020 1:38 am
by Wim Gielis
Assuming your syntax works otherwise:
Code: Select all
ExecuteCommand('Cscript.exe D:\VBS\EmailScripts\SendLeaseApprovalRequest.vbs "Lease Approval Request" "Please review the lease that has been submitted" "ABC" "leaseApprover" ' | NumberToString( LeaseIDString), 0);
Re: How to pass a variable value to a execute command vbs .
Posted: Tue Apr 14, 2020 6:50 pm
by manu0521
HI Wim,
Sorry to ask you again
I had to modify this to now include a string variable in between and it errors out and i am unable to identify the syntax .
pLeaseSubmitter is a ti string variable .
Execute command(' ',0); I dont know how to pass the pLeaseSubmitter.
ExecuteCommand('Cscript.exe D:\VBS\EmailScripts\SendLeaseApprovalRequest.vbs "Lease Approval Request" "Please review the lease that has been submitted for Approval" pLeaseSubmitter "leaseApprover" ' | NumberToString(CurrentLeaseId), 0);
Re: How to pass a variable value to a execute command vbs .
Posted: Tue Apr 14, 2020 8:29 pm
by lotsaram
Seriously! You did join this forum over 5 years ago. Even if you are just clicking buttons and paying not much attention that is quite a lot of time to learn SOMETHING.
You do know what ExcecuteCommand is doing? You know that you can always AsciiOutput the same string to a text file and then paste it into a cmd window manually to debug what you are doing?? It is pretty obvious you are passing pLeaseSubmitter within single quotes so you are passing the string of the parameter name not the parameter value. That should be more than enough of a hint.
Re: How to pass a variable value to a execute command vbs .
Posted: Wed Apr 15, 2020 2:23 am
by manu0521
Hi ,
Thanks for yor suggestion. I know what Asciioutput does and it accepts only string .
In the above case with executecommand where it has 2 parameters the commandline and wait argument. I was not sure what commandline format should be sent in tm1, looks like its a string with vbs script location and if any parameters that are seperated by space and the whole single quote with script location and parameter was confusing .
I defintely know having a tm1 variable inside a single quote will consider that as a string ,but in this case i was little confused with the other paramerers and script location.
I should have spent little time and tried .I did try this again and got it working .
ExecuteCommand('Cscript.exe D:\VBS\EmailScripts\SendLeaseApprovalRequest.vbs "Lease Approval Request" "Please review the lease that has been submitted for Approval" ' |pLeaseSubmitter |' LeaseApprover ' | NumberToString(CurrentLeaseId), 0);
The above one is working , now the only issue is the pLeaseSubmitter ,if this has a value which includes a space in the variable value , then my arguments that goes to the script changes , so should i still have something like expand function which would encapsulate the value of my pLeaseSubmitter with in double quotes.
Thanks,
Re: How to pass a variable value to a execute command vbs .
Posted: Wed Apr 15, 2020 6:50 am
by lotsaram
manu0521 wrote: ↑Wed Apr 15, 2020 2:23 am
The above one is working , now the only issue is the pLeaseSubmitter ,if this has a value which includes a space in the variable value , then my arguments that goes to the script changes , so should i still have something like expand function which would encapsulate the value of my pLeaseSubmitter with in double quotes.
You say you know what you are doing, yet it doesn't sound like you do.
Just include extra double-quotes within the literal string portion of building the command line!
... submitted for Approval"
"' |pLeaseSubmitter |'
" LeaseApprover ...