AutoHotkey Community

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

All times are UTC [ DST ]




Post new topic Reply to topic  [ 226 posts ]  Go to page Previous  1 ... 10, 11, 12, 13, 14, 15, 16  Next
Author Message
 Post subject: Bug report
PostPosted: July 8th, 2010, 3:47 am 
Offline

Joined: June 12th, 2010, 4:15 pm
Posts: 21
I've noticed that iWeb_Complete (at least where it is called from within iWeb_Nav) throws a "readyState" error when navigating to a local file (e.g. c:\test.htm)


Report this post
Top
 Profile  
Reply with quote  
PostPosted: July 8th, 2010, 10:49 am 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
tank wrote:
What should you not post in this thread?
  • Questions about how to use the recorder?
  • Bugs without proposed fix
  • Questions about syntax
if you wont read i wont care

_________________
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 8th, 2010, 2:23 pm 
Offline

Joined: June 12th, 2010, 4:15 pm
Posts: 21
Ah. My mistake. Sorry.

My proposed fix (or at least what I did to remedy the problem) was to create a separate nav function without the iWeb_complete function call. It worked, but has obvious drawbacks.

In the alternative, perhaps the nav function could use a conditional statement to determine whether the address is on the internet or on the disk, (i.e. if the string contains :// via regex, then call iWeb_complete, otherwise don't). That's kind of a "band-aid" solution as well though.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 8th, 2010, 2:37 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
so like by default it does iweb_complete and if the optional parameter is set then it doesnt?
I think that can be done easy enuff but perhaps its better to detect file protocol and find some other method if detecting finished
perhaps iebbrowser2.browser busy property

_________________
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 8th, 2010, 2:42 pm 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5480
Location: the tunnel(?=light)
Maybe I'm off here, but doesn't navigating to a local file kind of go against the intent of what the functions are designed to accomplish? I hate to be a stickler but I would really like to see a significant need for this from other users before tank or anybody else tries to re-reinvent the wheel.

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 8th, 2010, 3:34 pm 
Offline

Joined: June 12th, 2010, 4:15 pm
Posts: 21
sinkfaze wrote:
Maybe I'm off here, but doesn't navigating to a local file kind of go against the intent of what the functions are designed to accomplish? I hate to be a stickler but I would really like to see a significant need for this from other users before tank or anybody else tries to re-reinvent the wheel.


That's probably a good point. I'd be surprised to hear that others have run into this problem, and the quick fix is obvious enough: just call

Code:
COM_Invoke(pwb,   "Navigate",   url,   0x0400,   "_self")


instead of iWeb_nav.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: November 11th, 2010, 12:20 pm 
Offline

Joined: November 19th, 2007, 4:59 pm
Posts: 144
Thanks Sean,

I need to add cross site iframe content reading to my app for several
reasons, including local usages. I see glimmers of hope but nothing actual.
I can't even find "IE7com.ahk" anywhere.

Hopefully I could do it using "com.ahk", W98+, IE6+ and AHK basic.

Any guidance will be very much appreciated.

Also FYI, sometimes I can read some page's text content using this js
function with W98 IE6, but not with XP IE8. I would like to get access to
the contentWindow object anyway, but this shows that things that are
possible are sometimes simply prevented by the browser being used, so
may well be possible using another direct route, such as hopefully "com".

Code:
function getUrl(url)
{
if (window.XMLHttpRequest) var http = new XMLHttpRequest();
else var http = new ActiveXObject("microsoft.xmlhttp");
http.open("GET",url,false);
http.send();
return http.responseText;
}


Thanks


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 11th, 2010, 4:29 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
this is not a help thread

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Sean, help me.
PostPosted: November 11th, 2010, 5:23 pm 
Offline

Joined: November 19th, 2007, 4:59 pm
Posts: 144
Sean, help me.

Sorry, Sean had told me to post this in this thread.
I'm sure he must have had his reasons. Maybe he is
following it.

Thanks


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

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
he may have directed you to this thread but not to ask for help
the answer to your question getting access to frames is found here but I am not going to assist you with q n a within this thread

_________________
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, 2010, 10:50 pm 
Offline

Joined: November 19th, 2007, 4:59 pm
Posts: 144
Thanks Tank,

Can you PM me or should I start a new thread that you could respond to?

Here is a new thread for it.
http://www.autohotkey.com/forum/viewtop ... 972#398972

Thanks


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

Joined: February 12th, 2007, 7:54 am
Posts: 2462
Visioneer wrote:
Sorry, Sean had told me to post this in this thread.
I was expecting you to post your own attempts so far, so that tank and other members could take a look and help improve the codes.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 23rd, 2010, 9:17 pm 
Offline

Joined: October 11th, 2010, 6:15 pm
Posts: 1210
Location: Right behind you
Quote:
sinkfaze wrote:
I've already done a re-write of the original iWeb functions (adding a few of my own) for AHK_L.

I downloaded the script and installed to my ".../Autohotkey/Lib" file. I tried calling a function [iWeb_complete(pwb)] error message states it is an invalid function. Also tried #include iWeb_L.ahk and got error message that it cannot be opened.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 20th, 2011, 11:34 am 
Any idea why iWeb doesn't function when your browser process, iexplore.exe, is not a child process of explorer.exe?

ex: when you have an IE window launched at windows startup; becomes a child process of winlogon.exe


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 8th, 2011, 5:19 pm 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5480
Location: the tunnel(?=light)
I've decided to experiment to some extent with jethrow's idea for advancing the iWeb functions further using AHK_L. I've been using jethrow's string library as a model to work from, but the obvious drawback to this method is the inability to utilize a persistent pointer (as the base will only accept non-objects via this method). Nonetheless, building getWin() into the other functions to acquire the pointer each time doesn't appear to present any problems, and you can save the page name to a variable which will make it appear as if it is an object. This, for example, works in my most recent code tests:

Code:
pwb := "Google"
pwb.setDomObj("q","Hello world!")


But since, as another example, there are several methods to click a page element, I think it would be more beneficial to develop a click object to access the different methods rather than define each method explicitly. Instead of this:

Code:
pwb.clickDomObj
pwb.clickText
pwb.clickHref
. . .


We could have this:

Code:
pwb.click.domObj
pwb.click.Text
pwb.click.Href
. . .


This would have the benefit of a more "natural" syntax for users to work with and also the added benefit of getting users more involved in the dotted-path syntax, which seems to scare so many when the iWeb functions won't work for what they need and they have to go "manual". But I've been having trouble figuring out how to build in this base functionality to create the desired effect, so if tank or jethrow or anyone else interested would be willing to have a look at what I have so far to see how we could make this work, it would be greatly appreciated:

Code:
iWeb_Funcs()
{
   "".base.nav :=   "nav"
   "".base.complete :=   "complete"
   "".base.getdomObj :=   "getDomObj"
   "".base.setdomObj :=   "setDomObj"
   "".base.clickdomObj :=   "clickDomObj"
   "".base.clicktext :=   "clickText"
   "".base.clickHref :=   "clickHref"
   "".base.clickvalue :=   "clickValue"
   return   True
}


getWin(Name="")
{
   IfEqual, Name, , WinGetTitle, Name, ahk_class IEFrame   ; Get active window if no parameter
   Name :=   RegExReplace(Name," - (?:Windows|Microsoft) Internet Explorer")
   COM_Error(0)
   For win in ComObjCreate("Shell.Application").Windows
      If   (InStr(win.LocationName,Name) && InStr(win.FullName,"iexplore.exe"))
         pwb :=   win
   Until   (InStr(win.LocationName,Name) && InStr(win.FullName,"iexplore.exe"))
   COM_Error(1)
   Return   pwb ? pwb : False
}

nav(in,url)
{
   if   !pwb :=   getWin(in)
      return   False
   navTrustedForActiveX   =   0x0400
   pwb.navigate[url,navTrustedForActiveX,"_self"], pwb := ""
   complete(in)
   Return True
}

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

complete(in)
{   
   if   !pwb :=   getWin(in)
      return   False
   COM_Error(0)
   While   (pwb.busy && pwb.readyState <> 4 && pwb.document.readystate <> "complete")
      Sleep,50
   COM_Error(1)
   Return   True
}

getDomObj(in,obj,frm="")
{
   if   !pdsp :=   getWin(in)
         return   False
   if   !pWin :=   frm ? domWin(pdsp,frm) : pdsp
         return   False
   if   !InStr(obj,",") {
      if   itm :=   pWin.document.all.item[obj] {
         res :=   inpt(itm) ? itm.value : itm.innerHTML
         StringReplace, res, res,`,, ,, All
         itm :=   ""
      }
      return   res
   }
   Loop,Parse,obj,`,
   {
      If   itm :=   pWin.document.all.item[A_LoopField] {
         d :=   iWeb_inpt(itm) ? itm.value : itm.innerHTML
         StringReplace, d, d,`,, ,, All
         res .=   (!res ? "" : ",") d
      }
   }
   Return   res
}

setDomObj(in,obj,t,frm="")
{
   if   !pdsp :=   getWin(in)
      return   False
   if   !pWin :=   frm ? domWin(pdsp,frm) : pdsp
      return   False
   if   !InStr(obj,",")
   {
      if   itm :=   pWin.document.all[obj]
      {
         StringReplace, t, t, ,,`,, All
         itm[inpt(itm) ? "value" : "innerHTML"] :=   t, fireEvents(itm)
      }
      Return   True
   }
   StringSplit, text, t, `,
   job :=   Object()
   Loop, parse, obj, `,
      job.Insert(A_LoopField,text%A_Index%)
   For object, text in job
   {
      If   itm :=   pWin.document.all[object]
      {
         StringReplace, textOut, text, ,,`,, All
         itm[inpt(itm) ? "value" : "innerHTML"] :=   textOut, fireEvents(itm)
      }
   }
   Return   True
}

clickDomObj(in,obj,frm="")
{
   if   !pdsp :=   getWin(in)
      return   False
   if   !pWin :=   frm ? domWin(pdsp,frm) : pdsp
      return   False
   pWin.document.all[obj].click(), fireEvents(pWin.document.all[obj])
   Return   True
}

clickText(in,t,frm="")
{
   if   !pdsp :=   getWin(in)
      return   False
   if !pWin :=   frm ? domWin(pdsp,frm) : pdsp
      return   False
   links :=   pWin.document.links
   Loop %   links.length
      If InStr(links.item[A_Index-1].innertext,t) {
         links.item[A_Index-1].click(), fireEvents(links.item[A_Index-1])
         Break
      }
   Return   True
}

clickHref(in,t,frm="")
{
   if   !pdsp :=   getWin(in)
      return   False
   if !pWin :=   frm ? domWin(pdsp,frm) : pdsp
      return   False
   links :=   pWin.document.links
   Loop %   links.length
      If InStr(links.item[A_Index-1].href,t) {
         links.item[A_Index-1].click(), fireEvents(links.item[A_Index-1])
         Break
      }
   Return   True
}

clickValue(in,value,frm="")
{
   if   !pdsp :=   getWin(in)
      return   False
   if !pWin :=   frm ? domWin(pdsp,frm) : pdsp
      return   False
   all :=   pWin.document.all
   Loop %   all.length
      If (inpt(all.item[A_Index-1]) && InStr(all.item[A_Index-1].value,value)) {
         all.item[A_Index-1].click(), fireEvents(all.item[A_Index-1])
         Break
      }   
   Return   True
}

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

inpt(i)
{
   type :=   i.TagName
   if   type in BUTTON,INPUT,OPTION,SELECT,TEXTAREA
      Return   True
}


And as always any comments or suggestions about the above code, even though it is a prototype, is welcomed.

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


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 ... 10, 11, 12, 13, 14, 15, 16  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: xXDarknessXx and 15 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