jimmy Posted May 3, 2006 Share Posted May 3, 2006 I am trying to Click on a Link embeded with <Form Name=UIForm>...onclick="Install();return false;"><LocID ID=locInstallCert1>Install this certificate</LocID></Span> ...I think I have tried everything, but nothing helps:I am using this peace of AutoIt Script Code:$insert_cert= "locInstallCert1"$oInputs = _IETagNameGetCollection ($o_IE.document, "LocID")For $oInput in $oInputs if ($oInput.ID = $insert_cert) Then$oInput.click <----( but I tried also Send($oInput.click), Send($oInput.fireEvent("onclick")))ConsoleWrite('>Error code: ' & @error & @lf & @lf & '@@ Trace(73) : After Click' & @lf) ;### Trace ConsoleEndifNextit stops execution directly after $oInput.click. The Mouse click is succesfully executed the window with the warning which i expected pops up, but this was it, the script stops here. The line directly below ConsoleWrite ... won't be ececuted anymore. Have anybody an idea to say the script to continue.I added the complete source code below. <P><Form Name=UIForm><Table Border=0 CellSpacing=0 CellPadding=0><TR> <TD><Img Src="certspc.gif" Alt="" Height=1 Width=40></TD> <TD><Img Src="certcert.gif" Alt="" Width=32 Height=24></TD> <TD><Img Src="certspc.gif" Alt="" Height=1 Width=5></TD> <TD><Font ID=locInstCert1Font Face="Arial"><Span tabindex=0 ID=spnInstall Style="cursor:hand; color:#0000FF; text-decoration:underline;" oncontextmenu="return false;" onmouseover="window.status='Install certificate';return true;" onmouseout="window.status='';return true;" onkeydown="if (13==event.keyCode) {Install();return false;} else if (9==event.keyCode) {return true;};return false;" onclick="Install();return false;"><LocID ID=locInstallCert1>Install this certificate</LocID></Span> <------ I want to click on that Link <Span ID=spnAlreadyInstalled Style="display:none"><LocID ID=locAlreadyInstalledCert>(You have already installed this certificate)</LocID></Span></Font></TD> </TR></Table></Form></P> Link to comment Share on other sites More sharing options...
nfwu Posted May 3, 2006 Share Posted May 3, 2006 (edited) Technically, that is not a link.It is a <span> that happens to have a "onclick" javascipt event attached to it that will call the User-Defined Javascript Function "Install();"Pass me the whole file and I'll see what I can do with it.#)Edit: wait a moment, noticed something: a onkeydown javascript event.onkeydown="if (13==event.keyCode) {Install();return false;} else if (9==event.keyCode) {return true;};return false;"Javascript uses ASCII values as key codes, so ASCII 13 = the Enter key.Try Send("{ENTER}")that should work..EDIT2: For ASCII Values, refer to: http://www.jimprice.com/ascii-0-127.gif#) Edited May 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...
jimmy Posted May 3, 2006 Author Share Posted May 3, 2006 Technically, that is not a link. It is a <span> that happens to have a "onclick" javascipt event attached to it that will call the User-Defined Javascript Function "Install();" Pass me the whole file and I'll see what I can do with it. #) Edit: wait a moment, noticed something: a onkeydown javascript event. onkeydown="if (13==event.keyCode) {Install();return false;} else if (9==event.keyCode) {return true;};return false;" Javascript uses ASCII values as key codes, so ASCII 13 = the Enter key. Try Send("{ENTER}") that should work.. EDIT2: For ASCII Values, refer to: http://www.jimprice.com/ascii-0-127.gif #) Hi, thanks for looking at that. I put this Send ("{ENTER}) just below the Send($oInput.click): For $oInput in $oInputs if ($oInput.ID = $insert_cert) Then ConsoleWrite('>Error code: ' & @error & @lf & @lf & 'Before Click' & @lf) ;### Trace Console Send($oInput.click) ConsoleWrite('>Error code: ' & @error & @lf & @lf & 'After Click' & @lf) ;### Trace Console Send("{ENTER}") WinWaitActive("Potential Scripting Violation") Send("{TAB}") Send("{ENTER}") ExitLoop EndIf On the Console I see the message "Before Click" and the Window with the title ("Potential Scripting Violation") pops up, but there is no "After Click". Maybe there is no solution for this problem or the Mouseclick has to be simmulated on an other way. I appendend the whole code at this message. Link to comment Share on other sites More sharing options...
nfwu Posted May 4, 2006 Share Posted May 4, 2006 Maybe the following solution: 1. Dowload the script 2. Append the following javascript code to the end of the script: <script language="Javascript"> setTimeout("added_script_stuff()", 3000) //Call the below function after 3 seconds function added_script_stuff(){ if (g_bOkToInstall != false){ //If ok is not false, //Yay! All ready to go! Let's Install: Install() } else { //Otherwise, //Call this script to check status again in 1 second setTimeout("added_script_stuff()", 1000) } }</script> 3. Open the page in a web browser, and it _should_ automatically install itself! #) 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...
jimmy Posted May 4, 2006 Author Share Posted May 4, 2006 Maybe the following solution: 1. Dowload the script 2. Append the following javascript code to the end of the script: <script language="Javascript"> setTimeout("added_script_stuff()", 3000) //Call the below function after 3 seconds function added_script_stuff(){ if (g_bOkToInstall != false){ //If ok is not false, //Yay! All ready to go! Let's Install: Install() } else { //Otherwise, //Call this script to check status again in 1 second setTimeout("added_script_stuff()", 1000) } }</script> 3. Open the page in a web browser, and it _should_ automatically install itself! #)Hi, I tried to include your script directly in the Auto-It script and i get a compilation error. I load the script directly with the IE (Version 5.5 and 6.0) and I get a syntax error, see attachment javascript_direct.jpeg. When I embeded the script in a HTML -page than i get the error "g_bOkToInstall is not defined" see embeded_in_html.jpeg. I can't manipulate the original page where the link is, it's originated by a Microsoft Certificate Authority. Can you give me a hint what I am doing wrong? Regards Link to comment Share on other sites More sharing options...
nfwu Posted May 5, 2006 Share Posted May 5, 2006 Step 1: Get the source of the page. (I think there is an IE function for that) Step 2: Append the script i gave you to it and save as a ".html" file on the computer. Step 3: Open the ".html" file in a web browser. #) 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...
jimmy Posted May 5, 2006 Author Share Posted May 5, 2006 Step 1: Get the source of the page. (I think there is an IE function for that)Step 2: Append the script i gave you to it and save as a ".html" file on the computer.Step 3: Open the ".html" file in a web browser. #)I have done it and the problem persist. I am not sure that the script is really loaded. After having loaded the html file in the browser, like youadviced me, I click on that link and the expected Window with the warning appears "Potential scripting violation", I click "Yes" but than it's searching for a file on my Computer a C:\temp\certrmpn.asp which doesn't exists (certrmpn.asp exists only on the Microsoft Certificate Authority). If the java script has been loaded only by loading the html-file and Mouse-Click, than we can say the script doesn't really helps.I tried also to load the script with other pages, but it doesn't really helps. Is there not a way to force Auto-it to send which stops the simmulation of the mouse click something like Send($oInput.click & "break") ?Regards & have a nice weekend 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