Export all open Safari tabs to PDF

From time to time I get documentation packages that contain an index.html that links to several pages via a menu. I open all these menu items (pages) manually (via clicking in Safari) and want to export them as PDF. (Once I've done that, I create one Reference.pdf via a macro to combine PDFs that has been posted here.)

I now have a semi-automatic solution that I have to repeat for every tab. I'd like to add a While action that cycles thru all open tabs.

Any advice on how to achieve this, is highly appreciated.

One quick, untested idea: since it sounds like you're keeping all these tabs in their own window, you could save the number of windows in a variable, then have the While condition check the current window count against that variable and have it stop when the number of windows changes (i.e. when the last tab is closed):


Thanks for your quick reply, but actually I only have one Safari window that contains all tabs.

Let me see if there's a TABCOUNT() too :).

Haha, there's not:

But of course, it's not a problem for me to open every page in its own Safari window.

Thank you, Gabe!

No problem, and yes, there is a tab count function, though there are different ones specific to Safari and Chrome (as well as one catch-all function for either). If you just need the macro to stop when the number of Safari tabs reaches 0, you shouldn't even need the prior action:

Ah, thanks! In the meantime I came up with this approach:

Should have read: Export all open Safari windows to PDF

Great. With your latest info I created this very slick solution:

1 Like