Open files in sequence for processing

I am trying to open all files in a folder one at a time. The problem below is that it is not building the filename correctly. This line of the code is probably where the problem is: set the_file to the_folder & item x of the_folder_list

What would you change to make it open up the correct file?

Here is the error:

tell current application
list folder alias “HD:Users:andy:Desktop:folder:” without invisibles
→ {“file 2.pdf”, “file1.pdf”}
end tell
tell application “Adobe Reader”
activate
open {alias “HD:Users:andy:Desktop:folder:”, “file 2.pdf”}
→ {missing value, missing value}
→ error number 0

set the_folder to (choose folder with prompt "Choose Folder to Operate On")
set the_folder_list to list folder the_folder without invisibles

repeat with x from 1 to count of the_folder_list
	set the_file to the_folder & item x of the_folder_list
	set the_new_file to the_folder & the_file
	tell application "Adobe Reader"
		activate
		open the_file
	end tell
end repeat

Thanks,
Andy

Model: iMac 27 mid 2010
AppleScript: 2.2.1
Browser: Safari
Operating System: Mac OS X (10.7)

The below seems to work. When to use HFS paths vs. when to use POSIX paths idea is kinda kicking my behind. You don’t want to know how long that one little word stumped me. :roll eyes: :lol:

set the_folder to POSIX path of (choose folder with prompt "Choose Folder to Operate On")
set the_folder_list to list folder the_folder without invisibles

repeat with x from 1 to count of the_folder_list
	set the_file to the_folder & item x of the_folder_list
	set the_new_file to the_folder & the_file
	tell application "Adobe Reader"
		activate
		open the_file
	end tell
end repeat

Hi,

as you can see in the error log, the line building the file name tries to concatenate an alias specifier (the folder) with a string. This is not possible. Coerce the alias to text


set the_folder to (choose folder with prompt "Choose Folder to Operate On")
set the_folder_list to list folder the_folder without invisibles
activate application "Adobe Reader"

repeat with x from 1 to count of the_folder_list
	set the_file to (the_folder as text) & item x of the_folder_list
	tell application "Adobe Reader"
		open the_file
	end tell
end repeat


So why did switching to POSIX fix this issue then?

POSIX path is text, therefore it can be concatenated with an other text.
But don’t expect that POSIX paths work generally as a replacement of HFS paths