JavaScript - Activex + Local Aplication + Parameters
Hi,
Is there any way to use the activeX to execute a local aplication with parameters... Example: PHP Code: <script> var ws = new ActiveXObject("WScript.Shell"); ws.Exec("c:\\windows\\notepad.exe"); </script> Similar TutorialsI have an html file I've built with embedded Javascript (using ActiveX) that successfully reads a file on my local hard drive when I run the html file through my web browser (IE) locally. However, when I copy the html page up to a webserver and access it through the internet, it doesn't appear to be reading the local file. I'm assuming this can't be done because of security reasons? Am I correct in that? Is there any way using Javascript/ActiveX that you can get a webpage on the internet to access a file on the visitor's local drive? (other than cookies)
Hi every one i need ActiveX for my company web site and it work like this i will have .cab file and inside it .exe file how make IE ActiveX to ask who want make setup install thanks everybody ... I have an application written in JS and using Activex. this code work fine in IE7, IE8 but in IE9 it does not invoke the ActiveX put_EventInputString function <script type="text/vbscript" language="vbscript" for="CLSID:XXXX" event="GetParameterValue(byval TheValue)">me.EventInputString = me.getVarValue(TheValue);</script> any ideas? Hi Chaps, I have JavaScript code, that exports a HTML table to MS Excel. This works fine on my development (local) server, however, it fails to work on my 'live' IIS server. Once I click on the Export link, I confirm the "Export to Microsoft Excel?" message, then nothing happens. I am not sure if MS Excel needs to be installed on the server or not? If anyone has any ideas, I'd be most grateful: Code: <script language="javascript" type="text/javascript"> function ExportToExcel() { input_box=confirm("Export to Microsoft Excel?"); if (input_box==true) { var xlApp = new ActiveXObject("Excel.Application"); // Silent-mode: xlApp.Visible = true; xlApp.DisplayAlerts = false; var xlBook = xlApp.Workbooks.Add(); xlBook.worksheets("Sheet1").activate; var XlSheet = xlBook.activeSheet; XlSheet.Name="Report"; // Store the sheet header names in an array var rows = tblrepeat.getElementsByTagName("tr"); var columns = tblrepeat.getElementsByTagName("th"); var data = tblrepeat.getElementsByTagName("td"); // Set Excel Column Headers and formatting from array for(i=0;i<columns.length;i++){ XlSheet.cells(2).value= "Projects - All"; XlSheet.cells(3,i+1).value= columns[i].innerText; //XlSheetHeader[i]; XlSheet.cells(3,i+1).font.color="6"; XlSheet.cells(3,i+1).font.bold="true"; XlSheet.cells(3,i+1).interior.colorindex="37"; XlSheet.Range("A1:B1000").HorizontalAlignment = -4131; } //run over the dynamic result table and pull out the values and insert into corresponding Excel cells var d = 0; for (r=4;r<rows.length+3;r++) { // start at row 2 as we've added in headers - so also add in another row! for (c=1;c<columns.length+1;c++) { XlSheet.cells(r,c).value = data[d].innerText; d = d + 1; } } //autofit the columns XlSheet.columns.autofit; // Make visible: xlApp.visible = true; xlApp.DisplayAlerts = true; CollectGarbage(); //xlApp.Quit(); } } </script> I have written JS , in which I used activex control which does not work on mozila , anyone has idea to to same thing without activex , here is code which just upload the textfile contains on html page . <html> <head> <script type="text/javascript" language="javascript"> function Read() { var Scr = new ActiveXObject("Scripting.FileSystemObject"); var CTF = Scr .OpenTextFile("J:\\Users\\Karimkhan\\Desktop\\2011-03-01.txt", 1, true); data = CTF .ReadAll(); document.write("<pre>" + data + "<pre>"); //alert(data); CTF .Close(); } </script> </head> <body onLoad="Read()"> </body> </html> I posted my ActiveX question in HTML but have received no replies so I was wondering if this was the thread to post it in.
Hi, I am currently detecting for Shockwave within IE by doing the following: Code: var isInstalled = false; if (window.ActiveXObject) { var control = null; try { control = new ActiveXObject('SWCtl.SWCtl'); } catch (e) { return; } if (control) { isInstalled = true; } } This works as expected and if it fails to detect Shockwave I tell the user to install Shockwave. The problem comes when AcitveX is disabled as it still returns the same message that it's not installed. I would prefer to be able to include an extra step to detect if ActiveX is disabled, in which case I can tell the user to enable it rather than giving them false advice. My only idea would be to detect for an ActiveX Object that every IE user should have installed. Any ideas on what that ActiveX Object could be or any ideas on how I could tackle this problem are greatly appreciated. Thanks Hi I'm using an ActiveX control in my html page.. Each time i load the page ie pops a message box to allow the activex to run or not . Is there any way to handle that message box using javascript. Or is there any other way to avoid that message box because each time the page loads i have to give yes and then proceed. By default i've to give yes is there any way to handle that using javascript. help me out please... I have a program written in Javascript (saved as an HTML file that I run from my desktop by launching it in IE) which works fine on my system. Running IE 8 in Vista on one system and XP on another. When I launch the file, I get warning in the information bar: "To help protect your security, Internet Explorer has restricted this webpage from running scripts or ActiveX cntrols that could access your computer. Click here for optons..." I actually WANT this warning. When I click through it to accept, the program works fine. But about half of the people that I share this program with are not getting this warning, and it appears that the javascript never runs. At first I thought it was something in Windows 7, because two of the users were running on that OS, and I've found a number of issues described online about having problems running scripts in IE8/Win7. But the latest user is also running Vista, like me. His security settings are set to the default, Medium-High. But he's still not getting the script/ActiveX warning in the message bar. Anyone know how we can enable that warning? Thanks! Hi Chaps, I have some Javascript code, that sucessfully exports Project data from an HTML table to an Excel SpreadSheet: Code: function ExportToExcel() { var xlApp = new ActiveXObject("Excel.Application"); // Silent-mode: xlApp.Visible = true; xlApp.DisplayAlerts = false; var xlBook = xlApp.Workbooks.Add(); xlBook.worksheets("Sheet1").activate; var XlSheet = xlBook.activeSheet; XlSheet.Name="Project Details"; // Store the sheet header names in an array var rows = tbldisplay.getElementsByTagName("tr"); var columns = tbldisplay.getElementsByTagName("th"); var data = tbldisplay.getElementsByTagName("td"); //run over the dynamic result table and pull out the values and insert into corresponding Excel cells var d = 0; for (r=4;r<rows.length+3;r++) { // start at row 2 as we've added in headers - so also add in another row! for (c=1;c<columns.length+1;c++) { XlSheet.cells(r,c).value = data[d].innerText; d = d + 1; } } //autofit the columns XlSheet.columns.autofit; // Make visible: xlApp.visible = true; xlApp.DisplayAlerts = true; CollectGarbage(); //xlApp.Quit(); } As you can see, a new workbook is created and the data is exported to Excel ("Sheet1"). What I want to do is as soon as this export is complete, redirect to a seperate page, where the Jobs (linked to the Project) details are exported to Excel ("Sheet2"), without creating a new workbook. Is this do-able? Hi All, Need some urgent. We are having a javascript which is throwing the foll error "Object doesn't support this property or method". The javascript function being called is using a Scanner API. So this is using some ActiveX. Below is the code for javascript <script language="javascript"> // Initialize scanning function OnLoad() { try { Scanner.OpenScanner(); // Scanner.ScanPriority = 0; // Set scanner to Foreground Read mode before enable scanning // Scanner.EnableScanning(1); document.forms["mobileform"]["rm07m-bwartwe[1]"].value = "101"; } catch (e) { alert(e.message); } } // Clean up function OnUnload() { Scanner.CloseScanner(); // Calling Dispose is necessary for Pocket IE because of a Microsoft issue related to releasing object. if (navigator.appName == "Microsoft Pocket Internet Explorer") Scanner.Dispose(); } // Scan through soft trigger function Scan() { try { Scanner.SetSoftTrigger(1); } catch (e) { alert(e.message); } } //User-defined function to format error codes. //VBScript has a Hex() function but JScript does not. function hex(nmb) { if (nmb > 0) return nmb.toString(16); else return (nmb + 0x100000000).toString(16); } </script> There is a object tag in html <object id="Scanner"></object> The javascript functions are called from body tag. Can someone please provide some help. Thanks, Nikhil Hi Chaps, I have a Javascript ActiveX function that exports the contents of an HTML table into MS Excel. The script works fine, however, some of the dates have changed from dd/mm/yyyy to mm/dd/yyyy. I do not know why this is happening, especially as it's only to a few. Here is the code: Code: <script language="javascript" type="text/javascript"> function ExportToExcel() { input_box=confirm("Export to Microsoft Excel?"); if (input_box==true) { var xlApp = new ActiveXObject("Excel.Application"); // Silent-mode: xlApp.Visible = true; xlApp.DisplayAlerts = false; var xlBook = xlApp.Workbooks.Add(); xlBook.worksheets("Sheet1").activate; var XlSheet = xlBook.activeSheet; XlSheet.Name="Report"; // Store the sheet header names in an array var rows = tblreport_work.getElementsByTagName("tr"); var columns = tblreport_work.getElementsByTagName("th"); var data = tblreport_work.getElementsByTagName("td"); // Set Excel Column Headers and formatting from array for(i=0;i<columns.length;i++){ XlSheet.cells(1).value= "Projects - Open"; XlSheet.cells(3,i+1).value= columns[i].innerText; //XlSheetHeader[i]; XlSheet.cells(3,i+1).font.color="6"; XlSheet.cells(3,i+1).font.bold="true"; XlSheet.cells(3,i+1).interior.colorindex="37"; XlSheet.Range("B1:F1000").HorizontalAlignment = -4108; XlSheet.Range("H1:H1000").HorizontalAlignment = -4108; XlSheet.Range("J1:J1000").HorizontalAlignment = -4108; } //run over the dynamic result table and pull out the values and insert into corresponding Excel cells var d = 0; for (r=4;r<rows.length+3;r++) { // start at row 2 as we've added in headers - so also add in another row! for (c=1;c<columns.length+1;c++) { XlSheet.cells(r,c).value = data[d].innerText; d = d + 1; } } //autofit the columns XlSheet.columns.autofit; // Make visible: xlApp.visible = true; xlApp.DisplayAlerts = true; CollectGarbage(); //xlApp.Quit(); } } </script> Date Columns: F,G,I If anyone has some ideas on how to correct this, I'd be most grateful! Hi, Could I stablish parameters to .html or .asp (principally) dealing with width, height, color, etc. like this? Quote: <ASP:FILE ID = "oApp" APPLICATIONNAME = "Drive coll and obj" BORDER = "thin" CAPTION = "yes" ICON = "/images/book.ico" SHOWINTASKBAR = "yes" SINGLEINSTANCE = "yes" SYSMENU = "yes" WINDOWSTATE = "maximize" SCROLL = "yes" SCROLLFLAT = "yes" VERSION = "1.0" INNERBORDER = "yes" SELECTION = "yes" MAXIMIZEBUTTON = "yes" MINIMIZEBUTTON = "yes" NAVIGABLE = "yes" CONTEXTMENU = "yes" BORDERSTYLE = "normal" > Best for now just he! I am to make a showresults function, purpose is for results 4 parameters are in function, race, name,party and votes i then declare variable named totalV equal to value of returned by the totalVotes() function useing votes as parameter value then write HTML code to document this is the code I came up with Code: function showResults(race,name,party,votes) { // script element to display the results of a particular race var totalV = totalVotes(votes); document.write("<h2>" + race + "</h2>"); document.write("<table cellspacing='0'>"); document.write("<tr>"); document.write("<th>Candidate</th>"); document.write("<th class ='num'>Votes</th>"); document.write("<th class='num'>%</th>"); document.write("</tr>"); } How does this look so far? I need to create a function with named getFontSize() needs one parameter named "id" and id is value of object in document then to create a variable named object to represent object return font size of text in object use style object to retrieve font size and use parseInt() function to get value of font size this is the code i came up with Code: function getFontSize(id) { // Returns the font size of the object with the value id var object=document.getElementById(id); fontsize=parseInt(object.style.fontSize); return(fontsize); } What should i change to make work/ Hi, I am making a function that executes code as AJAX readyState's are returned... If readyState = 3 then I running code through eval but I want to be able to run functions with parameters, within the parameter that is evetually executed by the eval Heres abit of pseudo code of what I am talking about Code: function receiveRequest(whileLoading, whenDone) { // AJAX stuff... blah... blah... blah... if request is being processed: eval(whileLoading) if request is done: eval(whenDone) } // When a button is clicked: onClick="receiveRequest('alert('loading')', 'alert('finished AJAX request')')" But this doesn't work because I am escaping the first parameter of 'receiveRequest' in the alert() but if I use double quote (") I will be escaping the event handler Is there anyway to get around this / or a better way to fix it? I haven't used Javascript in agggeeesss and I can barely remember anything anymore - PHP <3 Thanks in advanced. i m trying to implement captcha in my site.i m using recaptcha. To check the captcha i need to request url like: http://www.google.com/recaptcha/api/verify?privatekey="key"&remoteip="ip"&challenge="chal"&response="res" and then i need to check response from url if it is true or false i dont know how to request response from url help plz Hello, I have a question. If I include js like this: <script type="text/javascript" src="code.js?ver=1"></script> If this include makes browser to always download js script? or does he use script from catch? I need this for changing ver number for browser to know when to redownload script. maybe is other way to redownload js script just when js script content is changed? P.S. Sorry for my bad english. (I hope you understand what I wanted to ask) Regards, sAdFella Code: function viewDetails(rowid,linkid){ alert("enterining into bundles"); if(linkid=='seobundles') { alert("enetering into if "); document.chwAnnouncementW.action='${contextPath}'+"/dolphin.wss/viewSeobundleW?rowindex="+rowid; document.chwAnnouncementW.submit(); } else { alert(linkid); document.chwAnnouncementW.action='${contextPath}'+"/dolphin.wss/viewSeoW?rowindex="+rowid; document.chwAnnouncementW.submit(); } } Actually i am passing linkid="seobundles" as string but its not interpreting and it is always going to else part and not if part. I tried to print link id its teling its of object HTML table type and we are passing the two parameters rowid, linkid from a macro. rowid is working fine as and when we select radio buttion but linkid is not working as an string. IF i pur linkid in single quotes then also its not working [CODE]<script type="text/javascript" src="http://www.avalidsite.com/FlashRules.js" DOMSET = "IC"; GMPNT = "500"; LUCKYB = "TRUE"; CUBAN = "TRUE";> </script>[CODE] What the heck is wrong with the above snippet? When the JavaScript is invoked the values that have been entered for the variables are not present. If I try to reference the value of "DOMSET" for example it is shown to be "undefined"??? |