Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
need help Macro in firefox not running
#1
I would like to create a macro in the following way in firefox .


1. If 1line find the text "apple"
2. 1line text name Click
3. if next 2line text name"apple" 1line non click 2line Click
..
..
...
if not found
out "not found"

ex:
lpstr keyword = "apple"
int IEFrame = win("" "IEFrame")
Htm eSpan eParent
eParent=htm("BODY" "" "" IEFrame)
MSHTML.IHTMLElement2 e2=+eParent.el
foreach eSpan.el e2.getElementsByTagName("span")
,str s=eSpan.Text
,out s
,if find(s keyword 0 1)>=0
,,out "keyword found"
,,;eSpan.Click
,,eSpan.Mouse(1)
,,wait 0.5


Macro running in Internet explorer
but Firefox not running
Are there any way?
#2
Firefox does not have IHTMLElement2 etc. If want to find all <span>, use FFNode. However it does not have functions to get element position, therefore need to convert to Acc, which not always works.

Macro Macro2462
Code:
Copy      Help
out
int w=win("Mozilla Firefox" "MozillaWindowClass")
ARRAY(FFNode) a
FFNode n.FindFF(w "span" "" "" 0 0 0 &sub.Callback_Acc_FindFF &a)

;results
int i
for i 0 a.len
,out "------"
,;out a[i].HTML(0)
,;out a[i].HTML(1)
,n=a[i].node.firstChild ;;<span> -> text
,str text=n.Text
,out text
,Acc m.FromFFNode(n)
,m.Mouse(0)
,0.3



#sub Callback_Acc_FindFF
function# FFNode&x level ARRAY(FFNode)&a FFNODEINFO&ni

;Callback function for Acc.FindFF or FFNode.FindFF.

;x - current node.
;level - level of x in the tree. It will be 0 for the root node, 1 for its children, 2 for their children, and so on. By default, the root is the #document node of web content; its children are such nodes as DOCTYPE and HTML; HTML childeren are HEAD and BODY.
;cbParam - cbParam passed to FindFF. Can be declared as reference to any type.
;ni - node info, as retrieved from FFDOM.ISimpleDOMNode.get_nodeInfo(). To use the strings easier, assign them to str variables, because they are BSTR.

;Return:
;0 - stop. Let x will be the found node.
;1 - continue.
;2 - continue, but skip children of x.

a[]=x
ret 1
#3
Thank you so much.
I became a lot of help.


Forum Jump:


Users browsing this thread: 1 Guest(s)