2

Is this possible?

Using VB.net I am executing a remote perl script. I want a MsgBox to appear on my screen, similar to VBScript.

I tried just doing Win32::MsgBox("Test") but that didn't work. Is it even possible?

I am executing the script remotely FROM a Windows system to a Unix system.

2
  • "that didn't work" is not a diagnostic message produced by Perl or Windows. In what way did it not work? Was there an error message? An exit code? Commented Aug 7, 2012 at 16:01
  • No error message, no exit code. On my windows system, a msgbox didn't open up. I would assume now that I'm looking into it further is because I am executing the perl script on a unix system, it doesn't have access to Win32 functions. I need to find an alternative though. Commented Aug 7, 2012 at 16:14

1 Answer 1

1

You can use text-only replacement like this:

sub AskYesNo {
    my ($question, $default) = @_;
    print $question, $default ? " [Y/n] " : " [y/N] ";
    my $answer = lc(ReadLine 0);
    chomp $answer;
    return 1 if $answer eq "y";
    return 0 if $answer eq "n";
    return $default;
}

It will select default answer "y" or "n" if user presses just Enter. It may be not pretty, but gets job done and works under any Perl.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.