title | updated | layout | category | prism_languages | intro | |
---|---|---|---|---|---|---|
AppleScript |
2023-04-05 |
2017/sheet |
macOS |
|
AppleScript is a scripting language for automating macOS. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(() => { | |
ObjC.import('CoreLocation') | |
app = Application.currentApplication() | |
app.includeStandardAdditions = true | |
if (!$['CLLocationManagerDelegate']) { | |
ObjC.registerSubclass({ | |
name: 'CLLocationManagerDelegate', | |
superclass: 'NSObject', | |
protocols: ['CLLocationManagerDelegate'], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(() => { | |
ObjC.import('Foundation'); | |
ObjC.import('Speech'); | |
var app = Application.currentApplication(); | |
if (!$['SFSpeechRecognitionTaskDelegate']) { | |
ObjC.registerSubclass({ | |
name: 'SFSpeechRecognitionTaskDelegate', | |
superclass: 'NSObject', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use framework "Foundation" | |
(* | |
Gets a record of information contain in a plist file. | |
Params: | |
thePath (String) - Path to the plist file. | |
Returns: | |
(Record) - The property:value pairs in the plist. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { closeMainWindow } from "@raycast/api" | |
import { runAppleScript } from "run-applescript" | |
const displayWindow = async () => { | |
console.log(await runAppleScript(`use framework "Foundation" | |
use scripting additions | |
set theWindow to missing value | |
-- Can only display windows on the main thread | |
my performSelectorOnMainThread:"showWindow" withObject:(missing value) waitUntilDone:true |
Title | Prompt |
---|---|
Brainstorm Ideas Based On This | Brainstorm 5 project ideas based on this text: |
Create Action Items | Generate a markdown list of action items to complete based on the following text, using a unique identifier for each item as bold headings. If there are any errors in the text, make actions items to fix them. In a sublist of each item, provide a description, priority, estimated level of difficulty, and a reasonable duration for the task. Here is the text: |
Create Flashcards | Create 3 Anki flashcards based on the following text. Format the response as markdown with the bold questions and plaintext answers. Separate each entry with ‘—‘. Here’s the text: |
Generate Cheatsheet | Generate a concise cheatsheet for the concepts in this text. Add additional details based on your own knowledge of the topic. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "System Events" | |
set theProcess to first application process whose name is "ControlCenter" | |
click menu bar item 2 of menu bar 1 of theProcess | |
perform action 1 of button 1 of group 1 of window 1 of theProcess | |
end tell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use framework "Foundation" | |
use framework "PDFKit" | |
-- Load the PDF file as NSData | |
set thePDFFile to "/Users/exampleUser/Documents/example.pdf" | |
set pdfData to current application's NSData's dataWithContentsOfFile:thePDFFile | |
-- Create a PDFDocument from the PDF data | |
set pdfDoc to current application's PDFDocument's alloc()'s initWithData:pdfData |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use framework "Foundation" | |
property ca : current application | |
set theResult to "" | |
on queryChatGPT(query, openAIKey) | |
global theResult | |
set APIEndpoint to "https://api.openai.com/v1/chat/completions" | |
set theURL to ca's NSURL's URLWithString:APIEndpoint | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use framework "CoreWLAN" | |
set knownNetworkNames to {} | |
set theClient to my CWWiFiClient's sharedWiFiClient() | |
theClient's setDelegate:me | |
-- Get main WiFi interface | |
set theWiFiInterface to theClient's interface() | |
on disconnect() |