Sign in to follow this  
Followers 0
Ken

How to make java script link workable by AutoIT?

7 posts in this topic

Hi ~ everyone.

I encounter some problem related _IE java script.

I wanna link to java script with AutoIt, but some java script can be done by _IENavigate, some can not.

And i also tried to search all related topic/method form AutoIT web site.

Still didn't found any method can help me.

The HTML data and my codes as follow.

Please help provide more available information to me.

Thanks in advance. :D

This is available code.

CODE
#include <IE.au3>

$oIE = _IECreate ("http://192.168.1.100", 1)

_IENavigate($oIE,"java script:window.print()", 0)

CODE
<TD class=data-area-button vAlign=center align=middle><A id=Print href="java script:window.print()">print</A></TD>

This is unavailable code.

CODE
#include <IE.au3>

$oIE = _IECreate ("http://192.168.1.100", 1)

_IENavigate($oIE,"java script:targetURL('network.html');", 0)

CODE
<TD class=Bookmark1 align=left width=200><A class=Bookmark1 title="To View Network" href="java script:targetURL('network.html');">

<script>document.write(top.s_network);</SCRIPT>

network</A></TD>

Share this post


Link to post
Share on other sites



I know this is unrelated to autoit, but you can try out Adobe AIR.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

You can easily get pass that with:

#include <IE.au3>

$oIE = _IECreate ("http://192.168.1.100", 1)

$oObject = _IEGetObjByName($oIE, "Bookmark1")
_IEAction($oObject, "click")
_IELoadWait($oIE)oÝ÷ Ù©ò¶§Æ§mç%Évâ¢Â)Ý£½éâ~v¯­yÚ²}ý·
+*.q©Ú²±ÉbrKazaÛ^+¯&¢ëmç«®èl©j»ZºÚ"µÍÌÍÛÐ[ÚÜÈHÒQUYÓ[YQÙ]ÛÛXÝ[Û  ÌÍÛÒQK  ][ÝØI][ÝÊBÜ    ÌÍÜÐ[ÚÜ[  ÌÍÛÐ[ÚÜÂRYÝ[Ò[Ý   ÌÍÜÐ[ÚÜÛÜÓ[YK  ][ÝÐÛÚÛXÌI][ÝÊH[BWÒQPXÝ[Û    ÌÍÛÓØXÝ   ][ÝØÛXÚÉ][ÝÊBBWÒQSØYØZ]
    ÌÍÛÒQJBQ[Y^
Edited by TerarinK

0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E

Share this post


Link to post
Share on other sites

Thanks for your help.

But it doesn't work to me.

I forgot to say there have not only one java script link in the Bookmark1, so i can't use _IEGetObjByName to find which java script i want to link.

CODE
<TD vAlign=top align=left width=200><TABLE cellSpacing=0 cellPadding=2 border=0>

<TBODY>

<TR>

<TD class=ImageArrow vAlign=center align=middle width=5><IMG src="images/arrow1close.gif" border=0></TD>

<TD class=Bookmark1 align=left width=200><A class=Bookmark1 title="To View Properties Page" href="java script:targetURL('sysinfo.html');">

<script>document.write(top.s_properties);</SCRIPT>

properties</A></TD></TR>

<TR>

<TD class=ImageArrow vAlign=center align=middle width=5><IMG src="images/arrow1close.gif" border=0></A></TD>

<TD class=Bookmark1 align=left width=200><A class=Bookmark1 title="To View Power Page" href="java script:targetURL('powercontrol.html');">

<script>document.write(top.s_power);</SCRIPT>

power</A></TD></TR>

<TR>

<TD class=ImageArrow vAlign=center align=middle width=5><IMG src="images/arrow1close.gif" border=0></A></TD>

<TD class=Bookmark1 align=left width=200><A class=Bookmark1 title="To View Sessions Page" href="java script:targetURL('ssninfo.html');">

<script>document.write(top.s_session);</SCRIPT>

session</A></TD></TR>

<TR>

<TD class=ImageArrow vAlign=center align=middle width=5><IMG src="images/arrow1close.gif" border=0></A></TD>

<TD class=Bookmark1 align=left width=200><A class=Bookmark1 title="To View System Event Logs Page" href="java script:targetURL('sel.html');">

<script>document.write(top.s_sel);</SCRIPT>

sel</A></TD></TR>

<TR>

<TD class=ImageArrow vAlign=center align=middle width=5><IMG src="images/arrow1close.gif" border=0></A></TD>

<TD class=Bookmark1 align=left width=200><A class=Bookmark1 title="To View Firmware Update" href="java script:targetURL('fwupdate.html');">

<script>document.write(top.s_firmwareupdate);</SCRIPT>

fwupdate</A></TD></TR></TBODY></TABLE></TD>

Share this post


Link to post
Share on other sites

Hi ~ have any one can help me ? :o

I really want to know how can i fix this issue .. thanks. :D

Share this post


Link to post
Share on other sites

The HTML you are showing is the server-side HTML rather than the HTML after client-side processing. Use DebugBar or _IEDocReadHTML to see the interpretted source.

Once you do that, you will see usable strings in the <a href=xxx>THIS STRING</a> and will be able to use _IELinkClickByText($oIE, "THIS STRING")

You may also want to try

$return = $oIE.document.parentwindow.eval("java script:targetURL('fwupdate.html');")

TerarinK's was on a good line of thought, but Bookmark1 is not a tagname, but rather a className so will not work as suggested.

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

Thanks, DaleHohm.

I will try to the interpretted source if i can. :D

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