I'm trying to create a macro to activate Hide My Email from any browser but having difficulty because some of the actions can't be activated from menus and I suspect that the macro will be fragile if I use cursor placement actions.
Any advice on how to create a macro that would do the following would be appreciated and help me learn how to use KM:
From any browser in Ventura:
Open System Settings from the Apple menu
Select Apple ID (if not already selected)
Select iCloud
Select Hide My Email
That's it.
Am I correct in assuming that "Move and Click" actions will be fragile if the windows are repositioned for any reason?
If you select the option to move and click relative to the window's top left corner then it will be pretty robust. Note, that there are many more options than "top left corner" to choose from.
Nice idea. I like your thinking. I agree with @tiffle that if you have the click option set t window's top left corner it will be robust. When you get it working, please do share.
I use this little macro. Might help you get started. Image is hard to see, so I added my screenshot at the bottom, which was taken from the Apple ID pref. screen.
Thanks to all for your help. This is what I finally came up with that seems to work. Note that Ventura OS changed the name of "System Preferences" to "System Settings".
I'm sure it's not the most efficient but it does seem to work. It was a good opportunity to learn about clicking on a relative position in a window. Thanks again.
I just found this thread and your macro works really nice, I made some "improvements" to it:
The type XX keystroke is my shortcut to switch to Desktop 1 so it works from fullscreen + multiscreen applications
I added a "move and click at image" so it automatically generates a new email address
It will then select the text field to label your email adress
After you put in your label you can just hit "enter"
It will then auto copy the email adress and close the window, the next window and quit system settings and briefly display "Address has been copied to clipboard" (the display time for the notification is quite short and I found no settings to adjust the time)
So it now takes care of the whole process – all you need to do is label the email address and hit enter one time.
Now it waits for buttons to be enabled instead of "pause for 3s" to reduce the incosistency of function when it takes longer to load than usual.
I made an "if then else" function with the "DARKMODE" calculation and created 2 paths for lightmode and darkmode so the image recognition functions independent of the system appearence (light/dark)
The meat is in the AppleScript, long-form so you can see how the nested UI elements are worked through:
AppleScript
tell application "System Events"
tell process "System Settings"
repeat until window 1 exists
delay 0.1
end repeat
tell window 1
repeat until name is "iCloud"
delay 0.1
end repeat
tell group 1
tell splitter group 1
tell group 2
tell group 1
tell scroll area 1
tell group 3
click button 4
end tell
end tell
end tell
end tell
end tell
end tell
repeat until sheet 1 exists
delay 0.1
end repeat
tell sheet 1
tell scroll area 1
tell UI element 1
tell group 1
tell group 1
tell group 3
repeat until button "Create new address" exists
delay 0.1
end repeat
click button "Create new address"
end tell
end tell
end tell
end tell
end tell
end tell
end tell
end tell
end tell
Thank you very kindly for this, @Nige_S. I always appreciate when people are willing to share their most precious resource - time - to help others.
The AppleScript works up to "repeat until button "Create new address". The Sequoia version of Settings does not include this selection. Rather, what occurs is that the Hide My Email window appears and only offers a "+" at the bottom-left corner to add a new address (unless I'm missing something here which is of course entirely possible - but the script fails at this point in any case).
So what is needed then is the ability to find and click that "+" if such a method exists in AppleScript (although I suspect the "Find Image on Screen" and "Click at Found Image" might work for this... I've never used those Actions before). Once that is clicked then the email creation window appears.
I have attached images of both from Sequoia for clarity.
Mine does -- perhaps because I've never used this function before.
You can either dig around trying to get AppleScript to work, or switch by to KM actions and use "Press a Button". The "scan" function, triggered by clicking the "Button" menu, picks up "Create new address" so should probably work for your option: