Get contents in a list, and then run one of them

Howdy all… I’m almost done with my great project here. Its certainly been a learning experence :stuck_out_tongue:

The last thing I’m working on is my ‘chooser script’ if thats what you can call it. Since I’m planning on updating this, and there could be a large amount of scripts in the future (Possibility for user made expansions), I don’t want to use buttons, to promote expansion.

The way I was hoping to do it is to put all of my scripts into one folder in an application bundle, then have the script get the contents of that folder and put it into a list. The user then chooses their script, and the chooser then executes the script.

This is what I have so far…

tell application "Finder"
	set thefold to ((path to me as string) & "Contents:Resources:PSPapps:") as alias
	set theapp to (name of every file of folder thefold)
	set runapp to (choose from list theapp as list with prompt "What do you want to do?")
	set openapp to ("" & thefold & runapp) as alias
	open application openapp
end tell

As you can see, pretty simple. Thing is, it doesn’t work, and I can’t figure out why. It gets as far as choosing the script, and then it errors. Usually, it returns an error saying “Cannot make some data into expected type”. Then I realized that I need an ‘as alias’ to make things work. So I added that in, and now it returns the error “Can’t get application Path to the script” of application “Finder”"

(Renamer_OSX is just the script I’m using to test this, there are others.) The thing I can’t figure out is that I don’t have any reason for the finder to be doing anything with this script… so I’m at a bit of a loss. I’m pretty sure it is a Stupidity error somewhere on my part (And yes, I made a folder called “PSPapps” inside of the application bundle :P), but I think having a couple of professional eyes look at it might help.

Thanks :slight_smile:

Hi -


open application openapp


run script openapp--works with scripts aved as apps, too

I’m no pro, just an ambitious noob with some spare time. :slight_smile:

Thanks mate, that did it :slight_smile: