I need to create a VBScript to run in a 3rd-party application which
does not support WScript.
Most of the ways in internet pass argument to VBScript via WScript.
Is there any other way to do so?
Thanks and Regards,
Cherry
I don't know of any method that does not use the Wscript object. Another
thought is to use a class, with Property Let and Property Get methods, but I
don't believe you can assign values from outside the script. You may be out
of luck.
--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--
hi Cherry,
It would be helpful if you gave us a little more detail
about how you are running the vbscript.
For example, are you using a "Microsoft Script Control"
to run the script, or maybe you are using the (shudder)
IActiveScript interface?
Since the application is 3rd-party, then maybe you don't
have the source code, which would make it even more
complicated...
If either the script control or the (shudder) IActiveScript
interface is being used, then I may be able to help.
If it is somebody else's code and you don't have the
source (a "black box") then the only way may be something
a responsible scripter wouldn't consider (like using the
system api).
cheers, jw
For example, you could run the 3re-party app from a
bat file or a vbs wrapper, place your args somewhere
the script can find them and use a non-WScript method
to get the args.
The most primitive method is to write the args into
a file, then use fso to read the file and retrieve
the args.
Also, you might use system parameters. You could
use the wshShell.Environment to retrieve the parameter.
Finally, you could use the Registry. Set up a CherrySoftware
key, and put your arguments in subkeys. Then read
them back using wshShell.regread method.
cheers, jw
LOL, I am beside myself with laughter! ;-)
/Al
"mr_unreliable" <kindlyReply...@notmail.com> wrote in message
news:eEL6EUce...@TK2MSFTNGP05.phx.gbl...
I tried to schedule a bat file instead but seems it is another big
problem for the bat file to call a VB script with/within the
application.
So, I am thinking of simply write a VB.Net exe and read the argument.
This should be more flexible and feasible.
Or, if any one of you has similar experience of BOJ + VBScript can
share your solution...
Best Regards,
Cherry
On 12月11日, 上午2時22分, mr_unreliable <kindlyReplyToNewsgr...@notmail.com>
wrote:
I've no experience with BOJ. However, one
possibility for you is to create an instance of IE
and then affix a value to that. You must then
locate the instance within your called script.
HOWEVER, this solution will only work on a
single instance basis:
Loop through
CreateObject("Shell.Application").Windows
to check all IEs for
ie.document.parentWindow.myApp
(and if you encounter any errors just continue
looping).
If you have found such an IE, then stuff it
with the argument you wish to pass.
Otherwise, bring up a new instance of IE with
Set ie=CreateObject("InternetExplorer.Application")
ie.Navigate2 "about:blank" 'Give it a dom
ie.Visible = true 'debugging
ie.document.parentWindow.execScript( _
"window.myApp=null")
'And now:
ie.document.parentWindow.myApp = "args go here"
'Now dispatch to your script
The biggest caveat with this method is that if your
script has to create IE, then it should really dispatch
to itself in the background and then keep looping in
order to keep IE alive. You will encounter this issue
once you comment out ie.Visible=true
Csaba Gabor from Vancouver