Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: execute vbscript code inline in Perl script

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


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

I didn't get any value when I execute the command below from Perl.

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.

my $final2 = system("cscript out2.vbs"); print STDOUT "Final2: $final2\n";

Microsoft (R) Windows Script Host Version 5.8 Copyright (C) Microsoft Corporation. All rights reserved. Final2: 56320 Is 56320 the process ID from CScript?

out2.vbs

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

Replies are listed 'Best First'.
Re^3: execute vbscript code inline in Perl script
by slick.user (Acolyte) on Sep 08, 2017 at 16:45 UTC

    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

      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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1198962]
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-23 23:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found