Need help on file selection and shell script

Hi all,

I require a bit of help. I am trying to create a script that allows me to choose a folder then some image files and do a shell script. With this I am trying to automate keypoint matching for panorama photography. Here is the command I’d like to execute in the terminal:

cd /path_to_folder/
/path_to_script/autopano-complete.sh -c -s 500 -p 16 -o projectname.pto /path_to_image.jpg /path_to_image.jpg /path_to_image.jpg /path_to_image.jpg

the command usage: autopano-complete.sh [options] -o panoproject.pto image1 image2 […]

I would like to execute the script in its folder. I would like to save the output file (projectname.pto) in the project folder (ie. panoramas/california) and select the images in order that i have taken. In the future I may want to change the variables (-c -s -p) and delete the keyfiles (.key) generated.

This is the output I get so far:

cd Macintosh HD:Users:sebastian:Pictures:Projects:Panoramas:MCT:images:AUGUST03b.jpgMacintosh HD:Users:sebastian:Pictures:Projects:Panoramas:MCT:images:AUGUST03c.jpgMacintosh HD:Users:sebastian:Pictures:Projects:Panoramas:MCT:images:AUGUST03a.jpg; /Applications/HuginOSX/autopano-sift-C/autopano-complete.sh -c -s 500 -p 16 -o Pano.pto Macintosh HD:Users:sebastian:Pictures:Projects:Panoramas:MCT:images:AUGUST03b.jpg Macintosh HD:Users:sebastian:Pictures:Projects:Panoramas:MCT:images:AUGUST03c.jpg Macintosh HD:Users:sebastian:Pictures:Projects:Panoramas:MCT:images:AUGUST03a.jpg

But I need this:
cd /Users/sebastian/Pictures/Projects/Panoramas/Mammoth/
/Applications/HuginOSX/autopano-sift-C/autopano-complete.sh -c -s 500 -p 16 -o mammoth.pto /Users/sebastian/Pictures/Projects/Panoramas/Mammoth/CIMG3328.jpg /Users/sebastian/Pictures/Projects/Panoramas/Mammoth/CIMG3327.jpg etc…

Here is my applescript:

--Project name
set theproject to "Pano" -- for testing only
--display dialog "Name?" default answer "pano" buttons {"Cancel", "Continue"}
--copy the result as list to {the buttonpressed, the theproject}
--set tempFolder to ""
-- select panorama folder
--set tempFolder to choose folder with prompt "Please select the Pano Folder"
--set thePanoFolder to POSIX path of tempFolder
-- select panorama images
set extensionlist to {"jpg", "jpeg", "tif"}

choose file with multiple selections allowed without invisibles --whose name extension is in extensionlist
set theFiles to result

set ASTID to AppleScript's text item delimiters
set AppleScript's text item delimiters to {" "}
set imageList to (text items of theFiles) & " " as Unicode text
set AppleScript's text item delimiters to ASTID

set thecommand to "cd " & theFiles & ";" & " /Applications/HuginOSX/autopano-sift-C/autopano-complete.sh -c -s 500 -p 16 -o " & theproject & ".pto" & " " & imageList

Appreciate any help,

S.

Is this what you mean ??

--Project name
set theproject to "Pano" -- for testing only
--display dialog "Name?" default answer "pano" buttons {"Cancel", "Continue"}
--copy the result as list to {the buttonpressed, the theproject}
--set tempFolder to ""
-- select panorama folder
--set tempFolder to choose folder with prompt "Please select the Pano Folder"
--set thePanoFolder to POSIX path of tempFolder
-- select panorama images
set extensionlist to {"jpg", "jpeg", "tif"}
set these_items to ""
set theFiles to (choose file with multiple selections allowed without invisibles) --whose name extension is in extensionlist

tell application "Finder"
	set theFolder to container of item 1 of theFiles as alias
	repeat with i from 1 to number of items in theFiles
		set these_items to these_items & space & POSIX path of item i of theFiles
	end repeat
end tell
set theCommand to "cd " & POSIX path of theFolder & ";" & " /Applications/HuginOSX/autopano-sift-C/autopano-complete.sh -c -s 500 -p 16 -o " & theproject & ".pto" & " " & these_items

Yes, thank you, this returns it the right way, but for some reason in reverse order. How can I get the files sorted correctly?
Can I then say do shell script thecommand?

Not sure yet, maybe a sort by creation date first

Yes

maybe this will do it.

--Project name
set theproject to "Pano" -- for testing only
--display dialog "Name?" default answer "pano" buttons {"Cancel", "Continue"}
--copy the result as list to {the buttonpressed, the theproject}
--set tempFolder to ""
-- select panorama folder
--set tempFolder to choose folder with prompt "Please select the Pano Folder"
--set thePanoFolder to POSIX path of tempFolder
-- select panorama images
set extensionlist to {"jpg", "jpeg", "tif"}
set these_items to ""
set theFiles to (choose file with multiple selections allowed without invisibles) --whose name extension is in extensionlist

tell application "Finder"
	set theFiles to reverse of (sort theFiles by creation date)
	set theFolder to container of item 1 of theFiles as alias
	repeat with i from 1 to number of items in theFiles
		set this_item to item i of theFiles as alias
		
		set these_items to these_items & space & POSIX path of this_item
	end repeat
end tell

set theCommand to "cd " & POSIX path of theFolder & ";" & " /Applications/HuginOSX/autopano-sift-C/autopano-complete.sh -c -s 500 -p 16 -o " & theproject & ".pto" & " " & these_items

do shell script theCommand