import "@johnlindquist/kit"
import * as applescript from 'applescript';
function createAppleNoteScript(content: string) {
  const title = 'Note created on ' + new Date().toLocaleDateString();
  return `
        tell application "Notes"
            tell account "iCloud"
                tell folder "Notes"
                    make new note with properties {name:"${title}", body:"${content}"}
                end tell
            end tell
        end tell
    `;
}
function createAppleNote(content: string) {
  const script = createAppleNoteScript(content);
  applescript.execString(script, (err: Error | null, result: any) => {
    if (err) {
      console.error('Error creating note:', err);
    } else {
      console.log('Note created successfully:', result);
    }
  });
}
const text = await editor("");
createAppleNote(text);