raycast / snippet-explorer

A tool to easily browse and import Snippets directly to Raycast.
https://ray.so/snippets
MIT License
154 stars 33 forks source link

AppleScript StandardAdditions Templates #11

Closed SKaplanOfficial closed 1 year ago

SKaplanOfficial commented 1 year ago

Add several template snippets for AppleScript's StandardAdditions library:

AppleScript Dialog

try
  set theResponse to (display dialog "{cursor}" default answer "Placeholder input" buttons {"Option 1", "Option 2", "Cancel"} default button 1 cancel button 3 with title "My Dialog" with icon note giving up after 1800 without hidden answer)
  return theResponse
on error
  return "Canceled!"
end try

AppleScript Notification

display notification "{cursor}" with title "Title" subtitle "Subtitle" sound name "Tink"

AppleScript Alert

try
  set theResponse to (display alert "{cursor}" as warning buttons {"Option 1", "Option 2", "Cancel"} default button 1 cancel button 3 giving up after 1800)
  return theResponse
on error
  return "Canceled!"
end try

AppleScript Choose From List

set theResponse to (choose from list {"Option 1", "Option 2", "Option 3"} with title "Title" with prompt "{cursor}" default items {"Option 2"} OK button name "Continue" cancel button name "Cancel" without multiple selections allowed and empty selection allowed)
return theResponse

AppleScript Choose Folder

try
  set theResponse to (choose folder with prompt "{cursor}" default location "/" with multiple selections allowed without invisibles and showing package contents)
  return theResponse
on error
  return "Canceled!"
end try

AppleScript Choose File Name

try
  set theResponse to (choose file name with prompt "{cursor}" default name "Example.txt" default location "/")
  return theResponse
on error
  return "Canceled!"
end try

AppleScript Choose File

try
  set theResponse to (choose file with prompt "{cursor}" of type {"pdf"} default location "/" with multiple selections allowed without invisibles and showing package contents)
  return theResponse
on error
  return "Canceled!"
end try

AppleScript Choose Application

try
  set theResponse to (choose application with title "Title" with prompt "{cursor}" as alias without multiple selections allowed)
  return theResponse
on error
  return "Canceled!"
end try
vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
snippet-explorer ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Jan 26, 2023 at 11:41AM (UTC)
peduarte commented 1 year ago

I love these! It definitely highlights the power of snippets. Since the project doesn't support sorting, filtering, etc, would you mind keeping it down to 2 AppleScripts snippets for now?

As the project scales we can have a dedicated Apple Script section and go from there, but atm I'd like this to be more a place for inspiration rather than a definite list of things.

SKaplanOfficial commented 1 year ago

Hi @peduarte, I've cut it down to just AppleScript Dialog and AppleScript Choose From List since they can be substitutes for most of the others.

I do think a dedicated AppleScript section would be good eventually as a lot of Raycast users use it in their script commands 😀

peduarte commented 1 year ago

@SKaplanOfficial completely agree!