Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to make a macro end on address bar change
#2
Yes it's possible to have the macro end when address bar changes
There are several ways
this is using an Accessible Object trigger
insert this line of code in main macro
Code:
Copy      Help
dis- "ChromeAddressBarChange"


Function ChromeAddressBarChange
Trigger $a 142 -4 "" "Chrome_WidgetWin_1" "" "" "" "" 42 0x100000 "Address and search bar"     Help - how to add the trigger to the macro
Code:
Copy      Help
;\
function hwnd idObject idChild
Acc a.FromEvent(hwnd idObject idChild)
out a.Value
bee
shutdown -6 0 "Macro name goes here"
dis+ "ChromeAddressBarChange"

this is using a function that repeatedly checks for the change in the  address bar
this should run in its own thread 
insert this line in main macro
Code:
Copy      Help
mac "WaitForAddressBarChange"
 

Function WaitForAddressBarChange
Code:
Copy      Help
int w=win("- Google Chrome" "Chrome_WidgetWin_1")
Acc a.Find(w "TEXT" "Address and search bar" "class=Chrome_WidgetWin_1" 0x35)
str originalValue=a.Value
spe -2
rep
,a.Find(w "TEXT" "Address and search bar" "class=Chrome_WidgetWin_1" 0x35)
,str newValue=a.Value
,if newValue!=originalValue
,,break
,0.3
bee
shutdown -6 0 "Macro name goes here"

there are other ways depends on code in main macro.


Messages In This Thread
RE: How to make a macro end on address bar change - by Kevin - 05-17-2021, 10:18 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)