finding a javascript button in a webpage?

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
mcrae
Newbie
Posts: 5
Joined: Thu Dec 08, 2005 9:39 pm

finding a javascript button in a webpage?

Post by mcrae » Thu Dec 08, 2005 9:41 pm

is this possible?

could i somehow make the macro check all of the pixels in the screen, left to right 1 at a time and when it detects a certain combination in a row, it will record that position?


thanks for any suggestions, help, or tidbits of in fo you can give :)

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Thu Dec 08, 2005 10:00 pm

An easier way to find html objects is to access the Internet Explorer Documet Object Model directly via VBScript. Search for InternetExplorer.Application on this forum for examples.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

mcrae
Newbie
Posts: 5
Joined: Thu Dec 08, 2005 9:39 pm

Post by mcrae » Thu Dec 08, 2005 11:09 pm

Not sure if I was clear enough... I'm not the creator of the web page. It is someone else's webpage, and i can't edit it.

From what i've read of VBscript, it is somethin you add into your webpage, which wouldn't help me here... unless I'm wrong.. am I?

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Thu Dec 08, 2005 11:31 pm

No, you don't have to edit the page. You can use VBScript within Macro Scheduler. Internet Explorer is an ActiveX component which you can utilise in Macro Scheduler via VBScript. You can create an IE object, navigate to a page and then access that page's underlying HTML objects via the Document Object Model. There are examples here showing how to fill in web forms and such. You can equally well enumerate different types of html objects within a web page in Internet Explorer. It is possible to search through all button objects for example, and click them, all by using VBScript in Macro Scheduler. If you search for InternetExplorer you will find various examples.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

mcrae
Newbie
Posts: 5
Joined: Thu Dec 08, 2005 9:39 pm

Post by mcrae » Fri Dec 09, 2005 12:18 am

There are only four javascript buttons on the page, and the one I want has a specific text, as well as a specific colour outline. How can I simply find that button, and click it? VBScript is kind of overwhelming :x

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Dec 09, 2005 7:52 am

Any chance you can post the URL of the page? That way we might be able to provide some example code.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

mcrae
Newbie
Posts: 5
Joined: Thu Dec 08, 2005 9:39 pm

Post by mcrae » Fri Dec 09, 2005 7:29 pm

heres a screenshot of the page

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Dec 09, 2005 7:37 pm

No help. Need the URL and need to be able to access the page otherwise we can't analyse it. Need to see the source and be able to enumerate the objects within it using VBScript.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

mcrae
Newbie
Posts: 5
Joined: Thu Dec 08, 2005 9:39 pm

Post by mcrae » Sat Dec 10, 2005 4:08 am

ok, well here is the source:

Code: Select all

 
<head><title>[SFU] Unification</title><meta http-equiv="Cache-Control" content="no-cache"><META HTTP-EQUIV="Pragma" CONTENT="no-cache"><META HTTP-EQUIV="Expires" CONTENT="-1"><link rel="stylesheet" href="i/w/i_style0.css"><script src="i_js.js"></script></head><body bgcolor=black topmargin=0 leftmargin=0 rightmargin=0 bottommargin=0><br><table align=center cellspacing=0 cellpadding=2 width=800 style="border : solid 1px yellow;" bgcolor=#383838><tr><td align=center>   Apologies for the problem using turns in projects on UC. Please be patient until Stephen is able to look into the cause.   </td></tr></table><table cellspacing=0 cellpadding=0 align=center><tr><td><a href=i.cfm><img src=i/w/logo2.gif></td></tr></table><table cellspacing=0 cellpadding=3 align=center><Tr valign=top align=center><td class=smallfont> <br><img src=i/w/sp_.gif width=1 height=5><table class=bodybox width=100% height=200><Tr><Td valign=top nowrap><font class=table_row0>ECONOMY<br><img src=i/w/sp_.gif height=5><br><a href=?f=ec_col>Manage Planets</a><br><a href=?f=ec_market>Market</a><br><br>SCIENCE<br><img src=i/w/sp_.gif height=5><br><a href=?f=sc_research>Research</a><br><a href=?f=sc_event>Events</a><br><a href=?f=sc_project>Projects</a><br><a href=?f=sc_artifact>Artifacts</a><br><br>MILITARY<br><img src=i/w/sp_.gif height=5><br><a href=?f=mi_fleet>Fleet</a><br><a href=?f=mi_explore>Explore</a><br><a href=?f=mi_ship>Shipyard</a><br><a href=?f=mi_attack>Attack</a><br><a href=?f=mi_record&ty=1>Records</a><br><a href=?f=mi_intel>Intel</a><br><a href=i.cfm?f=rank&af=1>Rank</a><br><br>DIPLOMACY<br><img src=i/w/sp_.gif height=5><br><a href=?f=di_lord>Lord</a><br><a href=?f=di_vassal>Vassal</a><br><img src=i/w/sp_.gif height=5><br><a href=?f=fed_detail>Federation</a> <font color=gray class=smallfont>(Clan)</font><br></td></tr></table><img src=i/w/sp_.gif height=5><br><a href=i.cfm?f=com_user><img src=http://uc1.gamestotal.com/i/donate1.gif class=pic></a><br><img src=i/w/sp_.gif height=2><br><a href=i.cfm?f=invite><img src=http://uc1.gamestotal.com/i/b/invite.gif class=pic></a></td><td><table cellspacing=0 cellpadding=0 width=100%><tr class=smallfont><td>   <a href=i.cfm?f=di_summary>Manage Empire</a>   |   <a href=i.cfm?f=com_guide><font color=yellow class=smallfont> I need help</font></a></td><td align=right><a href=i.cfm?f=quest>Mission</a>   |   <a href=i.cfm?f=option>Options</a>   |   <a href=i.cfm?p=logout>Logout</a>    </td></tr></table><img src=i/w/sp_.gif width=1 height=5><br><table cellspacing=0 cellpadding=4 width=550 height=400 class=bodybox><tr valign=top><TD align=center  background=i/w/bg2.jpg><table width=100%><tr><Td><table cellspacing=0 cellpadding=2 class=smallfont><tr><td></td></tr></table></td><tD align=right><table cellspacing=0 cellpadding=2 class=smallfont><tr><td class=res nowrap> <a href=i.cfm?f=ec_income>$                 117.83 <font color=yellow><i>bil</i></font></a> </td><td></td><td class=res nowrap>           4,426,464 Food </td><td></td><td class=res><a href=i.cfm?f=sc_event>           1,791,950 Pr </td><td></td><td class=res nowrap> <a href=i.cfm?f=turn>                 24 Turns</a> </td><td></td><td class=res nowrap> <a href=i.cfm?&4512&f=pm title=" Logged in as tykanII "> tykanII</a> </td></tr></table></td></tr></table><br><font class=titlefont>Research</font><Br> 
<table width=430><tr><td>

<table cellspacing=0 cellpadding=0 border=0 class=table_back><tr><td><table cellspacing=1 cellpadding=1 border=0 width=100%><tr class=table_row0><td>  <b>Infrastructure</b>   </td></tr></table></td></tr></table><img src=i/w/sp_.gif height=2><br>

<table cellspacing=0 cellpadding=0 border=0  class=table_back width=80%><tr><td><table cellspacing=1 cellpadding=1 border=0 width=100%>
<Tr class=table_row0><td> Type</td><td align=center width=1%> Level </td>

<td rowspan=6 align=center>
<table cellspacing=0 cellpadding=0 border=0 class=table_back><tr><td><table cellspacing=1 cellpadding=1 border=0 width=100%>
<Tr class=table_row0><td colspan=2 align=center nowrap>     Researching <b>Housing</b>     </td></tr>
<Tr class=table_row1><Td width=60% align=right>Turns Left </td><Td width=40%> 134</td></tr>
<Tr class=table_row1><Td colspan=2 align=center><input type=button value="Continue research"  onclick="document.location='i.cfm?&4512&f=sc_research2&rtype=1';"> </td></tr>
</table></td></tr></table>
</td>

</tr>
<Tr class=table_row1 ><Td> Housing</a></td><td align=right>39 </td></tr>
<Tr class=table_row1 ><Td> Commercial</a></td><td align=right>0 </td></tr>

<Tr class=table_row1 ><Td> Industry</a></td><td align=right>0 </td></tr>
<Tr class=table_row1 ><Td> Agriculture</a></td><td align=right>0 </td></tr>

<Tr class=table_row1 ><Td> Mining</a></td><td align=right>0 </td></tr>

</table></td></tr></table><br>

<table cellspacing=0 cellpadding=0 border=0 class=table_back><tr><td><table cellspacing=1 cellpadding=1 border=0 width=100%><tr class=table_row0><td>  <b>Technology Tree</b>   </td></tr></table></td></tr></table><img src=i/w/sp_.gif height=2><br>
<table cellspacing=0 cellpadding=0 border=0 class=table_back width=100%%><tr><td><table cellspacing=1 cellpadding=1 border=0 width=100%>

<tr class=table_row0 align=center><td width=29%>Technology</td><td width=14%>Type</td><td width=12%>Turns</td><td>Requires</td></tr>




<tr class=table_row1 id="n_201" onmouseover="NLcso('n_201');" onmouseout="NLcso2('n_201');" onclick="document.location='i.cfm?f=sc_rtree&id=92';"><td class=smallfont nowrap> <a href=i.cfm?f=sc_rtree&id=92 >K Class Destroyer</a> </td><td class=smallfont> Ship class</td><td align=center>8000</td><td class=smallfont> - Advanced Scouts</td></tr>



<tr class=table_row1 id="n_202" onmouseover="NLcso('n_202');" onmouseout="NLcso2('n_202');" onclick="document.location='i.cfm?f=sc_rtree&id=108';"><td class=smallfont nowrap> <a href=i.cfm?f=sc_rtree&id=108 >I-Tech Libary</a> </td><td class=smallfont> Technology</td><td align=center>150</td><td class=smallfont> - Space Program I</td></tr>



<tr class=table_row1 id="n_203" onmouseover="NLcso('n_203');" onmouseout="NLcso2('n_203');" onclick="document.location='i.cfm?f=sc_rtree&id=110';"><td class=smallfont nowrap> <a href=i.cfm?f=sc_rtree&id=110 >Spying Capability</a> </td><td class=smallfont> Technology</td><td align=center>150</td><td class=smallfont> - Mega Projects</td></tr>



<tr class=table_row1 id="n_204" onmouseover="NLcso('n_204');" onmouseout="NLcso2('n_204');" onclick="document.location='i.cfm?f=sc_rtree&id=115';"><td class=smallfont nowrap> <a href=i.cfm?f=sc_rtree&id=115 >System Defense III</a> </td><td class=smallfont> Technology</td><td align=center>160</td><td class=smallfont> - System Defense II</td></tr>



<tr class=table_row1 id="n_205" onmouseover="NLcso('n_205');" onmouseout="NLcso2('n_205');" onclick="document.location='i.cfm?f=sc_rtree&id=120';"><td class=smallfont nowrap> <a href=i.cfm?f=sc_rtree&id=120 >Space Program IV</a> </td><td class=smallfont> Technology</td><td align=center>190</td><td class=smallfont> - Space Program III</td></tr>



<tr class=table_row1 id="n_206" onmouseover="NLcso('n_206');" onmouseout="NLcso2('n_206');" onclick="document.location='i.cfm?f=sc_rtree&id=123';"><td class=smallfont nowrap> <a href=i.cfm?f=sc_rtree&id=123 >Ministers Training Facility</a> </td><td class=smallfont> Technology</td><td align=center>165</td><td class=smallfont> - Ministers Office</td></tr>



<tr class=table_row1 id="n_207" onmouseover="NLcso('n_207');" onmouseout="NLcso2('n_207');" onclick="document.location='i.cfm?f=sc_rtree&id=124';"><td class=smallfont nowrap> <a href=i.cfm?f=sc_rtree&id=124 >Century Temple</a> </td><td class=smallfont> Technology</td><td align=center>100</td><td class=smallfont> - Ministers Office</td></tr>



<tr class=table_row1 id="n_208" onmouseover="NLcso('n_208');" onmouseout="NLcso2('n_208');" onclick="document.location='i.cfm?f=sc_rtree&id=94';"><td class=smallfont nowrap> <a href=i.cfm?f=sc_rtree&id=94 >Capsule Lab</a> </td><td class=smallfont> Alien</td><td align=center>130</td><td class=smallfont></td></tr>



</table></td></tr></table>
</td></tr></table>

<br><br>
<table width=30% class=bodybox><tr><td class=smallfont>
<a href=i.cfm?f=sc_rtreed><img src=i/w/b_arrowright.gif> Researched Technology</a><br><br>
<font color=yellow>Related help topics</font><br>
<a href="manual/?/research_infrastructure" target=_blank><img src=i/w/b_arrowright.gif> Infrastructure Research</a><br>
<a href="manual/?/research_tree" target=_blank><img src=i/w/b_arrowright.gif> Technology Encyclopedia</a>
</td></tr></table>
<BR> </td></tr></table></td><td class=smallfont><a href=i.cfm?&6029&f=com_chat&ochat=1><u>Chat</u></a> | <a href=i.cfm?&6029&f=pm_add&ochat=0>Friends</a><br><img src=i/w/sp_.gif width=1 height=5><br><table cellspacing=0 cellpadding=2 width=105 height=150 class=bodybox><tr valign=top><td class=smallfont><div align=center><a href=javascript:och();>Post</a> | <a href=i.cfm?&6029&f=com_msgsector>More</a></div><br><font color="#aaaaaa"><u>shakeit</u> : arial hey what u talking about????<br><img src=i/w/sp_.gif height=5><br><u>TickleMeElmo</u> : Kinghippie nice story but i would never hit your girlfreind especially when she is lying right next too me clicking the research button :D<br><img src=i/w/sp_.gif height=5><br><u>Sync0pe</u> : KingHippie it is that thing your posted in fed board?<br><img src=i/w/sp_.gif height=5><br><u>ScionReave</u> : meh, i want metos scouting technology... so bad..<br><img src=i/w/sp_.gif height=5><br><u>Arial</u> : No one bribes with their ships technology...How bad =/...Grrrr<br><img src=i/w/sp_.gif height=5><br><u>KingHippie</u> : o_O...... TBK thats harsh man..... i at least consider you a medium sized fish, oh and congrats on breaking even with me lol no serious. read it.<br><img src=i/w/sp_.gif height=5><br><u>KingHippie</u> : Ok TBK, i sent it, lol read it...... tis awesome.<br><img src=i/w/sp_.gif height=5><br><u>PerryIlla</u> : ... and while i rest please make my name glow yellow with your support. Goodbye until later. [End Transmission]<br><img src=i/w/sp_.gif height=5><br><u>RegorHsur</u> : virtualinsanity thx for bying all the food!!!<br><img src=i/w/sp_.gif height=5><br><u>TickleMeElmo</u> : Your not my enemy Hippie just a mnor nuscance that`s not really worth responding too. I hunt big fish \**/<br><img src=i/w/sp_.gif height=5><br></td></td></tr></table><font color=#747474>11:33 AM   10 Dec 2005<br><a href="javascript:uol();">184 Player(s) Online</a><Br>  0.02x Load (sec)</td></td></tr></table><br><br></body></html><script language="javascript1.2">
EXs=screen;EXw=EXs.width;navigator.appName!="Netscape"? EXb=EXs.colorDepth:EXb=EXs.pixelDepth; document.write('<img src="http://m1.webstats4u.com/n?id=ADpIeAE1eYqHBZTJ+YQwJew39ahQ&' + Math.round(Math.random() * 1000000) + '" width=0 height=0>');</script><script language="javascript"> EXd=document;EXw?"":EXw="na";EXb?"":EXb="na"; EXd.write("<img src=\"http://w0.extreme-dm.com", "/0.gif?tag=cowly88&j=y&srw="+EXw+"&srb="+EXb+"&", "l="+escape(EXd.referrer)+"\" height=0 width=0>"); </script> 
<iframe src="http://leader.linkexchange.com/X1723569/showiframe?840" width=0 height=0 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=no>
<a href="http://leader.linkexchange.com/X1723569/clickle" target="_top"><img width=0 height=0 border=0 ismap alt="" src="http://leader.linkexchange.com/X1723569/showle?"></a></iframe>
the particular url is http://uc2.gamestotal.com/i.cfm?f=sc_research and is only accessable by those who have an account.

you can login here: http://uc2.gamestotal.com/i.cfm?p=login

I've made a false account that you can use:
username:sheldon2
password:testing

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts