Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HOW TO MAKE SCRIPT RUN IN BACKGROUND

Status
Not open for further replies.

law852

Programmer
Jul 2, 2008
4
CA
Hi.

I've coded an HTA using JScript. The first part of the HTA opens a program (activexobject) that gets user to fill out the survey (information stored in an xml). After the survey, another activexobject is opened, call it ANAobject, which analyzes the responses from the survey. After analysis, the ANAobject closes and graphs/tables show up in the HTA.

The survey gathers THREE different sets of responses from the user. the ANAobject cannot analyze the 3 sets simultaneously, so they have to be analyzed one after the other. Furthermore, because the ANAobject is still a beta-release and very nascent, there's not 'exit' function and slows down if you run too many analyses in the same window. Thus, after analysis of each set of data, I have to open a new activexobject and do the analysis.

Now my question is..how do i run the 2nd and 3rd analyses in the background?
That is, after i the analysis of the 1st set of data, i want to be able to look at the graphs and stuff in the HTA while the analyses of the other two sets run in the BACKGROUND in the ANAobject. right now.. i can't loko at graphs and stuff in the HTA until the other two are down because the script does not continue until that is done...

Oops forgot to mention that the HTA is not intended for web-use and is based solely on my machine. that is, users will be using it under my supervision on my computer (its part of an interview).

thanks

 
well if you post what you did until now (your code that is) we might be able to better understand what you want and what you want to achieve.


``The wise man doesn't give the right answers,
he poses the right questions.''
TIMTOWTDI
 
HERE IS THE GYST OF IT. i had to delete most of the code...for privacy/confidentiality reasons...and i changed allt he variables, programs, etc. i didnt double check if it made sense after i changed.. ijust did a 'replace all' using notepad. the part i ened help with is the 'startanalysis()' function. refer to previous question. i want graph/comp/summary to show up in HTA while the rest of the startanalysis() script runs after the FIRST time analyobject is opened and ran.





<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<HEAD>
<HTA:APPLICATION ID="thisprogram"
/>

<script language="JScript">

dir=thisprogram.commandLine.split("\"")[1].split("aprogram\\aprogram.hta")[0]
var fname=""
var guinea

//number of iteration for analysis program

niter=10

//THREE SETS of data: alpha, beta and psi (renamed for public space....three things are calculated for each set of data- now, later and the difference between now and later (two options)) [ i call each set a 'letter']
var alphaNOW=new Array
var alphaLATER=new Array
var alphaDIFF=new Array
var betaNOW=new Array
var betaLATER=new Array
var betaDIFF=new Array
var psiNOW=new Array
var psiLATER=new Array
var psiDIFF=new Array
letter=""

//selects the results from which set of data, alpha beta or psi, to analyze/graph.

function setletter(){
for(u=0;u<whichletter.length;u++){
if(whichletter(u).checked){
letter=whichletter(u).value
}
}

if(graphdiv.style.display=="inline") graph()
if(sumdiv.style.display=="inline") summary()
if(compdiv.style.display=="inline") comparison()
}


function startanalysis(){

//OPENS EXTERNAL PROGRAM, called 'analyobj' here.

//OPENS THE FIRST TIME and analyses data from the fibetat set of data (the set of data is chossen in function setletter(), 'letter'.., "variableX" (where x = [1, 12]) are extracted from xml files. i deleted code from here.

var analyobj=new ActiveXObject("analyse.this")


analyobj.OpenAPP(dir+"APPdoc")
analyobj.setC("_variable1",variable1)
analyobj.setC("_variable2",variable2)
analyobj.setC("_variable3",variable3)
analyobj.setC("_variable4",variable4)
analyobj.setC("_variable5",variable5)
analyobj.setC("_variable6",variable6)
analyobj.setC("_variable7",variable7)
analyobj.setC("-variable8",variable8)
analyobj.setC("_variable9",variable9)
analyobj.setC("_variable10",variable10)
analyobj.setC("_variable11",variable11)
analyobj.setC("_variable12",variable12)
analyobj.Eval("M")
analyobj.SaveResults(dir+"\aprogram\\results\\Results_" + guinea + "_" + iteration +"_" + letter + ".txt")

//analyze function takes the results in the TXT file and does calculations to allow for graphing..summary and comparison of reuslts.


analyze(guinea,letter)
graph()



//run analysis in background for other two sets of 'letters'

if(letter=="alpha"){
letter2="beta"
letter3="psi"
}
if(letter=="beta"){
letter2="alpha"
letter3="psi"
}
if(letter=="psi"){
letter2="beta"
letter3="alpha"
}

//run analysis for set #2

var analyobj1=new ActiveXObject("analyse.this")

analyobj.OpenAPP(dir+"APPdoc")
analyobj.setC("_variable1",variable12)
analyobj.setC("_variable2",variable22)
analyobj.setC("_variable3",variable32)
analyobj.setC("_variable4",variable42)
analyobj.setC("_variable5",variable52)
analyobj.setC("_variable6",variable62)
analyobj.setC("_variable7",variable72)
analyobj.setC("_variable8",variable82)
analyobj.setC("_variable9",variable92)
analyobj.setC("_variable10",variable102)
analyobj.setC("_variable11",variable112)
analyobj.setC("_variable12",variable122)
analyobj.Eval("M")
analyobj.SaveResults(dir+"\aprogram\\results\\Results_" + guinea + "_" + iteration +"_" + letter2 + ".txt")

//run analysis for set #3

var analyobj1=new ActiveXObject("analyse.this")

analyobj.OpenAPP(dir+"APPdoc")
analyobj.setC("_variable1",variable1)
analyobj.setC("_variable2",variable2)
analyobj.setC("_variable3",variable3)
analyobj.setC("_variable4",variable4)
analyobj.setC("_variable5",variable5)
analyobj.setC("_variable6",variable63)
analyobj.setC("_variable7",variable73)
analyobj.setC("_variable8",variable83)
analyobj.setC("_variable9",variable93)
analyobj.setC("_variable9_S",variable103)
analyobj.setC("_variable11",variable113)
analyobj.setC("_variable12",variable123)
analyobj.Eval("M")
analyobj.SaveResults(dir+"\aprogram\\results\\Results_" + guinea + "_" + iteration +"_" + letter3 + ".txt")
}

//sets fname and guinea..iteration

function setsub(f){
fname=..........
guinea=........
iteration=......

}

//prepares resutls for veiwieng as graphs/comp or summary

function analyze(guinea){

...

}

//makes graph with analyze() results

function graph(){

//code to make graphs

sumdiv.style.display="none"
graphdiv.style.display="inline"
compdiv.style.display="none"
}
}

//similary, make comparison picture thing with analyse() stuff

function comparison(){
.
.
.

sumdiv.style.display="none"
graphdiv.style.display="none"
compdiv.style.display="inline"

}


//similarly make a summary of rseults from analyse()

function summary(){
....

graphdiv.style.display="none"
sumdiv.style.display="inline"
compdiv.style.display="none"

}


function bodyload(){
//loads xml with data
}

</script>

<XML id="data" />

<BODY onload="bodyload()">


<DIV id="step2">Step 2. Select Preferred letter<BR/>

<INPUT type="radio" name="whichletter" value="beta" id="alpha" onclick="setletter()">ALPHA<BR/>
<INPUT type="radio" name="whichletter" value="beta" id="beta" onclick="setletter()">BETA<BR/>
<INPUT type="radio" name="whichletter" value="psi" id="psi" onclick="setletter()">GAMMA<BR/>

</DIV>

<DIV id="step3">Step 3. <SPAN class="click" onclick="startanalysis()">run analyse this</SPAN></DIV>


<DIV id="step4" >Step 4. choose how to dispplay resulst

<SPAN class="click" onclick="graph()">Graph</SPAN>
<SPAN class="click" onclick="summary()">Summary Statistics</SPAN>
<SPAN class="click" onclick="comparison()">Comparison</SPAN>
</DIV>

// THE CODE BELOW MAKES GRAPH, SUMMARY, COMPARISON DISPLAYS

<DIV id="graphdiv" style="display:none">

//stuff for graph display
</DIV>

<DIV id="sumdiv" style="display:none">
//stuff for summary dipslay
</DIV>

<DIV id="compdiv" style="display:none">
//stuff for comparison display
</DIV>
</BODY>
</html>
 
what is that number 1 ( which I marked with blue below ) doing there?
Code:
//run analysis for set #2
var analyobj[b][blue]1[/blue][/b]=new ActiveXObject("analyse.this")
Code:
//run analysis for set #3
var analyobj[b][blue]1[/blue][/b]=new ActiveXObject("analyse.this")


``The wise man doesn't give the right answers,
he poses the right questions.''
TIMTOWTDI
 
that was a typo i guess, and copied and pasted, so i got copied into third one too.

take out the '1's.

sorry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top