Sign in to follow this  
Followers 0
jimmy

Stops Execution

7 posts in this topic

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 Console

Endif

Next

it 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>

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by nfwu

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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!

#)

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

#)

Share this post


Link to post
Share on other sites

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 you

adviced 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

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0