I saved the script as an application and put the icon file in the resources.
set AppleScript's text item delimiters to return & return
rolldice(2, 6)
set AppleScript's text item delimiters to ""
on rolldice(diceCount, sidedness)
set eventList to {}
repeat diceCount times
set eventList's end to random number from 1 to sidedness
end repeat
display dialog "
You rolled the dice " & diceCount & " times.
The numbers are: " & return & return & eventList as text with icon path to resource "Manjusri.icns" in bundle (path to me)
end rolldice
I get this:
error “Resource not found.” number -192.
I also tried:
set AppleScript's text item delimiters to return & return
rolldice(2, 6)
set AppleScript's text item delimiters to ""
on rolldice(diceCount, sidedness)
set eventList to {}
repeat diceCount times
set eventList's end to random number from 1 to sidedness
end repeat
display dialog "
You rolled the dice " & diceCount & " times.
The numbers are: " & return & return & eventList as text with icon alias ((path to me) & "Contents:Resources:Manjusri.icns" as string)
end rolldice
Here I get:
error "File alias OS E:Users:e:Desktop:Dice Mo.app:
Contents:Resources:Manjusri.icns of «script» wasn’t found." number -43
any help appreciated.
Model: 10.9 OS
AppleScript: 2.6.1
Browser: Safari 537.85.15
Operating System: Mac OS X (10.8)