Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Automator / OSX 11.2.3 - execute set of operations on the URLs from the list

Hello, Community!


1st of all - I'm not an advanced programmer - just trying to use AppleScript to automate repeatable task.

I'm trying to create script / workflow, to browse on the list of URLs.

Idea is to execute short list of the same operations on every URL from the list, which I'm processing by "Get Specified Text" -> "Extract URLs fro m Text" and then I wanted to execute my actions in a loop.


Mostly - it's simple shortcut to make a screenshot of website, using keybind (to launch FireShot with predefined settings in Chrome), saving it as PDF (just "Save as PDF" button to be clicked) , closure of plugin dialog and closure of the page.


Sounds trivial - but because I'm not able to set properly focus on dedicated FireShot tab, using apple script - I'm not able to proceed.

I have recorded macro - and extracted the code but it is still not able to activate this tab and find a "Save as PDF button".


Path to element is strictly related to title - what could be part of the issue:


"click UI Element \"Save\" of sheet 1 of window \"FireShot Capture 095 - blahblah - BlahBlah - www.blabla.com - Google Chrome\" of application process \"Chrome\""


Even if recorded macro it works well - can I build a loop to execute recorded macro using URLs from my list as arguments ?


Any help would be priceless.

Posted on May 17, 2021 3:24 AM

Reply
Question marked as Best reply

Posted on May 17, 2021 3:06 PM

First and foremost, Automator has very poor looping abilities.


While you can get a list of URLs from various commands, executing a set of actions against each of the URLs in turn is a PITA (at least in my experience).


However, it sounds like you have the basics working, and that you're stuck on:


> Path to element is strictly related to title - what could be part of the issue:


> "click UI Element \"Save\" of sheet 1 of window \"FireShot Capture 095 - blahblah - BlahBlah - www.blabla.com - Google Chrome\" of application process \"Chrome\""


in 99% of cases, you can refer to any window in a number of ways - the default you're seeing here is by name, but you can also use relative references such as window ID (typically window 1 is the frontmost).


Therefore I'd start by trying:


Path to element is strictly related to title - what could be part of the issue:


"click UI Element \"Save\" of sheet 1 of window 1 of application process \"Chrome\""


this should just save the front window, then it becomes an issue of managing the front window more than anything else.


hth

Similar questions

2 replies
Question marked as Best reply

May 17, 2021 3:06 PM in response to Lunarro

First and foremost, Automator has very poor looping abilities.


While you can get a list of URLs from various commands, executing a set of actions against each of the URLs in turn is a PITA (at least in my experience).


However, it sounds like you have the basics working, and that you're stuck on:


> Path to element is strictly related to title - what could be part of the issue:


> "click UI Element \"Save\" of sheet 1 of window \"FireShot Capture 095 - blahblah - BlahBlah - www.blabla.com - Google Chrome\" of application process \"Chrome\""


in 99% of cases, you can refer to any window in a number of ways - the default you're seeing here is by name, but you can also use relative references such as window ID (typically window 1 is the frontmost).


Therefore I'd start by trying:


Path to element is strictly related to title - what could be part of the issue:


"click UI Element \"Save\" of sheet 1 of window 1 of application process \"Chrome\""


this should just save the front window, then it becomes an issue of managing the front window more than anything else.


hth

May 18, 2021 4:08 AM in response to Camelot

Thanks Camelot!!!


I had no idea that I can simply shorten window name. (I got used to use XPath or regular expressions in such cases - so it's cool.)

Anyway - it looks like my bigger problem was not proper focus on the tab - but finding button.

I solved it using tab key ("keystroke tab") and "return" key.

Issue solved. Hours of senseless work saved. :)


Thanks for your help!

Automator / OSX 11.2.3 - execute set of operations on the URLs from the list

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.