AutoHotkey Community

It is currently May 26th, 2012, 7:52 pm

All times are UTC [ DST ]




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 215 posts ]  Go to page Previous  1 ... 10, 11, 12, 13, 14, 15  Next

Do you find this group pf wrapper functions for IE Automation Usefull
no you suck 8%  8%  [ 3 ]
need better Documentation 28%  28%  [ 10 ]
What is DHTML i dont understand how this helps 11%  11%  [ 4 ]
I use Firefox this is a stupid idea 28%  28%  [ 10 ]
I know DHTML this is a reasonably good AHK adaption 6%  6%  [ 2 ]
This is the best DHTML too in the AHK Forum 19%  19%  [ 7 ]
Total votes : 36
Author Message
 Post subject:
PostPosted: July 5th, 2009, 4:33 pm 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5480
Location: the tunnel(?=light)
When you check the page source does that button have an embedded call to the ondblclick function? If so the opening tag for the button should look something like this:

Code:
<button ondblclick="document.getElementById. . . >

_________________
Image
Try Quick Search for Autohotkey or see the tutorial for newbies.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 5th, 2009, 4:59 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
sounds like from the description you need to set focus then use fireevent

have you tried that?
Code:
com_invoke(pwb,"document.all.item[idorname].focus")
com_invoke(pwb,"document.all.item[idorname].fireevent", "onDblClick")

_________________
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: July 5th, 2009, 6:12 pm 
Offline

Joined: June 24th, 2008, 8:30 am
Posts: 126
Quote:
does that button have an embedded call to the ondblclick function

No it doesn't. I put the <tr> on the last page showing everything on it. Unfortunately it just has an id attatched to the tr tag. I also put the js file I found of their server and tried going through a bunch of the functions trying things with that, but probably wasn't doing it right.

Quote:
sounds like from the description you need to set focus then use fireevent

That would seem like it would work also, but it doesn't do anything.


I'm not sure how this webpage works exactly. I know it has something to do with those javascript functions that I posted, but I cant break any ground on it.

Thank you both for your suggestions. Let me know if you can think of something else i'm missing. (you guys know A LOT more than me about this stuff, so thanks for taking the time to share your knowledge).

_________________
“Whenever I'm about to do something, I think, 'Would an idiot do that?' And if they would, I do not do that thing.”

-Dwight


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 5th, 2009, 7:39 pm 
Offline

Joined: June 24th, 2008, 8:30 am
Posts: 126
How would I go about calling some of the javascript functions in the .js file I found? Or would that not be the right way to do it anyway?

Here a double click function I found:

Code:
   dblClick: function(event)
   {
      if(this.options.onDblClick && this.getSelector(Event.element(event)))
      {
         this.options.onDblClick();
      }
   },

_________________
“Whenever I'm about to do something, I think, 'Would an idiot do that?' And if they would, I do not do that thing.”

-Dwight


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 6th, 2009, 4:27 am 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
you cannot fire event based functions directly you must fire the triggoring event

_________________
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: July 6th, 2009, 4:44 am 
Offline

Joined: June 24th, 2008, 8:30 am
Posts: 126
oh, ok. So does that mean its not possible to do what i'm trying to do?

_________________
“Whenever I'm about to do something, I think, 'Would an idiot do that?' And if they would, I do not do that thing.”

-Dwight


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 6th, 2009, 5:07 am 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
no it means your going to have to understand what events to fire

_________________
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: July 6th, 2009, 5:32 am 
Offline

Joined: June 24th, 2008, 8:30 am
Posts: 126
any suggestions on how to find that out? it doesn't have any events attached to the <tr> tag that needs to be "clicked"

Everything else I have needed to click has had an "onclick" event attached to it, but this has nothing. Where should I look to find it?

Thanks

_________________
“Whenever I'm about to do something, I think, 'Would an idiot do that?' And if they would, I do not do that thing.”

-Dwight


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 6th, 2009, 5:48 am 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
just going to have to experiment unfortuntely with no access i cant offer more

_________________
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: July 6th, 2009, 8:33 am 
Offline

Joined: June 24th, 2008, 8:30 am
Posts: 126
If it is access to the page you want, I never said I wouldn't give that to you. I already posted the full source code for the page, as well as the .js file with all of the functions in it, but I will also give you the login if you want it so you can see what i see. But if you just don't want to spend the time, i understand that, so you can just say so.

anyway, i've downloaded event spy, dom inspectors of all kinds, etc. etc. and to be honest with you, I really don't know what I'm looking for since the event is not obvious in this situation. I really appreciate the help you've given thus far tank. If you don't want to take a look at it, do you have any suggestions on how I can find the right event to fire?

Thanks again.

_________________
“Whenever I'm about to do something, I think, 'Would an idiot do that?' And if they would, I do not do that thing.”

-Dwight


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 6th, 2009, 1:52 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
pm me some credentials and instructions on what exactly your doing

_________________
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: July 7th, 2009, 4:08 am 
This is slightly confusing... is there one of the functions on this thread that will find an id, or a name on the dom object based on part of the id or name? Like if i wanted to search through all dom objects in some kind of a loop, and if the returned id or name value contains a specified text, it would break the loop? like loop until it finds a name that contains the string "pass" or "user" and then return. If the id is username, then it would break the loop with that value?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 10th, 2009, 4:14 am 
Offline

Joined: June 24th, 2008, 8:30 am
Posts: 126
Quote:
pm me some credentials and instructions on what exactly your doing


I sent them, but am unsure if the message went through, just double checking.

Thanks

_________________
“Whenever I'm about to do something, I think, 'Would an idiot do that?' And if they would, I do not do that thing.”

-Dwight


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 12th, 2009, 6:52 am 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
New single browser based function for all versions of IE
Code:
/*
Function written exclusively by Tank with thanks to Sean for creating the COM library
Parameters
pTitle            -    Input (string) full or partial title case insensitive
URL               -   Input (string) navigates to a Fully qualified URL
DocumentComplete   -   Input (Bool) true advises the function to pause till any navigation is complete
WebBrowser2         -   Output (integer) Interface pointer
left            -   Input/Output (integer) pixels from left of screen that leftmost point of browser occupies
top               -   Input/Output (integer) pixels from top of screen that topmost point of browser occupies
height            -   Input/Output (integer) height in pixels
width            -   Input/Output (integer) width in pixels
MenuBar            -   Input/Output (Bool) returns -1 if true any value other than 0 sets to vis
AddressBar         -   Input/Output (Bool) returns -1 if true any value other than 0 sets to vis
StatusBar         -   Input/Output (Bool) returns -1 if true any value other than 0 sets to vis
Visible            -   Input/Output (Bool) returns -1 if true any value other than 0 sets to vis
Returns          -   iHTMLDocument2   
*/
;; Returns an iHTMLDocument2 object
iWebBrowser2(pTitle="",URL="",DocumentComplete=0,ByRef   WebBrowser2="",ByRef   left="",ByRef   top="",ByRef   height="",ByRef   width="",ByRef   MenuBar="",ByRef   AddressBar="",ByRef   StatusBar="",ByRef   Visible="")
{
   static ShellWindows                                  ;;   no need to create and destroy this if your automation is going to use the same one all the time
   static iWebBrowser2                                    ;;   no need to create and destroy this if your automation is going to use the same one all the time
   static LocationName                                    ;;   Store the page title of the current window
   If   !ShellWindows   {                                 ;;    no need to re invent the wheal each time
      oShell          :=    COM_CreateObject("Shell.Application")   ;;    there is no need to constantly create and destroy this object
      ShellWindows    :=    COM_Invoke(oShell,   "Windows")         ;;   leaving a copy of the windows collection avail for future calls just makes sence
      If   !ShellWindows   {                              ;;    failure generate an error and exit
         MsgBox, 262160, Windows Collection, Creation of ShellWindows collection failed
         WebBrowser2:=iWebBrowser2
         Return
      }
      COM_Release(oShell)                                 ;;   Now useless no need for it any more
   }
   /* /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
   the conditions under which we need to create a new browser bariable are as follows
   the static iWebBrowser2 is blank
   the static LocationName variable has changed
   */ ;;//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
   If   !iWebBrowser2   {                                 ;;   create a new handle
      
      Gosub,Title
      If   !LocationName   {
         If   !iWebBrowser2   {                           ;;   No way to continue
            MsgBox, 262160, Error, Without some reference to a valid Internet Explorer window the script cannot continue
            WebBrowser2:=iWebBrowser2
            Return
         }                                          ;;   while it doesnt make sense all w care about is the browser object
         
      }
      Else   {
         Gosub,GetBrowser
      }
   }
   Else   If   (pTitle <> LocationName && pTitle) {            ;;   assume this is a request for a new browser handle
      Gosub,GetBrowser
   }
   
   
   If   !iWebBrowser2   {                                 ;;   create a new handle
                              ;;   No way to continue
      MsgBox, 262160, Error, Without some reference to a valid Internet Explorer window the script cannot continue
      WebBrowser2:=iWebBrowser2
      Return
   }
   Else   {
      WebBrowser2:=iWebBrowser2
      If   URL   {
         COM_Invoke(iWebBrowser2,"Navigate",URL)
         Gosub,Ready
      }
      If   DocumentComplete   {                           ;;   there are times when outside of sending a URL you need to check the page is fully loaded
         Gosub,Ready
      }
                                                   ;; if you cant create a document it may be something is wrong with your browser object
      If   !iHTMLDocument2   :=   COM_Invoke(iWebBrowser2,"document") {
         MsgBox, 262160, Error, Could not get an iHTMLDocument2`nPlease pass a page title and retry
         iWebBrowser2:=
         Return
      }      
      
      If   StrLen(top) {
         COM_Invoke(iWebBrowser2,"top",top)
      }
      If   StrLen(left) {
         COM_Invoke(iWebBrowser2,"left",left)
      }
      If   height {
         COM_Invoke(iWebBrowser2,"height",height)
      }
      If   width {
         COM_Invoke(iWebBrowser2,"width",width)
      }
      If   StrLen(MenuBar) {
         COM_Invoke(iWebBrowser2,"MenuBar",MenuBar)
      }
      If   StrLen(AddressBar) {
         COM_Invoke(iWebBrowser2,"AddressBar",AddressBar)
      }
      If   StrLen(StatusBar) {
         COM_Invoke(iWebBrowser2,"StatusBar",StatusBar)
      }
      If   StrLen(Visible) {
         COM_Invoke(iWebBrowser2,"Visible",Visible)
      }
      top:=COM_Invoke(iWebBrowser2,"top")
      left:=COM_Invoke(iWebBrowser2,"left")
      height:=COM_Invoke(iWebBrowser2,"height")
      width:=COM_Invoke(iWebBrowser2,"width")
      MenuBar:=COM_Invoke(iWebBrowser2,"MenuBar")
      AddressBar:=COM_Invoke(iWebBrowser2,"AddressBar")
      StatusBar:=COM_Invoke(iWebBrowser2,"StatusBar")
      Visible:=COM_Invoke(iWebBrowser2,"Visible")
   }
   Return   iHTMLDocument2
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; function ends   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



   Title:                                             ;;   this internal sub will do the job of working out a title to search for
   {
      If   !pTitle   {
         If   !iWebBrowser2   {                            ;;   to prevent ambiguity
            IfWinNotExist,ahk_class IEFrame,,,               ;;   No IE window exists
            {
               MsgBox, 262180, No Internet Explorer, No instance of  Internet Explorer has been found `nWould you like to Open your homepage?
               IfMsgBox,yes
               {
                  If   !iWebBrowser2    := (iWebBrowser2 := COM_CreateObject("InternetExplorer.Application") ) ? (iWebBrowser2,COM_Invoke(iWebBrowser2 , "Visible=", "True")) :
                  {
                     MsgBox, 262160, Error, Could not start Internet Explorer
                     Return                           ;;   return to the function   
                  }
                  Else   {
                     COM_Invoke(iWebBrowser2,   "GoHome")
                     Gosub,Ready
                     LocationName   :=   COM_Invoke(iWebBrowser2,   "LocationName")
                     Return                           ;;   return to the function      
                  }
               }
               Else   {
                  MsgBox, 262160, Error, No active Internet Explorer window was found
                  Return
               }
            }
            Else   {
               WinGetTitle,LocationName,ahk_class IEFrame
               StringSplit,LocationName,LocationName,-         ;;   ensure no crazy browser suffixes
               LocationName=%LocationName1%
               Return                                 ;;   return to the function   
            }
         }
         Else   {
            LocationName   :=   COM_Invoke(iWebBrowser2,   "LocationName")
            Return                                    ;;   return to the function      
         }
      }
      Else   {
         StringSplit,LocationName,pTitle,-                  ;;   ensure no crazy browser suffixes
         LocationName=%LocationName1%
         Return                                       ;;   return to the function
      }
   }
   
   
   Ready:
   {
      loop 10                     ;   sets limit if itenerations to 40 seconds 80*500=40000=40 secs
      {   
         If not (rdy:=COM_Invoke(iWebBrowser2,"readyState") = 4)
            Break               ;   return success
         Sleep,100               ;   sleep .1 second between cycles
      }
      loop 80                     ;   sets limit if itenerations to 40 seconds 80*500=40000=40 secs
      {   
         If (rdy:=COM_Invoke(iWebBrowser2,"readyState") = 4)
            Return               ;   Done
         Sleep,500               ;   sleep half second between cycles
      }
      MsgBox, 262160, Error, While waiting for IE to return to a DocumentComplete the script exceeded the wait time
      Return
   }
   
   
   GetBrowser:
   {
   If   LocationName   {                              ;; conditions for when to create a new browser handle
         Loop, %   COM_Invoke(ShellWindows,   "Count")         ;;   loop thru all the windows and find a match
         {
            Name   :=   COM_Invoke(ShellWindows,"Item[" A_Index-1 "].LocationName")
            IfInString,Name,%LocationName%
            {
               iWebBrowser2   :=   COM_Invoke(ShellWindows,"Item",A_Index-1)
               LocationName   :=   COM_Invoke(iWebBrowser2,"LocationName")
               Return
            }
         }
      }
      Else   {
         MsgBox, 262160, Error, Without some reference to a valid Internet Explorer window the script cannot continue
         Return
      }
      If   !iWebBrowser2   {
         MsgBox, 262160, Error, No instance of Internet Explorer matches the page title %LocationName% `nThe script cannot continue
         Return
      }
      
   }   
}

I am hoping this simplifies for many accessing an Internet Explorer window
works well on versions 6-8 probably 5.x as well but cant test that

Sending a blank title will use the topmost avail IE browser in the absence of an open instance of IE will prompt the user to create one

Please remember to uninitialise COM when you are done

Why did I write this
My current library of functions still seems to confuse many

This new function handles
waiting for a page load
navigating to a web site
manipulating the visibility position and size of the intended browser

gives a wide range of example of the ability to use MSDN references to manipulate the browser

_________________
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: August 3rd, 2009, 10:44 am 
Offline

Joined: August 3rd, 2009, 9:20 am
Posts: 85
Location: Australia (Sydney)
Going back to the last fellows trouble with navigating via tables and what not, if a website doesn't have ID or Names on any of the tables, is there an easy way to find out which Table/Row/Cell you have selected? I don't relish the thought of counting through dozens of tables only to arrive at the wrong number.

In fact, I've spent the last 20 minutes doing just that. I can't find it!


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 215 posts ]  Go to page Previous  1 ... 10, 11, 12, 13, 14, 15  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: infogulch, notsoobvious, tomoe_uehara, Xx7 and 13 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