Automator shell takes only one input ?

I’m confused, how the automator shell works. Actually the following code works, but:

do shell script "automator -i /path/to/picture-1.jpg /path/to/picture-2.jpg /path/to/picture-3.jpg 'path/to/Pictures2Pdf.workflow'"

… only the first input path (picture file) is used, instead all 3 picture files. The result should be a pdf with multiple pages

I don’t know the answer, but you could always skip automator altogether:

use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
use framework "Foundation"
use framework "AppKit" -- for NSImage
use framework "Quartz" -- required for PDF stuff

set inFiles to (choose file of type {"public.image", "com.adobe.pdf"} with prompt "Choose your  files:" with multiple selections allowed)
set destPosixPath to POSIX path of (choose file name default name "Combined.pdf" with prompt "Save new PDF to:")
its combineFiles:inFiles savingToPDF:destPosixPath

on combineFiles:inFiles savingToPDF:destPosixPath
	--  make URL of the first file
	set inNSURL to current application's |NSURL|'s fileURLWithPath:(POSIX path of item 1 of inFiles)
	-- make PDF document from the URL
	if (inNSURL's pathExtension()'s isEqualToString:"pdf") as boolean then
		set theDoc to current application's PDFDocument's alloc()'s initWithURL:inNSURL
	else
		set theDoc to my pdfDocFromImageURL:inNSURL
	end if
	-- loop through the rest
	set oldDocCount to theDoc's pageCount()
	set inFiles to rest of inFiles
	repeat with aFile in inFiles
		--  make URL of the next PDF
		set inNSURL to (current application's |NSURL|'s fileURLWithPath:(POSIX path of aFile))
		-- make PDF document from the URL
		if (inNSURL's pathExtension()'s isEqualToString:"pdf") as boolean then
			set newDoc to (current application's PDFDocument's alloc()'s initWithURL:inNSURL)
		else
			set newDoc to (my pdfDocFromImageURL:inNSURL)
		end if
		-- loop through, moving pages
		set newDocCount to newDoc's pageCount()
		repeat with i from 1 to newDocCount
			-- get page of  PDF
			set thePDFPage to (newDoc's pageAtIndex:(i - 1)) -- zero-based indexes
			-- insert the page into main PDF
			(theDoc's insertPage:thePDFPage atIndex:oldDocCount)
			set oldDocCount to oldDocCount + 1
		end repeat
	end repeat
	set outNSURL to current application's |NSURL|'s fileURLWithPath:destPosixPath
	-- save the main PDF
	(theDoc's writeToURL:outNSURL)
end combineFiles:savingToPDF:

on pdfDocFromImageURL:inNSURL
	set theImage to current application's NSImage's alloc()'s initWithContentsOfURL:inNSURL
	set theSize to theImage's |size|()
	set theRect to {{0, 0}, theSize}
	set theImageView to current application's NSImageView's alloc()'s initWithFrame:theRect
	theImageView's setImage:theImage
	set theData to theImageView's dataWithPDFInsideRect:theRect
	return current application's PDFDocument's alloc()'s initWithData:theData
end pdfDocFromImageURL:

According to the manual it should be something like:

do shell script "automator -i -- 'path/to/Pictures2Pdf.workflow' <<<'/path/to/picture-1.jpg 
/path/to/picture-2.jpg 
/path/to/picture-3.jpg'

@ Shane
A pleasure to study your code, I’ll make use of it, thanks !

@ Dj Bazzie
I get an empty pdf if I put the picture file inputs in your way. (following your example literally )
Anyway, thanks !

If you want to test:

Set wkfl to Posix path of ((path to desktop folder as text)& "Test.workflow" as text) #block: New pdf from pictures
Set cmd to "automator -i -- '"& wkfl &"' <<< '"&( psx_input as text)&"'"
#Display dialog cmd
set res to do shell script cmd
return res

Typed on my smartphone…sweat