Launching applications with a string in ""s

I’m trying to make a simple script that, when launched, prompts “what app would you like to open?” and then with a simple

tell

command, opens the app.

So far:

set iLaunch to ""

repeat while iLaunch is ""
	display dialog "What app would you like to launch?" default answer iLaunch
	set iLaunch to text returned of the result
end repeat

try
	tell app "& iLaunch &"
		activate
	end tell
end try

This is really rough, (I’m new to AppleScript), but I think you can get the idea of what I’m trying to do…

Thanks :slight_smile:

What is

supposed to be for?

This works perfect:

set iLaunch to ""

repeat while iLaunch is ""
	display dialog "What app would you like to launch?" default answer iLaunch
	set iLaunch to text returned of the result
end repeat

try
	tell application iLaunch
		activate
	end tell
end try

haha, I guess you misunderstood me…

I’m trying to make a small "Quicksilver"ish script that when I activate this script it will prompt me for an app to open.

The “& iLaunch &” is me trying desperately to take the input from the text box in the dialog in the first line and input it as the application to open.
Example:

I activate the script, it prompts “What app would you like to open?”
I type “Safari”.
The script launches “Safari”.
I type “iTunes”
The script launches “iTunes”.

See what I’m trying to do?

Thanks.

Maybe I’m misunderstanding too, but that’s exactly what Vincent’s script does…

The script Vincent posted does exactly what you’re trying to do. You don’t have to put " & iLaunch &", because iLaunch is already a string, therefore no quotes around it are required. In fact, putting quotes around iLaunch makes AppleScript try to launch an app called & iLaunch & which obviously won’t work.

Yeah! And to be honest I just fixed the “& iLaunch &” thing.

lol

I misunderstood. totally. :lol:

I didn’t even try the script Vincent posted, because I thought he thought “iLaunch” was an app I had on my computer, not the name of that string.

Thanks so much. :slight_smile: