AutoHotkey Community

It is currently May 27th, 2012, 12:40 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 29 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: February 11th, 2010, 10:08 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
Code:
F11::iWeb_execScript(pDoc,"javascript:alert('hello');")
take the red out which is only used when injecting in an address bar

_________________
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: February 11th, 2010, 10:28 pm 
Offline

Joined: September 2nd, 2008, 4:20 pm
Posts: 50
Crap still nothing. This is the script now in its entirety. I feel like I'm really letting you guys down or something, cuz I have the feeling its something pretty obvious. I commented out the Includes and AHK barfed on the reload which is to be expected, so com and iweb are being called correctly....

Code:
SetTitleMatchMode 2
#SingleInstance Force
#Persistent
#Include com.ahk
#Include iweb.ahk

F11::iWeb_execScript(pDoc,"alert('hello');")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 11th, 2010, 10:33 pm 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5482
Location: the tunnel(?=light)
How about this...the text of the link to the JS on the page you're trying to execute, is it unique? As in, do any other links have that same text?

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


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

Joined: September 2nd, 2008, 4:20 pm
Posts: 50
this is the exact code embedded in the URL:

Code:
javascript:runBreadCrumb('m_befa0cb60a0a3c1b0071369fef1373d6', 'incident','');


There is no other URL on the page like that one, the text on the page is unique.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 11th, 2010, 10:49 pm 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5482
Location: the tunnel(?=light)
I mean the text for the link, like that url is embedded in a link named 'Bread Crumb'. Does the link have unique text? If so, what is it?

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


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

Joined: September 2nd, 2008, 4:20 pm
Posts: 50
The text on the page within which the javascript is encoded is unique.

Parent = AAA######


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

Joined: March 19th, 2008, 12:43 am
Posts: 5482
Location: the tunnel(?=light)
Then does this work to click the element?

Code:
iWeb_clickDomObj(pwb,"Parent = AAA######")

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


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

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
iguru42 wrote:
This is the script now in its entirety.
so i have to ask
where are you assigning a value to pdoc?
where do you initialize com
of course it does nothing since your not

_________________
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: February 12th, 2010, 1:22 am 
Offline

Joined: October 15th, 2007, 3:10 pm
Posts: 790
Location: England
iguru42 wrote:
Crap still nothing. This is the script now in its entirety. I feel like I'm really letting you guys down or something, cuz I have the feeling its something pretty obvious. I commented out the Includes and AHK barfed on the reload which is to be expected, so com and iweb are being called correctly....

Code:
SetTitleMatchMode 2
#SingleInstance Force
#Persistent
#Include com.ahk
#Include iweb.ahk

F11::iWeb_execScript(pDoc,"alert('hello');")


OK, this will not work because you removed the code that actually does anything. All the other stuff that was posted needs to go with the above or it will not do anything useful for you.

Try running the below code without editing it, and tell us which messages you get. Don't bother posting the 'last executed lines', it would be more useful to post the variable list, if anything at all! :)

We can help you here with a little debugging, but don't go removing big chunks of the code and expect it to work :lol:

Code:
SetTitleMatchMode 2
#SingleInstance Force
#Persistent
#Include com.ahk
#Include iweb.ahk

F11::
jMatch:="i)^javascript:runBreadCrumb\('m_(\w+)', 'incident',''\);"

iWeb_Init() ; starts COM
ControlGet,hWnd,Hwnd,,Internet Explorer_Server1, ahk_class IEFrame ; gets the window handle for the document interface in Internet Explorer

If ( !hWnd )
{
   MsgBox, hWnd is empty.  Is Internet Explorer open?  If not, open it now and then press OK.
   Reload
   Sleep, 1000
   MsgBox, 4,, The script could not be reloaded (1).
   ExitApp
}

pDoc:=IE_GetDocument(hWnd) ; creates an pointer to access the page document

If ( !pDoc )
{
   MsgBox, pDoc is empty.  Is Internet Explorer open?  If not, open it now and then press OK.
   Reload
   Sleep, 1000
   MsgBox, 4,, The script could not be reloaded (2).
   ExitApp
}

MatchFound := false

Loop % iWeb_getTagLen(pDoc,"A") { ; loops through all of the link elements on the page
  if RegExMatch(iWeb_getTagObj(pDoc,"A",A_Index-1,-1,-1,"href"),jMatch,m)
  { ; checks to see if the href of the element matches our regular expression search
    iWeb_execScript(pDoc,"alert('hello');');") ; will execute the javascript with the saved pattern, again adjust any redacted information as needed
    MatchFound := true
    break
  }
}

iWeb_Release(pDoc) ; releases the pointer to the page document
iWeb_Term() ; stops COM

If ( !MatchFound )
{
   MsgBox, No match for "javascript:runBreadCrumb(m_" found on the Internet Explorer page you have open.  Do you have the right page open?  If not, load the correct web page and press OK.
   Reload
   Sleep, 1000
   MsgBox, 4,, The script could not be reloaded (3).
   ExitApp
}

iWeb_getTagLen(pdsp,tag,t="-1",r="-1",frm="") {

   If pWin:=iWeb_DomWin(pdsp,frm) ; doesn't this cover the frames already?
      result:=COM_Invoke(pWin,"document.all.tags[" tag "]"
       . ((tag="table" && t>=0) ? ".item[" t "].rows" : "") ((tag="table" && r>=0) ? "[" r "].cells" : "")
       . ".length")
   COM_Release(pWin)
   return result

}

iWeb_getTagObj(pdsp,tag,itm,r="-1",c="-1",type="innerText",frm="") {

   If pWin:=iWeb_DomWin(pdsp,frm)
      result:=COM_Invoke(pWin,"document.all.tags[" tag "].item[" itm "]"
       . ((tag="table" && r>=0) ? ".rows[" r "]" : "") ((tag="table" && c>=0) ? ".cells[" c "]" : "")
       . "." type)
   COM_Release(pWin)
   return result

}

IE_GetDocument(hWnd)
{
   Static
   If Not   pfn
      pfn := DllCall("GetProcAddress", "Uint", DllCall("LoadLibrary", "str", "oleacc.dll"), "str", "ObjectFromLresult")
   ,   msg := DllCall("RegisterWindowMessage", "str", "WM_HTML_GETOBJECT")
   ,   COM_GUID4String(iid, "{00020400-0000-0000-C000-000000000046}")
   If   DllCall("SendMessageTimeout", "Uint", hWnd, "Uint", msg, "Uint", 0, "Uint", 0, "Uint", 2, "Uint", 1000, "UintP", lr:=0) && DllCall(pfn, "Uint", lr, "Uint", &iid, "Uint", 0, "UintP", pdoc:=0)=0
   Return   pdoc
}
return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 12th, 2010, 1:57 am 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
OceanMachine wrote:
Code:
;;doesn't this cover the frames already?
Yes
i kinda like iWeb_getTagObj i know you probably added it to your copy of iweb but do you mind if i add your functions formaly to the library so long as you are credited. I have toyed with different versions of such a function for some time now i think i like your take on it better than my own :D out of sick :evil: curiosity why IE_GetDocument(hWnd) vs iweb_getwin what advantage does it hold in your uses

_________________
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: February 12th, 2010, 2:22 am 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5482
Location: the tunnel(?=light)
tank wrote:
i kinda like iWeb_getTagObj i know you probably added it to your copy of iweb but do you mind if i add your functions formaly to the library so long as you are credited.


That would be swell if I hadn't written them already :shock: . In fact you weren't overly fond of them when I originally proposed them for the iWeb functions so I'm quite pleased to see you've come around! :lol: :wink:

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 12th, 2010, 2:30 am 
Offline

Joined: September 2nd, 2008, 4:20 pm
Posts: 50
OceanMachine wrote:
iguru42 wrote:
Crap still nothing. This is the script now in its entirety. I feel like I'm really letting you guys down or something, cuz I have the feeling its something pretty obvious. I commented out the Includes and AHK barfed on the reload which is to be expected, so com and iweb are being called correctly....

Code:
SetTitleMatchMode 2
#SingleInstance Force
#Persistent
#Include com.ahk
#Include iweb.ahk

F11::iWeb_execScript(pDoc,"alert('hello');")
We can help you here with a little debugging, but don't go removing big chunks of the code and expect it to work :lol:

I'll test out what you suggested tomorrow when I get back to work.


I was just trying to eliminate variables, reduce it to it's most minimal state so I could get an idea of where the problem is.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 12th, 2010, 1:56 pm 
Offline

Joined: September 2nd, 2008, 4:20 pm
Posts: 50
Quote:
Try running the below code without editing it, and tell us which messages you get. Don't bother posting the 'last executed lines', it would be more useful to post the variable list, if anything at all! :)


K ran your code and got this pop up msg:

No match for "javascript:runBreadCrumb(m_" found on the Internet Explorere Page you have open. Do you have the right page open? If not, load the correct web page and press OK.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 12th, 2010, 2:07 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
sinkfaze wrote:
tank wrote:
i kinda like iWeb_getTagObj i know you probably added it to your copy of iweb but do you mind if i add your functions formaly to the library so long as you are credited.


That would be swell if I hadn't written them already :shock: . In fact you weren't overly fond of them when I originally proposed them for the iWeb functions so I'm quite pleased to see you've come around! :lol: :wink:
:arrow: smokes crack backing away from the dope now. I stand by my objections but hindsite is after all 20/20 :shock: I see now that they do have a more universal usefullness. so those will indeed become part of the library. I owe you a sincere apology

_________________
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  [ 29 posts ]  Go to page Previous  1, 2

All times are UTC [ DST ]


Who is online

Users browsing this forum: chaosad, jrav, Yahoo [Bot] and 20 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