Mac Forums

Mac Forums (
-   OS X - Development and Darwin (
-   -   Applescript Help (

scriptinggeek12 12-17-2011 05:35 PM

Applescript Help
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.

Mark FX 12-18-2011 02:25 PM

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


set my_icon_file to path to resource"MyIcon.icns" in bundle (path to me) as alias
hope this helps

Regards Mark

All times are GMT -4. The time now is 10:14 AM.

Powered by vBulletin
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.