Calling another script from a script..

Hello all from MacScripter,
Thank you for looking at this idea that I have…

I have little knowledge of AppleScript and know basics (sort of…) This would be my 2nd Script that is big in my opinion. People here at MacScripter have helped me write a Disk Image Creator Script. Well here’s my idea…

For those who love to script or have a common interest in math, I would like to make a math program that has many types of programs embedded and have a menu and stuff like this…

This is a diagram of what what I am trying to recreate…

Menu…

  1. Area
  2. Pythagorean theorem
  3. Quadratic Formula

and when user chooses area, it will go to a script called “area.scpt” and proceed from there…

Is this at all possible?

Any help writing this?
Here are the formulas (God, I hope I’m right lol)
Pythagorean Theorem Formula = a^2+b^2=c^2
Quadratic Formula= (-b=sqrt(b^2-4ac))/2a
(-b+sqrt(b^2-4ac))/2a
Area=square = a 2
rectangle = bh
parallelogram = b
h
trapezoid = h/2 (b1 + b2)
*AREA ISN’T NECESSARY, THIS IS JUST A PROJECT THAT I’M INCORPORATING INTO XCODE… XCODE IS MY NEXT THING MAKING THE INTERFACE BUILDER OH BOY!"

Anyone who is willing to share ideas and pursue a path in helping me create a math program as a hobby for people that love math as much as I do then please help me.

Thanks,
Chris D.

Model: Intel MacBook
AppleScript: 2.11
Browser: Safari 419.3
Operating System: Mac OS X (10.4)

This is absolutely possible, but may not be needed. Generally calling other scripts is done because it reusable code that is used in many different projects. An example might be a logging script. In this case you needn’t have multiple scripts (though you certainly could), but rather just call various handlers within your main script depending on the menu item selected by the end user.

OT: it’s never a good idea to put your email address in a post. Beware of spam…

Stadsman,
Thank you for that tip… I removed it quickly :slight_smile:

Can anyone help me with the code to run a script from a script…

Like I have a script called Main Menu…

and its like Choice 1) When choice 1 is chosen, it will go to a script on a folder titled “Scripts” on my desktop. The script is called “Disk Creator”
Choice 2) When choice 2 is chosen, it will go to a script on a filder titled "Scripts on my desktop. The script is called “Test”…

Thanks,

  Chris D.

Model: Intel MacBook
AppleScript: 2.11
Browser: Safari 419.3
Operating System: Mac OS X (10.4)

Hi Chris, something like this should work for you (that is if I’m understanding your correctly).

set script_path to (path to desktop as Unicode text) & "Scripts:"
set script_name to choose from list {"Disk Creator", "Test"}
if script_name is not false then run script file (script_path & (item 1 of script_name) & ".scpt")