Posts: 19
Threads: 6
Joined: May 2015
Hello:
I have load https://m.facebook.com and cannot figure out how to auto load page when reaching end of the scroll.
You can see the red line circle text,which is in chinese ,have the same meaning as loading more contents in english.
I have created this :
int w=wait(3 WV win(" - Mozilla Firefox" "Mozilla*WindowClass" "" 0x4))
Acc a1.Find(w "LINK" "查看更多動態" "" 0x3011 3)
a1.Mouse(1)
and it can move the mouse over the loading more button ,but cannot figure out how to make it autoclick the button
whenever the page reach the end,when loading more content button have just been showing in the end of the brower as the attachment shown.
Thanks in advance.
Posts: 12,073
Threads: 140
Joined: Dec 2002
Macro Macro2630
int w=win("Mozilla Firefox" "MozillaWindowClass")
rep ;;repeat for each new "Show More" link
,Acc a.FindFF(w "A" "Show More" "" 0x1001 1)
,err
,,out "no ''Show More'' link"
,,break
,;wait while the link is offscreen, then click it
,rep
,,int isOffscreen=a.State&STATE_SYSTEM_OFFSCREEN; err break
,,if(isOffscreen) 0.1
,,else
,,,a.DoDefaultAction; err
,,,break
Posts: 19
Threads: 6
Joined: May 2015
I am sorry,do not have good results!
int w=win("News Feed - Mozilla Firefox" "Mozilla*WindowClass" "" 0x4)
rep ;;repeat for each new "See More Stories" link
,Acc a.FindFF(w "A" "See More Stories" "" 0x3011 3)
,err
,,out "no ''See More Stories'' link"
,,break
,;wait while the link is offscreen, then click it
,rep
,,if(a.State&STATE_SYSTEM_OFFSCREEN) 0.1; continue
,,a.DoDefaultAction; err
,,break
no "See More Stories" link
shown in log panel!
Thanks you for your help greatly!!
When I look the show code element ,there is no the text See More Stories shown,may it be a ajex or javascript ?
Posts: 12,073
Threads: 140
Joined: Dec 2002
Cannot drag-capture the "See More Stories" link with the "Find accessible object" dialog?
Posts: 19
Threads: 6
Joined: May 2015
When find accessible object,it has been captured like the attachment shown.
And I can click it with qm automatically each time using keyboard trigger as in my first post code!
Posts: 12,073
Threads: 140
Joined: Dec 2002
Maybe we test the macro differently. To test my macro:
1. Open a page that has a "Show More" link below the visible part of Firefox.
2. Go to QM and run the macro.
3. Go to Firefox again and scroll to the bottom, to make the link visible.
4. The macro clicks the link. Scroll again to make it visible again. Repeat until there is no link.
Posts: 19
Threads: 6
Joined: May 2015
I tested the macro like your description.
Have you succeed and autoload it succesfully?
Posts: 12,073
Threads: 140
Joined: Dec 2002
Yes, succeeds. The page was with "Show More" link, for example https://m.facebook.com/barackobama
To find where the macro does not work as expected, insert out 1, out 2 and so on between lines. Or run the macro in debug-step mode.
Posts: 19
Threads: 6
Joined: May 2015
Thanks you for your help !
I have tested the link given and it can click it successfully!
https://m.facebook.com/barackobama?v=ti ... 4&refid=17
Posts: 19
Threads: 6
Joined: May 2015
I tried out this ,using * in between and successfully autoload page:
int w=win("Mozilla Firefox" "MozillaWindowClass")
rep ;;repeat for each new "Show More" link
Acc a.FindFF(w "A" "*多動*" "" 0x1001 3)
err
out "no ''*多動態'' link"
break
wait while the link is offscreen, then click it
rep
if(a.State&STATE_SYSTEM_OFFSCREEN) 0.1; continue
a.DoDefaultAction; err
break
Thanks you for your help !
Posts: 19
Threads: 6
Joined: May 2015
I have to use keyboard shortcut to trigger them,
Is there a way to auto trigger them whenever the text appear in web pages?
I have three macros for m.facebook ,one is show more (the same as the previous posts macro),one is show older comments,(the same as the first macro,only matching text have changed) the last one is show next comment,as shown in attachments.
The above macros work very good ,but only when using keyboard to trigger them ,each time is tedious.
I tried to figure out how to to auto trigger them whenever the text ( show more;show older comments;show next comments)appear in web pages?
I tried to use the window trigger ,created and active,created and visible,active,visible,and set them from the multi-trigger,
I also use the accessible trigger as a multi-trigger,therefore totally there 5 trigger of each of them.
In the option of set as when a macro is running ,end it and run,so that it will trigger them when the page have alternating between three of the macros,it will run one of them.
As I know the software cannot run mult macro the same time ?
Maybe I do not know how to run them simultaneouly only!
But testing all the combinations are not work,so could you suggest me what to do to achieve this?
Thanks in advance!
Posts: 12,073
Threads: 140
Joined: Dec 2002
If possible, use trigger "window name changed".
Else use this function to run macros when Firefox page URL changes:
Function Firefox_address_triggers
Trigger !cv"* - Mozilla Firefox" "MozillaWindowClass" "" "" "" 0x2
;\
int w=TriggerWindow
Acc a
str s sPrev
rep
,0.5
,if(!IsWindow(w)) ret
,if !a.a
,,a.Find(w "DOCUMENT" "" "" 0x3000 1); err continue
,s=a.Value; err
,if(_hresult) a.a=0; continue
,if(s=sPrev) continue
,sub.UrlChanged w s sPrev
,sPrev=s
#sub UrlChanged
function w str&url str&previousUrl
;Edit this sub-function. Add/remove case for URLs you need.
;You can edit it while this function is running. Click Compile to apply changes.
out url
sel url 3
,case "https://m.facebook.com/*"
,mac "facebook macro" "" w url previousUrl
,;;the macro should begin: function [hwnd] [$url] [$previousUrl]
,
,;case ["url2","url3"]
,;mac "macro2"
,
,;...
;err+ out _error.description
This function itself has trigger "Firefox window created and is visible". It runs until the window closed.
Posts: 19
Threads: 6
Joined: May 2015
Thanks you very much!I will tried it out later,thanks!!
|