Skip to content

Instantly share code, notes, and snippets.

@dnnsmnstrr
Forked from melangue/script_launcher_plus.scpt
Last active October 12, 2019 09:13
Show Gist options
  • Save dnnsmnstrr/c02ae3d5be5ab484b595cb8aea6cf65b to your computer and use it in GitHub Desktop.
Save dnnsmnstrr/c02ae3d5be5ab484b595cb8aea6cf65b to your computer and use it in GitHub Desktop.
Script runner - asks for input first and shows folder prompt if no name is given
---
-- Script-Runner
---
-- set path to script folder
set _Path to ("PATH_TO_YOUR_SCRIPT_FOLDER")
set scriptInput to text returned of (display dialog "Enter name of script to run" default answer "" buttons "OK" default button "OK")
if scriptInput is equal to "" then
-- prompt user to choose a file from script folder
set scriptLaunch to choose file with prompt "Choose a script to run" default location _Path as POSIX file
else if scriptInput contains scriptInput then
set scriptLaunch to _Path & "/" & scriptInput & ".scpt"
end if
try
-- run chosen script
run script scriptLaunch
on error
display alert "Your script failed to launch."
end try
@dnnsmnstrr
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment