• Welcome to the new Mac-Forums. See News and Community Announcements for more details.

Does anyone use Automator on a regular basis?

krs


Joined
Sep 16, 2008
Messages
1,722
Reaction score
39
Points
48
Location
Canada
I think I have used Automator ages ago and now have a task that I think is perfect for Automator, but I'm having trouble to get my head around the way Automator is set up in El Capitan.

I basically can't figure out which of the eight options to use to even starts.

The task is very simple

I have a few thousand pdf files in a folder on my desktop.
What I need in the end is a jpeg file of the first page of each pdf file.

So manually I just:
1. Select the folder on my desktop
2. Open the first pdf
2. Save this pdf as a jpeg (which will save only the first page of the pdf as a jpeg)
3. Save the jpeg in the same folder
4. Close the pdf
Repeat by selecting and opening the next pdf

First problem I'm running into is that automator does not show an action "Open pdf"
If I look at "Open Word Documents", a pdf document is not one of the types.

And I thought this would be easy and straight forward.
 
Joined
Oct 16, 2010
Messages
13,227
Reaction score
210
Points
63
Location
Brentwood Bay, BC, Canada
I basically can't figure out which of the eight options to use to even starts.
The task is very simple

Doesn't your Mac OS Automator.app still have a "Watch Me" to record the script you want to create of everything you want to do, or has Apple removed that feature along with so many others??? :p



- Patrick
======
 
Joined
Oct 16, 2010
Messages
13,227
Reaction score
210
Points
63
Location
Brentwood Bay, BC, Canada
Well....

Means I have to dig out my old MacBook pro and reinstall my special macOS 10.6.7


No, not really because you could try this:
Oct 7, 2013 12:11 PM in response to jbsphoto

Automator has a "Render PDF Pages to Images" action.

There's a wizard that pops up when you run Automator asking you to choose a template. The second template is "Application":

Applications are self-running workflows. Any files or folders dropped onto an Application will be used as input to the workflow.

So:

Open Automator
Choose "Application"
Drag the "Render PDF Pages to Images" action onto the workflow
This action produces random filenames, so follow it with "Rename Finder Items" (choose "Make sequential" from the dropdown list
Then add a "Move Finder Items" to have the output files moved to the Desktop
Save your new application somewhere
Drag files onto it
how do i convert pdf to jpg in automator? - Apple Community

And if that doesn't work, try here:
mac automator "Convert PDF to JPEG"
mac automator "Convert PDF to JPEG" - Google Search

Good luck.


- Patrick
======
 

krs


Joined
Sep 16, 2008
Messages
1,722
Reaction score
39
Points
48
Location
Canada
Thanks Patrick,

But I couldn't get this to work either.

Oner thing I should mention -
When I do this manually as described in my first post...if I use Preview to opern the pdf and then save it as a jpg, I get a jpg of the first page ONLY!...which is exactly what I want
If I do the same thing in Adobe Acrobat for instance, oen the pdf and then save/export it as a jpg, I get a jpg of every pdf page in the pdf document ...which is NOT what I want

Seems to me, even if I could get this to work, that Automastor action: "Render PDF Pages to Images" just the way it is worded would probably give me jpg of all the pdf pages.

I aslo tried another suggestion on the google list - select all the pdfs, open them with Preview and save as jpgs.
Tried that on a sample of 5 pdfs, but when I saved them as jpgs, I only got a jpg of the first page of that whole lot, not a jpg of every first page of those 5 pdfs.

BTW - The "Watch Me" function is still available by using the record button.
Haven't tried that, but that just repeats the mouse or keyboard inputs exactly, I need the mouse (or something) to select the next pdf in a long list of pdfs and then do the repetitive stuff
 

Slydude

Well-known member
Staff member
Moderator
Joined
Nov 15, 2009
Messages
15,145
Reaction score
319
Points
83
Location
North Louisiana, USA
Your Mac's Specs
2.8 GHz 2008 MacBook Pro 10.11, 8 GB mem, iPhone XS, 2015 iMac 16 GB 10.15.5 beta
I won't be able to ork on this for several days but I'm pretty sure t can be done with Automator. I've prersonally been a little disappointed that there have been so few new Automator actions for quite a while. I haven't looked recently so I could be wrong there.

BTW I don't find the Watch Me Do action helpful in many situations where one would expect it to be. Haven't used it (or Automator in general) in a while but IIRC Watch Me Do often got confused if that action was called when the cursor was in a different place when the workflow was designed.
 

krs


Joined
Sep 16, 2008
Messages
1,722
Reaction score
39
Points
48
Location
Canada
Thanks guys,
If I had any experience with Automator recently, I could probably figure this out myself pretty easily, but I have trouble figuring out where to even start.
Also there doesn't seem to be an Automator function to open a pdf in Preview.

BTW - What happened to the "Edit" function?
I was trying to correct some typos I just noticed in my last post, I double checked to make sure I'm logged in, which I am, but there is no Edit option for my own posts, just "Reply" and "Reply with Quote" like every other post in this thread.
 
Joined
Oct 16, 2010
Messages
13,227
Reaction score
210
Points
63
Location
Brentwood Bay, BC, Canada
BTW - What happened to the "Edit" function?
I was trying to correct some typos I just noticed in my last post, I double checked to make sure I'm logged in, which I am, but there is no Edit option for my own posts, just "Reply" and "Reply with Quote" like every other post in this thread.

Hmmm... I hadn't really noticed but you are correct, and with some quick crude ckecking of my own posts or edits, it seems that any posts after about 24 hours from the last post seem to drop the "Edit" option. Any posts prior to 24 hours seems to have the "Edit" option available.

Maybe one of the Admins/Mods could confirm what the settings might be.


- Patrick
======
 

chscag

Well-known member
Staff member
Admin
Joined
Jan 23, 2008
Messages
60,461
Reaction score
755
Points
113
Location
Keller, Texas
Your Mac's Specs
2017 27" iMac, 10.5" iPad Pro, iPhone 7+, iPhone 8, iPhone 11, Numerous iPods, Catalina
Maybe one of the Admins/Mods could confirm what the settings might be.
I'll have to refer to Nick on that. The old "edit" options were different for the Staff, Premium Members, and regular members. But those time limits were from long ago when I first joined the forums. I really do not know what they are currently.
 
Joined
Sep 30, 2007
Messages
8,400
Reaction score
360
Points
83
Location
The Republic of Neptune
Your Mac's Specs
27" 2019 iMac
Ok, this took some trial and error. As per Automator World, the numbering is completely random and a simple rename won't work because you can't distinguish which jpg is page 1 for subsequent documents when batching this. But I found a way around that. I suggest saving this as a "Quick Action", which will be accessible from the Services menu by right-clicking the PDFs you want to run this on.

This workflow starts by splitting the selected PDFs into separate PDF pages. These will be named sequentially and not randomly. So in the demo I was running, Document 01 is split into Document 01-page1, Document 01-page2, and so on. The next step will then render them all as JPGs. Afterwards, it will move the JPGs to a folder of your choice. And so, here we go....

Open up Automator; click "New Document", then select and choose "Quick Action".

On the far top right, adjust the options so that "Workflow receives PDF files in Finder". The remainder of the options there are irrelevant.

From the list of actions on the left, select "PDFs", then double-click on the action "Split PDFs". This action will then be on the right in your workflow. Set the folder you want these output to. These will be the PDFs split into single pages, so plan on deleting them all once done. You can leave the input name as same, unless you have a need to rename them.

From the list of actions on the left, select "PDFs", then double-click on the action "Render PDF Pages as Images" to add it as the 2nd step of the workflow. Set the options as you see fit.

From the list of actions on the left, select "Files & Folders", then double-click on the action "Move Finder Items" to add it as the 3rd and final step of your workflow. Set the location you want to save these JPGs to.

Once done, save the workflow named as you see fit. "PDF to JPG" for example. It should be saved directly to the Services folder for your user account. You can then highlight all the PDF files you want to run this on; right-click on them; and select the workflow from the list of services at the bottom.
One quirk I have here is that the JPGs will have " 2" appended to the end of the filename. You can use a renaming tool to quickly remove that by the "remove two characters from the end" option that most of them have. There's not a clean foolproof way for me to do this automatically in the workflow without risking messing up your preferred filenames. I also wasn't able to easily filter just "page1" for conversion to JPG, so once done, just filter the folder contents yourself in Finder for "page1" and then move them to another folder of your choice. You can then delete what's left. It should be possible to automate this, but it's going to overcomplicate the task and this is easy enough to do manually, especially if it's a one-off task. I can work it out if you need me to.

screenshot_129.jpg
 

Slydude

Well-known member
Staff member
Moderator
Joined
Nov 15, 2009
Messages
15,145
Reaction score
319
Points
83
Location
North Louisiana, USA
Your Mac's Specs
2.8 GHz 2008 MacBook Pro 10.11, 8 GB mem, iPhone XS, 2015 iMac 16 GB 10.15.5 beta
Kudos for that LB. Way to go the extra mile. I'm sure it's appreciated.
 
Joined
Sep 30, 2007
Messages
8,400
Reaction score
360
Points
83
Location
The Republic of Neptune
Your Mac's Specs
27" 2019 iMac
I've prersonally been a little disappointed that there have been so few new Automator actions for quite a while. I haven't looked recently so I could be wrong there.
Yeah, AutomatorWorld is very severely outdated. I was dumbfounded that the one I pointed out was PPC-only. That's just awful. The site clearly has effectively been abandoned. It's a shame because Automator is one of those little gems that adds a lot of utility to OS X. Unfortunately even Apple seems to have abandoned it also considering no new actions have been added in ages.
 

krs


Joined
Sep 16, 2008
Messages
1,722
Reaction score
39
Points
48
Location
Canada
This workflow starts by splitting the selected PDFs into separate PDF pages.
Thanks LB,

Is splitting the pdf into separate pdf pages really necessary?

As I have been emphasizing in my previous posts - I just need to automate the function I get when I open a pdf in preview and then save that pdf as a jpg in preview.
This will give me a jpg of the first page only of that pdf which is what I want.

Seems the workflow you developed will give me a jpg of every pdf page of each pdf document, so if I have 1000 pdf documents of 40 pages each, I would get 40 000 jpg pages rather than just 1000 jpg pages.
Or am I mistaken in that?
 

chscag

Well-known member
Staff member
Admin
Joined
Jan 23, 2008
Messages
60,461
Reaction score
755
Points
113
Location
Keller, Texas
Your Mac's Specs
2017 27" iMac, 10.5" iPad Pro, iPhone 7+, iPhone 8, iPhone 11, Numerous iPods, Catalina
Kind of the same thing has happened to MS Office macros. I can remember working on a macro and debugging it numerous times but when all the macro virus scares occured in Windows, it seems like no one is really writing them anymore.

And believe me, macros will save you a ton of work especially if you're working on a long document or a complex Excel spread sheet.

I seem to remember there was a site that specialized in already written Apple Scripts, does anyone know if it still exists?
 
Joined
Oct 16, 2010
Messages
13,227
Reaction score
210
Points
63
Location
Brentwood Bay, BC, Canada
I seem to remember there was a site that specialized in already written Apple Scripts, does anyone know if it still exists?

Were you thinking of "Doug's Apple Scripts" which seems to have changed rather drastically from what I remember:
Doug's AppleScripts for iTunes >> dougscripts.com

Then, of course there was the old HyperCard and its scripting that some could get it to do some incredible stuff, but alas, no longer supported or working these OS X days. :-(



- Patrick
======
 

Slydude

Well-known member
Staff member
Moderator
Joined
Nov 15, 2009
Messages
15,145
Reaction score
319
Points
83
Location
North Louisiana, USA
Your Mac's Specs
2.8 GHz 2008 MacBook Pro 10.11, 8 GB mem, iPhone XS, 2015 iMac 16 GB 10.15.5 beta
Yeah, AutomatorWorld is very severely outdated. I was dumbfounded that the one I pointed out was PPC-only. That's just awful. The site clearly has effectively been abandoned. It's a shame because Automator is one of those little gems that adds a lot of utility to OS X. Unfortunately even Apple seems to have abandoned it also considering no new actions have been added in ages.
I noticed the same thing recently when I went there for the first time in about two years or maybe more. Even before Apple basically abandoned it they made changes to some action steps that broke some workflows I created and I never really found a good replacement action. One of them even got a positive comment from Aple's own Sal Saghouian.

I remember Doug's AppleScripts but I think Charlie might have been referring to MacScripter.
 

chscag

Well-known member
Staff member
Admin
Joined
Jan 23, 2008
Messages
60,461
Reaction score
755
Points
113
Location
Keller, Texas
Your Mac's Specs
2017 27" iMac, 10.5" iPad Pro, iPhone 7+, iPhone 8, iPhone 11, Numerous iPods, Catalina
Were you thinking of "Doug's Apple Scripts" which seems to have changed rather drastically from what I remember:
Yep, that's the one. You have a good memory Patrick!
 
Top