| |
mravi_prakash
Posts: 15
Score: 0
Joined: 3/27/2006
Status: offline
|
sorry to ask u once again .. its working fine .. but i need my HTA file to query the data base every time .. i.e if the time(database--table ) matches with the current time i need to call another hta file .. how can i do that means .. once i will open this main.hta file in this file it is going to check the database if time matches then it is going to call another show. hta file .. in the show.hta it has to show the data which it matched.... mean while the main.hta has to be running . back ground.. if any other database matches then it has to show .. means it has to refresh the whole search again and again .. how can i do that .. thing i have a sample code of the hta file which is going to check the file if any created in the folder QUEUE .. instead of this i need to have a data base connection , and in that it has to check for the time matches.. if that matches then it has to call the another hta file as this code does... <HTML> <HEAD> <TITLE>Controller</TITLE> <STYLE> </STYLE> <HTA:APPLICATION ID="oHTA" APPLICATIONNAME="My Alert Controller" BORDER="thick" BORDERSTYLE="none" CAPTION="yes" ICON="alert.ico" SHOWINTASKBAR="yes" SINGLEINSTANCE="yes" SYSMENU="yes" CONTEXTMENU="yes" INNERBORDER="no" MAXIMIZEBUTTON="yes" MINIMIZEBUTTON="yes" SCROLL="yes" SCROLLFLAT="yes" VERSION="1.0" WINDOWSTATE="minimize"> <SCRIPT> //Initialize Variables var szCurrentPath=location.pathname.substring(0,location.pathname.lastIndexOf("\\")); var fso = new ActiveXObject("Scripting.FileSystemObject"); //Queue is simply a directory in the file system var queue = fso.GetFolder(szCurrentPath +"\\queue"); //How often to read the queue (i.e. 1000ms = 1 second) var iInterval = window.setInterval("readQueue()", 2000) //Helper Object var WshShell = new ActiveXObject("WScript.Shell"); //Read the queue function readQueue() { //Clear Timer While Processing window.clearInterval(iInterval); //'alert(getDataFromWS()); //Process Items in queue var fc = new Enumerator(queue.files); for (; !fc.atEnd(); fc.moveNext()) { var file = fc.item(); var szName = file.Name; var textStream = file.OpenAsTextStream(1, -2); var szAlert = textStream.ReadAll(); textStream.Close(); fso.DeleteFile(file); processAlert(szAlert.replace(/\n|\r/g,"")); document.body.innerHTML+= "Processed Alert ..." + szName +" @"+ Date().toString()+".<BR/>"; } //Restart Timer iInterval=window.setInterval("readQueue()",2000); } function processAlert(message) { //Show the alert var szCmdLine="mshta.exe " + szCurrentPath + "\\ShowAlert.hta " + message; var oExec = WshShell.Run(szCmdLine,6); //var oExec = WshShell.Exec(szCmdLine); //while (oExec.Status == 0) //{ //} } </SCRIPT> </HEAD> <BODY> Waiting for alerts ... (HINT: You can minimize this window)<BR/> </BODY> </HTML> i think u understand my probleM my current file .. for data connection is this ... <HTML> <HEAD> <TITLE>database</TITLE> <STYLE> </STYLE> <HTA:APPLICATION ID="oHTA" APPLICATIONNAME="Data access" BORDER="thick" BORDERSTYLE="none" CAPTION="yes" ICON=" " SHOWINTASKBAR="yes" SINGLEINSTANCE="yes" SYSMENU="yes" CONTEXTMENU="yes" INNERBORDER="no" MAXIMIZEBUTTON="yes" MINIMIZEBUTTON="yes" SCROLL="yes" SCROLLFLAT="yes" VERSION="1.0" WINDOWSTATE="minimize"> <script language="VBScript"> Sub Window_OnLoad Call DBConnection End Sub Sub DBConnection strConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=time;USER=root;PASSWORD=;OPTION=3;" SampleQuery="SELECT * FROM time.sample" // Create objects for DB connection and recordset Set objConn = CreateObject("ADODB.Connection") Set rs = CreateObject("ADODB.Recordset") // Open database connection objConn.open strConnectionString // Set recordset DB connection and query and query database rs.activeconnection = objConn rs.source = SampleQuery rs.open Do Until rs.EOF msgbox rs.fields("name") Msgbox rs(0) & vbtab & rs(1) & vbTab & rs(2) rs.MoveNext Loop //' Close and dispose of recordset object rs.Close Set rs = Nothing //' Check and close database connection if open If objConn.State = adStateOpen then objConn.Close Set objConn = nothing End If End Sub </SCRIPT> </HEAD> <BODY> Waiting for database ... <BR/> </BODY> </HTML> i need this database file to be call another hta file .. when the time matches ... with it.. _____________________________
_____________________________
m. Ravi Prakash B.E computer science software engineer
|
|