Gaev Posted June 22, 2006 Share Posted June 22, 2006 Hi: Been playing with AutoItX using both javascript and vbscript ... found some differences in results ... perhaps someone can explain ... or point out the error of my ways. I have this code in the <head> section of my html document ...<script type="text/vbscript"> Sub vbEP1() Set oAutoIt = CreateObject("AutoItX3.Control") Result_vbEP1 = oAutoIt.RegEnumKey("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Print\Printers",1) msgbox("Result_vbEP1 = " + Result_vbEP1) End Sub </script> <script type="text/javascript"> function jsEP1() { oAutoIt = new ActiveXObject("AutoItX3.Control"); Result_jsEP1 = oAutoIt.RegEnumKey("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Print\Printers",1); alert("Result_jsEP1 = " + Result_jsEP1) } </script> ... the vbscript (vbEP1) correctly returns the value associated with the first printer definition ... the javascript (jsEP1) returns a null (empty ?) value. This is also true for the 2nd, 3rd and 4th enumerated values. Any ideas ? Gaevhttp://www.scriptedlogic.com Link to comment Share on other sites More sharing options...
Michel Claveau Posted June 30, 2006 Share Posted June 30, 2006 Hi! With JScript, try : var Result_jsEP1 = oAutoIt.RegEnumKey("HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Print\\Printers",1); alert(Result_jsEP1); Link to comment Share on other sites More sharing options...
Gaev Posted July 1, 2006 Author Share Posted July 1, 2006 Michel: Thank you for your suggestion ... unfortunately, it did not make a difference ... I am running XP Pro with SP2 and all subsequent updates from MS ... have you been able to get a non-blank (non-empty) response on your computer ? ... and if so, what are your OS details ? @AutoIt(X) developers: a) Does AutoItX officially support running from Javascript ? I notice all examples are vbscript only ... although I have managed to replicate the samples using javascript (albeit with some syntax changes). Is there a bug with values returned from javascript calls or is this something unique to the RegEnumKey method ? Thank you for your consideration. Gaevhttp://www.scriptedlogic.com Link to comment Share on other sites More sharing options...
nfwu Posted July 3, 2006 Share Posted July 3, 2006 (edited) I'm not a dev but I think I may be able to answer your questions: a. AutoItX runs through the COM interface. Any language that supports this can use AutoItX's functions. b. I dunno, try something else and see if it works: function jsEP1() { var oAutoIt = new ActiveXObject("AutoItX3.Control"); if (oAutoIt.WinExists("Untitled -")) { alert("An untitled window is open") }else{ alert("An untitled window is not open") } } try this with and without an Untitled notepad window open. #) Edited July 3, 2006 by nfwu TwitterOut of date stuff:Scripts: Sudoku Solver | Webserver | 3D library (Pure AutoIt) | Wood's GadgetsUDFs: _WoodUniqueID() | _DialogEditIni() | _Console*() | _GetIPConfigData() | _URLEncode/Decode() Link to comment Share on other sites More sharing options...
Michel Claveau Posted July 3, 2006 Share Posted July 3, 2006 Hi, Gaev! With this code, in a file TOTO.HTA : <hta:application application navigable="yes" windowstate="normal" caption="yes" singleinstance="yes" showintaskbar="yes" /> <html> <body onload="jsEP1();"> Test Printer Redistry <script type="text/javascript"> function jsEP1(){ var oAutoIt = new ActiveXObject("AutoItX3.Control"); var Result_jsEP1 = oAutoIt.RegEnumKey("HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Print\\Printers",1); alert(Result_jsEP1); } </script> </body> </html> Give me : "Adobe PDF" on a XP-SP2 with Active-X, in IE, authorized. Link to comment Share on other sites More sharing options...
Gaev Posted July 3, 2006 Author Share Posted July 3, 2006 Michel Claveau:Thank you for your second suggestion ... it worked for me too ... it was then that I realized that your first suggestion also works ... didn't work initially because I did not catch the part about the double back-slashes in your first suggestion ... ... sorry about that and thank you for your assistance.Thank you nfwu for your assistance as well. Gaevhttp://www.scriptedlogic.com Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now