Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Menu selection from dynamic menu
#4
If using my previous code, would need to do action in menu item, not in macro. For example, replace out with name of your function that does something with the URL.

Here you get URL in same macro.
Macro menu of images in Firefox
Code:
Copy      Help
int w=wait(2 WV win("Mozilla Firefox" "Mozilla*WindowClass" "" 0x804))
Acc a1.Find(w "DOCUMENT" "" "" 0x3010 2)
str s
a1.WebPageProp(0 0 s) ;;get page HTML
;out s

type NAMEURL str'name str'url
ARRAY(NAMEURL) m ;;array for menu display names and URLs
int i
str sm
MenuPopup p

HtmlDoc d.InitFromText(s)
ARRAY(MSHTML.IHTMLElement) a
d.GetHtmlElements(a "img")
for i 0 a.len
,MSHTML.IHTMLElement e=a[i]
,s=e.getAttribute("src" 0); err continue
,;out s
,
,NAMEURL& r=m[] ;;add array element
,r.name.getfilename(s 1) ;;or try to get title or alt attribute
,r.url=s
,p.AddItems(r.name i+1) ;;add menu item

i=p.Show-1; if(i<0) ret ;;show menu

s=m[i].url
out s


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)