AutoHotkey Community

It is currently May 27th, 2012, 11:38 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 271 posts ]  Go to page Previous  1 ... 14, 15, 16, 17, 18, 19  Next

Do you think this tutorial is beneficial to the AHK Community?
Yeah, I think this tutorial is a great value-add to the Community.
Nope - I think this tutorial is a waste of web space.
I think this tutorial would be better if it incorporated AHK_L & COM_L.
You may select 1 option

View results
Author Message
 Post subject:
PostPosted: November 7th, 2011, 1:36 pm 
I forgot to mention I already googled it. I was hoping someone with Javascript would know exactly why this code is causing this message.

There is a crap load of cross-site scripting information out there. Most of it is how to prevent cross-site scripting when programming with javascript.

I will continue looking.

thanks


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 8th, 2011, 11:33 pm 
Offline

Joined: April 27th, 2008, 5:28 pm
Posts: 489
First I want to thank Jethrow for this tutorial. Very well written.

In a effort to understand using com to control a webpage I am starting simple.

I am retrieving the contents of each element using a loop. When it gets to an element that does not exist the script produces an error.

Error: 0x80020006 - Unknown name.
Specifically: 23

---> 009: text := WB.document.getElementsByTagName("td")[ A_Index ].innerText


Code:
#SingleInstance,force
WB := ComObjCreate("InternetExplorer.Application")
WB.Visible := True
WB.Navigate("http://www.autohotkey.com/forum/search.php")
while, WB.ReadyState != 4
 Sleep, 10
loop ;When the loop gets to 23 I get the error
 {
  text := WB.document.getElementsByTagName("td")[ A_Index ].innerText
  if text <>
   MsgBox td (%A_Index%)`n%text%
 }


How can I avoid this error if I do not know the total number of elements?
Can I retrieve the total number of elements before I retrieve the value of each element?

_________________
Check out my scripts.
(MyIpChanger) (XPSnap) (SavePictureAs)

All my scripts are tested on Windows 7, AutoHotkey_L 32 bit Ansi unless otherwise stated.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 11th, 2011, 2:46 pm 
Offline

Joined: April 27th, 2008, 5:28 pm
Posts: 489
I suppose I was getting basic AHK and AHK_L mixed up
Code:
#SingleInstance,force
WB := ComObjCreate("InternetExplorer.Application")
WB.Visible := True
WB.Navigate("http://www.autohotkey.com/forum/search.php")
while, WB.ReadyState != 4
 Sleep, 10
com_error(0) ;does not work
ComObjError(false) ;works

loop ;When the loop gets to 23 I no longer get the error
 {
  text := WB.document.getElementsByTagName("td")[ A_Index ].innerText
  if text <>
   MsgBox td (%A_Index%)`n%text%
 }


No more errors.

_________________
Check out my scripts.
(MyIpChanger) (XPSnap) (SavePictureAs)

All my scripts are tested on Windows 7, AutoHotkey_L 32 bit Ansi unless otherwise stated.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 11th, 2011, 5:09 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
@datalife try this please instead your code may work but it is error prone and incorrect
Code:
#SingleInstance,force
WB := ComObjCreate("InternetExplorer.Application")
WB.Visible := True
WB.Navigate("http://www.autohotkey.com/forum/search.php")
while, WB.ReadyState != 4
 Sleep, 10
;com_error(0) ;does not work
;ComObjError(false) ;works
cells := WB.document.getElementsByTagName("td")
loop % cells.length ;When the loop gets to 23 I no longer get the error
   {
   text := cells[ A_Index-1 ].innerText
   if text <>
      MsgBox % "td (" A_Index-1 ")`n" text
   }

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 11th, 2011, 7:12 pm 
Offline

Joined: April 27th, 2008, 5:28 pm
Posts: 489
thanks Tank.

I sure have a lot to learn

_________________
Check out my scripts.
(MyIpChanger) (XPSnap) (SavePictureAs)

All my scripts are tested on Windows 7, AutoHotkey_L 32 bit Ansi unless otherwise stated.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 13th, 2011, 7:32 pm 
I learned the hard way if you leave out WB.Visible := True or set it to WB.Visible := False

be sure to run
Code:
wb.quit

before exiting your script.

During testing I ended up with 10 invisible iexplore.exe processes.

I only found this in one place in the manual and it has no explaination.


Report this post
Top
  
Reply with quote  
PostPosted: March 5th, 2012, 10:00 pm 
Is there a way to connect to an existing COM object.

For example, instead of creating a new instance of an IE COM, I instead connect to an already open IE instance?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 6th, 2012, 2:18 am 
Offline
User avatar

Joined: May 24th, 2009, 5:35 am
Posts: 2099
Location: Iowa, USA
Check out the the FAQs at the end of the tutorial.

_________________
Image
Recommended: AutoHotkey_L
Basic Webpage Controls


Report this post
Top
 Profile  
Reply with quote  
PostPosted: March 30th, 2012, 9:23 pm 
Offline

Joined: March 2nd, 2012, 8:50 pm
Posts: 6
I reposted my question into the Support section.


Last edited by Centrum on April 11th, 2012, 3:15 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 31st, 2012, 4:53 am 
Offline
User avatar

Joined: May 24th, 2009, 5:35 am
Posts: 2099
Location: Iowa, USA
Quote:
I run AutoHotkey (v.1.0.48.05) on Windows 9x with IE5.

If it is possible & not a system limitation, I bet Sean would even frown at making the COM Library completely compatible. Perhaps you should ask in the Ask for Help section. See if any other Windows 9x with IE5 users experience the same problem.

_________________
Image
Recommended: AutoHotkey_L
Basic Webpage Controls


Report this post
Top
 Profile  
Reply with quote  
 Post subject: onchange function
PostPosted: April 6th, 2012, 5:43 am 
Offline

Joined: April 14th, 2011, 2:21 am
Posts: 30
Code:
<script>function doNextConfirm(command) {

         if (confirm('Are you sure that you want to delete this account?')) {
         doNext(command)
         }
         }


         function doNext(command) {
         document.mainDisplay.cmd.value = command;
         document.mainDisplay.submit();
         }

         function onLoadFunction() {
         
                               
                                }

         function deleteUser() {
         if (confirm("Are you sure that you want to delete this user?")) {
         doNext('deleteUser');
         }
         }
         function deleteCustomer() {
         if (confirm("Are you sure that you want to delete this customer?")) {
         doNext('deleteCustomer');
         }
         }</script><script xmlns="http://www.w3.org/1999/xhtml" src="../scripts/reportingv6.1.4.js" language="javascript">;</script>
<select tabindex="5" onchange="doNext('selectUser')" name="user" style="width: 200px"><option value="">please select...</option><option value="@C373879">15069@15069.com</option></select>


In this situation how can i make the onchange work?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 6th, 2012, 8:07 am 
Offline
User avatar

Joined: May 24th, 2009, 5:35 am
Posts: 2099
Location: Iowa, USA
It seems you are asking an AJAX question in an AHK forum. You may want to try a javascript forum. However, note that the following works as expected in Chrome & Firefox:
Code:
<select onchange="alert('onchange')"><option>1</option><option>2</option></select>

Google results for IE9 show there is a bug with the onchange event.

_________________
Image
Recommended: AutoHotkey_L
Basic Webpage Controls


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 6th, 2012, 8:45 am 
Offline

Joined: April 14th, 2011, 2:21 am
Posts: 30
My question is about java COM :D, I can not use selectIndex to select the dropdownlist option. the error asking about mshtml.hlp file. Can you help me with it? First I used pwb....value := ... but it's not effected. (the text is change, but it has no effect.)


Report this post
Top
 Profile  
Reply with quote  
PostPosted: April 21st, 2012, 6:24 pm 
Offline
User avatar

Joined: November 7th, 2010, 2:48 am
Posts: 72
Location: Egret Island
jethrow wrote:
(original is AHK Basic only, but here is an AutoHotkey_L Version by sinkfaze)

Here is error. This remains AutoHotkey Basic version.
Please check it.

_________________
Recommended: AutoHotkey_L My code is based on it or similar versions, e.g. AutoHotkey_H.
Image
Together with AutoHotkey, we grow and march forward. No matter how the future will be, this period of days is still epic.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: April 22nd, 2012, 5:20 am 
Offline
User avatar

Joined: May 24th, 2009, 5:35 am
Posts: 2099
Location: Iowa, USA
Actually, it's for AHK_L, but it uses the COM_L library. I thought I updated it for sinkfaze to use Native COM, but I cannot seem to find that post. I'll wait for a response from sinkfaze, otherwise I'll update it again sometime ...

_________________
Image
Recommended: AutoHotkey_L
Basic Webpage Controls


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 271 posts ]  Go to page Previous  1 ... 14, 15, 16, 17, 18, 19  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: bowen666, nomissenrojb and 62 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group