open file and folders inside a droplet

Hi.
I have putted inside a droplet two file and a folder.

the droplet have this script inside “on run”

on run
set Legenda to the quoted form of POSIX path of (path to resource "Legenda.rtf")
set LanguageGuide to the quoted form of POSIX path of (path to resource "LanguageGuide.pdf")
- here the problem!!!!!!!
set icone to the quoted form of POSIX path of (path to resource icone)

set box to display dialog "AppleScript Reference" buttons {"Legenda", "LanguageGuide", "Icone"} default button 1 with icon 1
set b to button returned of box

if b is "Legenda" then do shell script "open -e " & Legenda
if b is "LanguageGuide" then do shell script "open -a /Applications/Preview.app " & LanguageGuide
if b is "Icone" then do shell script "open " & icone
end run

if i try to open “Legenda.rtf” and “LanguageGuide.pdf” I have no problem, but how can i say to the script that Icon is a folder, not a varible? (and open it?)

Hi Matteo,

probably you must set “icone” within quotes:

set icone to the quoted form of POSIX path of (path to resource "icone")

you can also let the Finder open the folder:

set icone to (path to resource "icone")
tell application "Finder" to open icone

Sorry, but script give me a “Resource not found” before the display dialog istruction!

I think that AS undestand the “Icone” not like a folde, but like a string: isn’t it?

yes, it’s different:

set icone to the quoted form of POSIX path of (path to resource "icone") --> '/path/to/me/Contents/Resources/icone/'
set icone to (path to resource "icone") --> alias path:to:me:Contents:Resources:icone:

Note: path to resource doesn’t work in Script Editor, only starting the application bundle directly

It continuing to say me “Resource not found”
(yes, i try to starting the application bundle directly, not from the scripteditor).

Inside the bundle I have a rtf file and a PDF: those file have no problem, and the bundle opens them fine, it seems to have problem olny with this folder. Have I to change the name?

Note: path to resource doesn’t work in Script Editor, only starting the application bundle directly

on run
	set Legenda to the quoted form of POSIX path of (path to resource "Legenda.rtf")
	set LanguageGuide to the quoted form of POSIX path of (path to resource "LanguageGuide.pdf")
	set IC_folder to (path to resource "icone") --> alias path:to:me:Contents:Resources:icone:
	
	set box to display dialog "AppleScript Reference" buttons {"Legenda", "LanguageGuide", "Icone"} default button 1 with icon 1
	set b to button returned of box
	
	if b is "Legenda" then do shell script "open -e " & Legenda
	if b is "LanguageGuide" then do shell script "open -a /Applications/Preview.app " & LanguageGuide
	if b is "Icone" then tell application "Finder" to open IC_folder
end run

very strange, Matteo, I’ve tested it here and it works fine.
One other way is to “hardcode” the folder like this:

set IC_Folder to (path to me as Unicode text) & "Contents:Resources:icone:"
tell application "Finder" to open folder IC_Folder

It’s strange for me too.
Now, your last script works!

Thanks for the help Stef

Bye