Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^3: execute vbscript code inline in Perl script

by slick.user (Acolyte)
on Sep 08, 2017 at 16:45 UTC ( [id://1198964]=note: print w/replies, xml ) Need Help??


in reply to Re^2: execute vbscript code inline in Perl script
in thread execute vbscript code inline in Perl script

If I echo in vbs, this value didn't store into Perl.

Dim num1, num2, final, str num1 = 30 num2 = 50 str = "Final Value: " final = num1*num2 'MSGBOX str & final 'WScript.Quit(final) Wscript.Echo final

my $final = qx("cscript out2.vbs"); print STDOUT "Final: --> $final\n";

Final: --> Microsoft (R) Windows Script Host Version 5.8

Copyright (C) Microsoft Corporation. All rights reserved.

1500

Replies are listed 'Best First'.
Re^4: execute vbscript code inline in Perl script
by poj (Abbot) on Sep 08, 2017 at 16:59 UTC

    Try

    #!perl use strict; my $final = qx("cscript out2.vbs //NoLogo"); print "Final: --> $final\n"
    poj
      ++poj: by the time I had my reply typed, you'd already posted. :-( My only additional recommendation would be to chomp($final), or chomp(my $final = qx("cscript out2.vbs //Nologo"));, so that slick.user doesn't have a surprise newline in $final.
        That's look good! Thank you!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1198964]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-04-19 17:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found