Applescript Help

Joined
Dec 17, 2011
Messages
5
Reaction score
0
Points
1
Hi. I'm a beginning applescript dude and I'd like to know something about it. I'm making this widget that can do lots of stuff. Basically it's a simple application with a control panel and this control panel will have buttons like calculator or game. These buttons will link to external scripts so my code isn't all crammed into one script for easier reading of the code. I've developed all my components. Each thing will be in a different script. I have my main/control panel script that will link to all my other separate scripts. I'd like to know how to link these scripts to the resources folder of the script. Basically so that the users will only have access to the main script, which will link to the other scripts which would be located on the resources folder when you click on show package contents. Thanks and please help.
 
Joined
Aug 13, 2011
Messages
200
Reaction score
7
Points
18
Location
West Sussex
If you are working in Applescript Editor, then save your main controller script as a bundle, from the save as menu, in the main File menu, this brings up the save dialog box, and there is a file format drop down list, select script bundle, and click save button.
Then back in the editor you will see a bundle contents button on the right side of the Run toolbar, click this button an it will show you the contents folder of your script bundle, you can create folders here with the smaller toolbar button, and name the folders anything you like, and you can also drag any script file or resources into any of the bundle folders.
Usually scripts are kept in the scripts folder inside the contents folder, not the resources folder, the resources folder is usualy reserved for icons, media, help files, ect.
But it does not really matter.

To find the external script files from your controller script, use the path to me command, and also the path to resource command, in your main controller script.

for example

Code:
set my_icon_file to path to resource"MyIcon.icns" in bundle (path to me) as alias

hope this helps

Regards Mark
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top