Skip to content

Instantly share code, notes, and snippets.

@midore
Created February 10, 2009 09:40
Show Gist options
  • Save midore/61329 to your computer and use it in GitHub Desktop.
Save midore/61329 to your computer and use it in GitHub Desktop.
applescript, dialog-lib <http://gist.github.com/61328>
script call_scp
on load_lib_file(f)
# load "dialog.scpt" as object
load script (alias f)
end load_lib_file
on path_lib_dialog()
# path to "dialog.scpt" of current directory
tell application "Finder"
set pstr to (path to me) as alias
set the source_folder to (the folder of pstr) as text #alias
set f_path to source_folder & "dialog.scpt"
end tell
end path_lib_dialog
end script
on run
# use mydialog
# -alias of display dialog message-
#
# 2009-02-02. OS X 10.5.6
# "dialog.scpt" file exist same directory.
#
# t=>titlename, m=>message, b=>button as list,
# i=>icon number, a=>default answer, l=>list for chooslist
#
# default(t, m, b)
# default_withicon(t, m, b, i)
# giveafter(t, m, b, i, g)
# inputtext(t, m, b, a)
# chooselist(t, m, l)
#
# Example;
# set mydialog to scp_dialog of load_lib_file(path_lib_dialog()) of call_scp
# default_withicon("title", "ddd", {"OK"}, 1) of mydialog
#try
tell call_scp
#return load_lib_file(path_lib_dialog())
set mydialog to scp_dialog of load_lib_file(path_lib_dialog())
# Test dialog.
tell mydialog
default_withicon("title", "ddd", {"OK", "Cancel"}, 1)
giveafter("title", "message", {"Done"}, 2, 2)
inputtext("title", "message", {"OK", "Cancel"}, "input:")
chooselist("title", "message", {"abc", "xyz"})
end tell
end tell
#on error error_str number the error_num
# if the error_num is -128 then
# return "User's-Cancel"
# else
# return error_num
# end if
#end try
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment