Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.scripting.vbscript > #11724

Re: the "execute" command, arguments and returning a result. Possible ? If so, how ?

From "Mayayana" <mayayana@invalid.nospam>
Newsgroups microsoft.public.scripting.vbscript
Subject Re: the "execute" command, arguments and returning a result. Possible ? If so, how ?
Date 2017-07-22 09:28 -0400
Organization A noiseless patient Spider
Message-ID <okvjnr$muc$1@dont-email.me> (permalink)
References <okvc0l$d0p$1@gioia.aioe.org>

Show all headers | View raw


"R.Wieser" <address@not.available> wrote

| I'm writing a script in which I want to execute some child scripts, and
| return a result.  Like this:
|
| result = execute(oFS.OpenTextFile("childscript.vbs").ReadAll)
|
| Two things: I do not see any way to return such a result, nor do I see any
| way to, if needed, provide arguments.
|

  I don't know if this will be useful, but I use external
scripts for a few things. One example:

Private Sub SleepX(MSecs)
  Dim Ret1
    On Error Resume Next
    Ret1 = SHcc.Run("sleeper.vbs " & MSecs, , True)
End Sub

SHcc is WScript.Shell. I call it like SleepX "500"
It runs a VBS file that reads wscript.argument(0)
and does a Sleep for that period of time. Since I'm
waiting for return it becomes a way to call Sleep
in an HTA, which provides no other such option.

  I do similar with 7-Zip, after finding that 7-Zip
run from an HTA or script wouldn't quit until the
HTA closed. So I run it from an external script and
wait for the return.

  I also use ExecuteGlobal to add classes into a
script. But I can't think of any simple way to return
values from a script that's running in a different
process. That probably requires an ugly hack.

| I'm aware that the executed script can just access and/or change some of 
its
| parents data (scope permitting ofcourse), but I was wondering if I could
| handle it more like an external function.
|
    I wonder why you need it to be external. Typically
such a thing would be needed to wrap complex
functionality, as with a DLL, in order to keep the
main process simpler. But you could do that
just as easily by using ExecuteGlobal on a class
script. 

Back to microsoft.public.scripting.vbscript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

the "execute" command, arguments and returning a result.  Possible ?  If so, how ? "R.Wieser" <address@not.available> - 2017-07-22 13:14 +0200
  Re: the "execute" command, arguments and returning a result.  Possible ?  If so, how ? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-07-22 13:41 +0200
    Re: the "execute" command, arguments and returning a result.  Possible ?  If so, how ? "R.Wieser" <address@not.available> - 2017-07-22 14:16 +0200
  Re: the "execute" command, arguments and returning a result.  Possible ?  If so, how ? "Dave \"Crash\" Dummy" <invalid@invalid.invalid> - 2017-07-22 07:58 -0400
    Re: the "execute" command, arguments and returning a result.  Possible?  If so, how ? "R.Wieser" <address@not.available> - 2017-07-22 14:29 +0200
  Re: the "execute" command, arguments and returning a result. Possible ? If so, how ? Ulrich Möller <knobbi38@arcor.de> - 2017-07-22 14:53 +0200
    Re: the "execute" command, arguments and returning a result. Possible? If so, how ? "R.Wieser" <address@not.available> - 2017-07-22 16:28 +0200
      Re: the "execute" command, arguments and returning a result. Possible? If so, how ? Ulrich Möller <knobbi38@arcor.de> - 2017-07-23 13:49 +0200
        Re: the "execute" command, arguments and returning a result.Possible? If so, how ? "R.Wieser" <address@not.available> - 2017-07-24 08:29 +0200
  Re: the "execute" command, arguments and returning a result.  Possible ?  If so, how ? JJ <jj4public@vfemail.net> - 2017-07-22 19:58 +0700
    Re: the "execute" command, arguments and returning a result.  Possible ?  If so, how ? "R.Wieser" <address@not.available> - 2017-07-22 16:52 +0200
  Re: the "execute" command, arguments and returning a result.  Possible ?  If so, how ? "Mayayana" <mayayana@invalid.nospam> - 2017-07-22 09:28 -0400
    Re: the "execute" command, arguments and returning a result.  Possible ?  If so, how ? "R.Wieser" <address@not.available> - 2017-07-22 17:09 +0200
      Re: the "execute" command, arguments and returning a result.  Possible ?  If so, how ? "Mayayana" <mayayana@invalid.nospam> - 2017-07-23 08:41 -0400
        Re: the "execute" command, arguments and returning a result.  Possible ?  If so, how ? "R.Wieser" <address@not.available> - 2017-07-24 10:52 +0200
          Re: the "execute" command, arguments and returning a result.  Possible ?  If so, how ? "Mayayana" <mayayana@invalid.nospam> - 2017-07-24 08:38 -0400
            Re: the "execute" command, arguments and returning a result.  Possible ?  If so, how ? "R.Wieser" <address@not.available> - 2017-07-24 18:45 +0200
              Re: the "execute" command, arguments and returning a result.  Possible ?  If so, how ? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-07-25 10:02 +0200
                Re: the "execute" command, arguments and returning a result.  Possible ?  If so, how ? "R.Wieser" <address@not.available> - 2017-07-25 14:18 +0200
                Re: the "execute" command, arguments and returning a result.  Possible ?  If so, how ? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-07-25 23:42 +0200
                Re: the "execute" command, arguments and returning a result.  Possible ?  If so, how ? "R.Wieser" <address@not.available> - 2017-07-26 08:20 +0200
                Re: the "execute" command, arguments and returning a result.  Possible ?  If so, how ? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-07-26 10:21 +0200
                Re: the "execute" command, arguments and returning a result.  Possible ?  If so, how ? "R.Wieser" <address@not.available> - 2017-07-26 14:14 +0200
                Re: the "execute" command, arguments and returning a result.  Possible ?  If so, how ? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-07-26 19:34 +0200
                Re: the "execute" command, arguments and returning a result.  Possible ?  If so, how ? "R.Wieser" <address@not.available> - 2017-07-27 09:11 +0200
                Re: the "execute" command, arguments and returning a result.  Possible ?  If so, how ? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-07-27 09:18 +0200
                Re: the "execute" command, arguments and returning a result.  Possible ?  If so, how ? "R.Wieser" <address@not.available> - 2017-07-27 12:44 +0200
                Re: the "execute" command, arguments and returning a result.  Possible ?  If so, how ? "R.Wieser" <address@not.available> - 2017-08-01 23:21 +0200

csiph-web