Mac Get first item in list

vloryan

macrumors member
Original poster
Jan 11, 2014
57
0
Guys,

this is probably very simple for all of you. I don't get it to work. I simply want to pass one PDF file only (not more than 1) withing the folder xpdf (on my desktop) to the next Automator action. Any idea how to do this with Applescript?

Thank you very much!
 

chown33

Moderator
Staff member
Aug 9, 2009
8,770
5,138
vertical
The "Run AppleScript" action in Automator gives you this prototype handler:
Code:
on run {input, parameters}
	
	(* Your script goes here *)
	
	return input
end run
Read the explanation of this handler here:
https://developer.apple.com/library...lAppleScript/WritingScript/WritingScript.html

Important point: 'input' is usually a list. So if the previous Automator action produces a list of PDF files, you want to output only the first item in that list.

So in AppleScript, knowing that you're given a list, write code that returns the first item in that list.

You should also show each Automator action's results, to confirm the output of the previous action is a list, and the result of the AppleScript action is a list or the single first item.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.