neosnippet.vim/autoload/neosnippet/snippets/applescript.snip

186 lines
3.7 KiB
Plaintext
Raw Normal View History

2012-02-02 04:33:35 +00:00
snippet script
2012-10-30 03:06:31 +00:00
script ${1:#:new_object}
2012-02-02 04:33:35 +00:00
on run
2012-10-30 03:06:31 +00:00
${2:TARGET}
2012-02-02 04:33:35 +00:00
end run
end script
snippet on
2012-10-30 03:06:31 +00:00
on ${1:#:functionName}(${2:#:arguments})
${3:TARGET}
2012-02-02 04:33:35 +00:00
end ${1}
snippet tell
2012-10-30 03:06:31 +00:00
tell ${1:#:app}
${0:TARGET}
2012-02-02 04:33:35 +00:00
end tell
snippet terms
2012-10-30 03:06:31 +00:00
using terms from ${1:#:app}
${0:TARGET}
2012-02-02 04:33:35 +00:00
end using terms from
snippet if
if ${1:true} then
2012-10-30 03:06:31 +00:00
${0:TARGET}
2012-02-02 04:33:35 +00:00
end if
snippet rept
abbr rep
repeat ${1} times}
2012-10-30 03:06:31 +00:00
${0:TARGET}
2012-02-02 04:33:35 +00:00
end repeat
snippet repwh
abbr rep
2012-10-30 03:06:31 +00:00
repeat while ${1:#:condition}
${0:TARGET}
2012-02-02 04:33:35 +00:00
end repeat
snippet repwi
abbr rep
repeat with ${1} in ${2}
2012-10-30 03:06:31 +00:00
${0:TARGET}
2012-02-02 04:33:35 +00:00
end repeat
snippet try
try
2012-10-30 03:06:31 +00:00
${0:TARGET}
2012-02-02 04:33:35 +00:00
on error
-- error handling
end try
snippet timeout
2012-10-30 03:06:31 +00:00
with timeout ${1:#:number} seconds
${0:TARGET}
2012-02-02 04:33:35 +00:00
end timeout
snippet con
2012-10-30 03:06:31 +00:00
considering ${1:#:case}
${0:TARGET}
2012-02-02 04:33:35 +00:00
end considering
2012-10-30 03:06:31 +00:00
2012-02-02 04:33:35 +00:00
snippet ign
2012-10-30 03:06:31 +00:00
ignoring ${1:#:application responses}
${0:TARGET}
2012-02-02 04:33:35 +00:00
end ignoring
snippet shell
2012-10-30 03:06:31 +00:00
${1:#:set shell_stdout to }do shell script ${3:"${2:#script}"}
2012-02-02 04:33:35 +00:00
without altering line endings
${0}
snippet delim
set oldDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to {"${1:,}"}
2012-10-30 03:06:31 +00:00
${0:#:TARGET}
2012-02-02 04:33:35 +00:00
set AppleScript's text item delimiters to oldDelims
snippet parent
prop parent : app "${1}"
snippet alert
2012-10-30 03:06:31 +00:00
display alert "${1:#:alert text}"
${2:#:message} "${3:#:message text}"
${4:#:as warning}
2012-02-02 04:33:35 +00:00
snippet dialog_OK
abbr dialog
2012-10-30 03:06:31 +00:00
display dialog "${1:#:text}"
${2:#:with icon} ${3:1}
2012-02-02 04:33:35 +00:00
buttons {"${4:OK}"} default button 1
snippet dialog_OK/Cancel
abbr dialog
2012-10-30 03:06:31 +00:00
display dialog "${1:#:text}"
${2:#:with icon}
buttons {"${3:Cancel}", "${4:OK}"}
2012-02-02 04:33:35 +00:00
default button "${4}"
set button_pressed to button returned of result
if button_pressed is "${4}" then
2012-10-30 03:06:31 +00:00
${5:#:TARGET}
2012-02-02 04:33:35 +00:00
else
-- action for cancel button goes here
end if
2012-10-30 03:06:31 +00:00
2012-02-02 04:33:35 +00:00
snippet dialog_OK/Cancel/Other
abbr dialog
2012-10-30 03:06:31 +00:00
display dialog "${1:#:text}"
${2:#:with icon}
buttons {"${3:Cancel}", "${4:Other Choice}", "${5:OK}"}
2012-02-02 04:33:35 +00:00
default button "${5}"
set button_pressed to button returned of result
if button_pressed is "${5}" then
2012-10-30 03:06:31 +00:00
${6:TARGET}
2012-02-02 04:33:35 +00:00
else if button_pressed is "${3}" then
-- action for cancel button goes here
else
-- action for other button goes here
end if
snippet dialog_TextFierld
abbr dialog
2012-10-30 03:06:31 +00:00
set the_result to display dialog "${1:#:text}"
default answer "${2:#:type here}"
${3:#:with icon}
buttons {"${4:Cancel}", "${5:OK}"}
2012-02-02 04:33:35 +00:00
default button "${5}"
set button_pressed to button returned of the_result
set text_typed to text returned of the_result
if button_pressed is "${5}" then
2012-10-30 03:06:31 +00:00
${6:#:TARGET}
2012-02-02 04:33:35 +00:00
else
-- action for cancel button goes here
end if
snippet choose_Applications
abbr choose
2012-10-30 03:06:31 +00:00
${1:#:set the_application to }choose application with prompt "${2:#:Choose an application:}"${3:#:with multiple selections allowed}
2012-02-02 04:33:35 +00:00
snippet choose_Files
abbr choose
2012-10-30 03:06:31 +00:00
${1:#:set the_file to }choose file with prompt "${2:#:Pick a file:}"
${3:#:default location path to home folder}
${4:#:with invisibles}
${5:#:with multiple selections allowed}
${6:#:with showing package contents}
2012-02-02 04:33:35 +00:00
snippet choose_Folders
abbr choose
2012-10-30 03:06:31 +00:00
${1:#:set the_folder to }choose folder with prompt "${2:#:Pick a folder:}"
${3:#:default location path to home folder}
${4:#:with invisibles}
${5:#:with multiple selections allowed}
${6:#:with showing package contents}
2012-02-02 04:33:35 +00:00
${0}
snippet choose_NewFile
abbr choose
2012-10-30 03:06:31 +00:00
${1:#:set the_filename to }choose file name with prompt "${2:#:Name this file:}"
default name "${3:untitled}" default location ${4:#:path to home folder}
2012-02-02 04:33:35 +00:00
snippet choose_URL
abbr choose
2012-10-30 03:06:31 +00:00
${1:#:set the_url to }choose URL showing ${2:Web} servers with editable URL
2012-02-02 04:33:35 +00:00
snippet choose_Color
abbr choose
2012-10-30 03:06:31 +00:00
${1:#:set the_color to }choose color default color ${2:{65536, 65536, 65536\}}
2012-02-02 04:33:35 +00:00
snippet choose_ItemFromList
abbr choose
set the_choice to choose from list ${1}"\}}
2012-10-30 03:06:31 +00:00