Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
scripts
hosting
jscript
remote
scripting.wsh
scriptlets
vbscript
virus.discussion
  
 
date: Wed, 19 Mar 2008 07:33:39 -0700 (PDT),    group: microsoft.public.scripting.hosting        back       


Create a Variable   
I'm trying to create a variable using IActiveScriptSite. First an
empty array is created in a JS file:
    var test = [];

Then I want to create test[0], test[1], etc in my C++ code. So I
tried:
    hr = m_iActiveScript->AddNamedItem(L"test.0", SCRIPTITEM_CODEONLY|
SCRIPTITEM_ISVISIBLE);
and
    hr = m_iActiveScript->AddNamedItem(L"test[0]", SCRIPTITEM_CODEONLY|
SCRIPTITEM_ISVISIBLE);

Both of these return S_OK, but when I try to access the variable "test.
0" through GetIDsOfNames() I get an error: "Unknown name". (And yes, I
know to first try to access "test" - which is OK - then "test.0")

So, how to I add/create variables through IActiveScriptSite?? I know I
can create the JS code in memory (test[0] = "hello") and pass that to
ParseScriptText, but then I won't be able to use a different language
if I choose.
date: Wed, 19 Mar 2008 07:33:39 -0700 (PDT)   author:   Johnny

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us