AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[Project Development]IE Web Recorder Developers Needed
Goto page Previous  1, 2, 3 ... 12, 13, 14, 15, 16  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
frescot



Joined: 12 Jun 2010
Posts: 21

PostPosted: Thu Jul 08, 2010 2:47 am    Post subject: Bug report Reply with quote

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)
Back to top
View user's profile Send private message
tank



Joined: 21 Dec 2007
Posts: 3700
Location: Louisville KY USA

PostPosted: Thu Jul 08, 2010 9:49 am    Post subject: Re: [Project Development]IE Web Recorder Developers Needed Reply with quote

first freakin page wrote:
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
_________________

We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
Back to top
View user's profile Send private message
frescot



Joined: 12 Jun 2010
Posts: 21

PostPosted: Thu Jul 08, 2010 1:23 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
tank



Joined: 21 Dec 2007
Posts: 3700
Location: Louisville KY USA

PostPosted: Thu Jul 08, 2010 1:37 pm    Post subject: Reply with quote

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
_________________

We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
Back to top
View user's profile Send private message
sinkfaze



Joined: 18 Mar 2008
Posts: 5044
Location: the tunnel(?=light)

PostPosted: Thu Jul 08, 2010 1:42 pm    Post subject: Reply with quote

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.
_________________
Try Quick Search for Autohotkey or see the tutorial for newbies.
Back to top
View user's profile Send private message Send e-mail
frescot



Joined: 12 Jun 2010
Posts: 21

PostPosted: Thu Jul 08, 2010 2:34 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Visioneer



Joined: 19 Nov 2007
Posts: 144

PostPosted: Thu Nov 11, 2010 11:20 am    Post subject: Cross site access to iframes content/contentWindow objects Reply with quote

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
Back to top
View user's profile Send private message
tank



Joined: 21 Dec 2007
Posts: 3700
Location: Louisville KY USA

PostPosted: Thu Nov 11, 2010 3:29 pm    Post subject: Reply with quote

this is not a help thread
_________________

We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
Back to top
View user's profile Send private message
Visioneer



Joined: 19 Nov 2007
Posts: 144

PostPosted: Thu Nov 11, 2010 4:23 pm    Post subject: Sean, help me. Reply with quote

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
Back to top
View user's profile Send private message
tank



Joined: 21 Dec 2007
Posts: 3700
Location: Louisville KY USA

PostPosted: Thu Nov 11, 2010 4:27 pm    Post subject: Reply with quote

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
_________________

We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
Back to top
View user's profile Send private message
Visioneer



Joined: 19 Nov 2007
Posts: 144

PostPosted: Thu Nov 11, 2010 9:50 pm    Post subject: Reply with quote

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/viewtopic.php?p=398972#398972

Thanks
Back to top
View user's profile Send private message
Sean



Joined: 12 Feb 2007
Posts: 2462

PostPosted: Fri Nov 12, 2010 11:11 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Mickers



Joined: 11 Oct 2010
Posts: 1185
Location: Right behind you

PostPosted: Tue Nov 23, 2010 8:17 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
cherno n-l-i
Guest





PostPosted: Thu Jan 20, 2011 10:34 am    Post subject: Reply with quote

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
Back to top
sinkfaze



Joined: 18 Mar 2008
Posts: 5044
Location: the tunnel(?=light)

PostPosted: Tue Feb 08, 2011 4:19 pm    Post subject: Reply with quote

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.
_________________
Try Quick Search for Autohotkey or see the tutorial for newbies.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3 ... 12, 13, 14, 15, 16  Next
Page 13 of 16

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group