AutoHotkey Community

It is currently May 27th, 2012, 3:06 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 226 posts ]  Go to page Previous  1 ... 9, 10, 11, 12, 13, 14, 15, 16  Next
Author Message
 Post subject:
PostPosted: March 20th, 2010, 9:48 am 
Offline
User avatar

Joined: May 24th, 2009, 5:35 am
Posts: 2099
Location: Iowa, USA
You guys are slacking on the updates to iWebBrowser2 Learner :lol: . I implemented a Cross-Hair to outline webpage elements - rather than holding control. I didn't want to redesign the main GUI, so I put it in my compact version for testing. Could you guys try it out & let me know what you think?
>>Download Link<<

_________________
Image
Recommended: AutoHotkey_L
Basic Webpage Controls


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 20th, 2010, 5:28 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
@jethrow I like it alot 8) :D
On vacation this week so i will begin work again this week. a couple things i have decided

I am thinking on rewriting this for
making ahk_l com_l.ahk the standard and
or ahkcom which also uses com_l.ahk

from a newb standpoint and expecting folks to go from the msdn it just makes more sense to use the friendlier syntax. this means i do verymuch unless one of you object intend to fully abandon all use of the standard ahk release untill chris sees fit to merge these changes. I just cant justify in my own head supporting more complexity than already exists on this subject.

this will also mean a COMPLETE rewrite of iweb i intend to change the syntax and potentially get rid of a few functions

one example would be
instead of
Code:
pwb : = iweb_getwin("google")
iweb_setdomobj(pwb,"q","autohotkey")


to something like this
Code:
i:=(pwb:=iweb_getie("google")).document.getelementbyid("q").value := "autohotkey"
I will probably can any functions with a direct DOM method replacement but i havent decided for sure yet

_________________
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: March 20th, 2010, 7:24 pm 
Offline
User avatar

Joined: May 24th, 2009, 5:35 am
Posts: 2099
Location: Iowa, USA
tank wrote:
I am thinking on rewriting this for making ahk_l com_l.ahk the standard

+1. Just a thought ( as it may not be as Standard AHK User friendly ), but what about creating an iWeb object? Something like:
Code:
web := iWeb()
web["Google"].domobj("q") := "AutoHotkey"


EDIT - here's an example of what I mean ( though I'm not sure how to get the "__Set" metafunction to work directly on an object - if it can ):
Code:
web := iWeb()
web["Google"].domobj("q").value := "autohotkey"
; -OR-
web["Google"].domobj("q").set("autohotkey")


iWeb() {
   Return, object( "base", object( "__Get", "IEGet") )
}
domobj( obj, item, frames="" ) {
   element := obj.COMobj.document.all[ item ]
   Return, object( "COMobj", element, "base", object( "set", "set", "__Set", "Setter" ) )
}
Set( obj, param ) {
   obj.COMobj.value := param
}
Setter( obj, key, value ) {
   obj.COMobj[ key ] := value
}
IEGet( obj, name ) {
   IfEqual, Name,, WinGetTitle, Name, ahk_class IEFrame
   Name := Name="New Tab" ? "about:Tabs":RegExReplace(Name," - (Windows|Microsoft) Internet Explorer")
   Windows := COM_CreateObject( "Shell.Application" ).Windows, COM_Error( False )
   Loop, % Windows.Count
      If ( pwb:=Windows.item[A_Index-1] ).LocationName=Name && InStr( pwb.FullName, "iexplore.exe" ) {
         COM_Error( True )
         Return, object( "COMobj", pwb, "base", object( "domobj", "domobj" ) )
      }
}

_________________
Image
Recommended: AutoHotkey_L
Basic Webpage Controls


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 21st, 2010, 7:27 am 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5480
Location: the tunnel(?=light)
I've already done a re-write of the original iWeb functions (adding a few of my own) for AHK_L if you want a reference point, but I admit jethrow's proposed naming convention is quite tempting.

I'll take a look at what it will take to implement the cross hairs into the main GUI, as I also like that option as opposed to holding down the control button (as that can have unusual consequences).

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 21st, 2010, 6:48 pm 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5480
Location: the tunnel(?=light)
Here's one potential problem I'm seeing in your naming convention, jethrow: how do you retain the pointer to operate on multiple items on a page? For example, initiating a page login:

Code:
web := iWeb()
web["Sign In"].domobj("idDiv_PWD_UsernameExample0Pwd").value := "<< some username >>" ; http://www.hotmail.com
web["Sign In"].domobj("i0118").set("<< some password >>")
web["Sign In"].click("idSIButton9")


You'd practically have to pass the pointer to a separate object anyway, no?

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 21st, 2010, 7:48 pm 
Offline
User avatar

Joined: May 24th, 2009, 5:35 am
Posts: 2099
Location: Iowa, USA
Quote:
... how do you retain the pointer to operate on multiple items on a page?
Good question - it illistrates what I meant by:
I wrote:
( as it may not be as Standard AHK User friendly )
You would simply save the object:
Code:
web := iWeb()
page := web["Google"]
page.domobj ...

Also, my example was only the tip of the iceburg, & is very subject to change. For instance, if we slightly modify the iWeb() function, we could do this:
Code:
web := iWeb( "Google" )
web.domobj ...

iWeb( window="" ) {
   win := object( "base", object( "__Get", "IEGet") )
   Return, window ? win[ window ] : win
}

_________________
Image
Recommended: AutoHotkey_L
Basic Webpage Controls


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 22nd, 2010, 5:31 pm 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5480
Location: the tunnel(?=light)
Here's one thing I'd like to see implemented, optional URL navigation built into iWeb_newIE() and iWeb_Model() (I also wrote a leaner and possibly meaner iWeb_complete() function to go along with it):

Code:
pwb :=   newIE("http://www.google.com")
; pwb :=   model(0,0,"http://www.google.com")
pwb.document.all["q"].value :=   "hello world!"
pwb :=   ""
return

newIE(url="") {
   navTrustedForActiveX :=   0x0400
   pweb :=   (pweb :=   COM_CreateObject("InternetExplorer.Application") ) ? (pweb,pweb.visible :=   True) : 0
   if url
      pweb.navigate[url,navTrustedForActiveX,"_self"]
   return   pweb
}

model(h=550,w=900,url="") {
   navTrustedForActiveX := 0x0400, h := !h ? 550 : h, w := !w ? 900 : w
   If !pwb :=   newIe(url)
      return   False
   pwb.menuBar := 0, pwb.AddressBar := 0, pwb.statusBar := 0, pwb.height :=   h, pwb.width :=   w
   WinSet,AlwaysOnTop,On,% "ahk_class " pwb.hwnd
   Return   pwb
}

complete(pwb) {   
   If  !pwb
      return   False
   Loop 100
      If (pwb.readyState = 4)
       && (pwb.document.readystate = "complete")
         Return   True
      Else   Sleep, 300
   Return   False
}


Another thing I'd like to see is a click function with more universal handling so all current possibilities (obj,text,href,value) can be called from one function rather than having four separate functions:

Code:
pwb :=   newIE("http://www.google.com")
complete(pwb)
pwb.document.all["q"].value :=   "hello world!"
; click(pwb,"btnG")
click(pwb,"Google Search","value")
pwb :=   ""
return

newIE(url="") {
   navTrustedForActiveX :=   0x0400
   pweb :=   (pweb :=   COM_CreateObject("InternetExplorer.Application") ) ? (pweb,pweb.visible :=   True) : 0
   if url
      pweb.navigate[url,navTrustedForActiveX,"_self"]
   return   pweb
}

complete(pwb) {   
   If  !pwb
      return   False
   Loop 100
      If (pwb.readyState = 4)
       && (pwb.document.readystate = "complete")
         Return   True
      Else   Sleep, 300
   Return   False
}

click(pwb,obj,type="",frm="") {   ; 'type' supports "innerText", "href" and "value"
   if !pWin :=   domWin(pwb,frm)
      return   False
   if !type
      return   pWin.document.all[obj].click
   Loop %   (type="value") ? pWin.document.all.length
    : pWin.document.links.length {
      COM_Error(0)
      itm :=   (type="value") ? pWin.document.all.item[A_Index-1]
       : pWin.document.links.item[A_Index-1]
      if (type = "value") {
         if (inpt(itm) ? InStr(itm.value,obj) : 0) {
            itm.click(), COM_Error(1)
            return   True
         }
      }
      else if InStr(itm[type],obj) {
         itm.click(), COM_Error(1)
         return   True
      }
   }
   COM_Error(1)
   return   False
}

domWin(pdsp,frm="") {
   qsid :=   "{332C4427-26CB-11D0-B483-00C04FD90119}"
   If !pWin :=   COM_QueryService(pdsp, qsid, qsid)
      return   False
   If frm {
      Loop, Parse, frm, `,
      {
         frame:=pWin.document.all.item[A_LoopField].contentwindow
         pWin:=COM_QueryService(frame, qsid, qsid)
         If !pWin
            Return   False
      }
   }
   Return   COM_Enwrap(pWin)
}

inpt(i) {
   return InStr("BUTTON,INPUT,OPTION,SELECT,TEXTAREA",i.tagName) ? True : False
}

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 22nd, 2010, 11:16 pm 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5480
Location: the tunnel(?=light)
I also think AHK_L will give us an easier way to solve the problem with firing JS events from a page element. AHK_L seems to allow passing the proper object to the function in a way the vanilla does not (or at least not well), and since there are too many JS events to keep track of we can just parse them from the outerHTML of the element so we only fire what's there:

Code:
fireEvent(ele) {
   Pos :=   1, h :=   "\bon\w+\b(?==)"
   While Pos := RegExMatch(ele.outerHTML,h,m,Pos+StrLen(m))
      ele.fireEvent[m]
   return
}

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 23rd, 2010, 12:40 am 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
sinkfaze wrote:
I also think AHK_L will give us an easier way to solve the problem with firing JS events from a page element.
this is not true both allow the passage of a element pointer and i have never had issue with explicitly doing so in the past tho the current library has a flaw in it

_________________
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: March 23rd, 2010, 1:24 am 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
sinkfaze wrote:
I've already done a re-write of the original iWeb functions (adding a few of my own) for AHK_L if you want a reference point, but I admit jethrow's proposed naming convention is quite tempting.

I'll take a look at what it will take to implement the cross hairs into the main GUI, as I also like that option as opposed to holding down the control button (as that can have unusual consequences).
Nice head start in the end i think i'll stick this format out a bit but am finding many edits to makeI will be doing quite alot of testing with it this week before reposting it

_________________
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: June 7th, 2010, 6:49 pm 
Offline
User avatar

Joined: May 24th, 2009, 5:35 am
Posts: 2099
Location: Iowa, USA
I rewrote my Compact iWebBrowser2 Learner script for AHKL. Here's the link if you want to check it out. The primary changes:
  • Removed ~LButton Hotkey. Now tests if the A_GuiEvent = "Normal"
  • Grouped similar variables into an arrays
  • Made the Outline an object
  • Used FileInstall to embed Cross-Hair images in .exe
  • Clicking a frame.# item in the ListView will copy the Frame URL

_________________
Image
Recommended: AutoHotkey_L
Basic Webpage Controls


Last edited by jethrow on June 11th, 2010, 4:57 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 7th, 2010, 7:47 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
jethrow wrote:
I rewrote my Compact iWebBrowser2 Learner script
sinkfaze wrote:
I've already done a re-write of the original iWeb functions (adding a few of my own) for AHK_L.
posted on the first page now god i cant wait to get time to jump back into this i have so many ideas

_________________
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: June 16th, 2010, 6:00 pm 
Offline

Joined: January 21st, 2009, 1:06 pm
Posts: 63
Im hoping someone can help me, Im trying to use this to login to a webpage but the page doesnt think Ive typed anyting into the username and password fields. If you look at the url after the login button is pressed indicates that the username was null ...

Code:
#Include iWeb.ahk
#Include COM.ahk

username = strictlyfocused
pass = strictlyfocused   ;not my real un and pw ;)
iWeb_Init()
MyKeynote:=iWeb_Model()
iWeb_nav(MyKeynote,"http://my.keynote.com/newmykeynote/logon.aspx")
iWeb_setDomObj(MyKeynote,"un,pw",username "," pass)
iWeb_clickValue(MyKeynote,"Log In")
iWeb_Release(MyKeynote)
iWeb_Term()


Last edited by strictlyfocused02 on June 16th, 2010, 6:07 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 20th, 2010, 10:45 pm 
Offline

Joined: August 21st, 2006, 7:07 pm
Posts: 2925
Location: The Shell
OMG where have you been all my life!

@tank, took a year but finally I find the goldmine :D.

TnxU and jethrow + any other contributors for this!

_________________
Imageparadigm.shift:=(•_•)┌П┐RTFM||^.*∞


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 20th, 2010, 11:12 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
wow thanks goes to sean
jethrow and sinkfaze have done different but i think very equal shares of this in truth I am just the brain child and did what is now only a small portion of it

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


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 226 posts ]  Go to page Previous  1 ... 9, 10, 11, 12, 13, 14, 15, 16  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], Google Feedfetcher, Kirtman, Rseding91 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