-- launcher.applescript -- launcher -- Created by kts on 2014-11-21. -- Copyright 2014 __MyCompanyName__. All rights reserved. on idle -- get this script's path - should always be proclib/ tell application "Finder" set script_path to container of (path to me) as alias end tell -- get visualizer set program to the button returned of (display dialog "visualizer program: " buttons {"SDL", "ASCII", "cancel"} default button 1) -- get the structures definition file set file_path to (choose file default location script_path with prompt "Select a structures file:") -- run! runProg(program, file_path) quit end idle on runProg(program, file_path) tell application "Finder" set script_path to container of (path to me) as alias end tell set file_path to POSIX path of file_path display dialog "Name of structure to create:" default answer "start" set structure_name to text returned of result if program = "SDL" then do shell script (POSIX path of (path to me)) & "Contents/Resources/proclib.app/Contents/MacOS/proclib" & " " & file_path & " " & structure_name else if program = "ASCII" then tell application "Terminal" do script (POSIX path of (path to me)) & "Contents/Resources/main" & " " & file_path & " " & structure_name & "; exit" end tell end if end runProg on open finderObjects -- get visualizer set program to the button returned of (display dialog "visualizer program: " buttons {"SDL", "ASCII", "cancel"} default button 1) -- run! repeat with current_file in finderObjects runProg(program, current_file) end repeat quit end open