feat(native): implement Phase 5 AppleScript handlers and remote control
- Implemented specialized PowerPoint/Keynote handlers with auto-focus and slideshow start. - Added native:control-presentation for remote navigation (next/prev/stop). - Added native:list-tools handler for self-documenting the bridge API. - Added a comprehensive project README.md.
This commit is contained in:
@@ -90,15 +90,37 @@ export function registerFileHandlers() {
|
||||
});
|
||||
}
|
||||
|
||||
if (os.platform() === 'darwin' && ext === 'key') {
|
||||
console.log(`Native: Launching Keynote via AppleScript for ${target}`);
|
||||
const script = `tell application "Keynote" to open POSIX file "${target}"`;
|
||||
return new Promise((resolve) => {
|
||||
exec(`osascript -e "${script.replace(/"/g, '\"')}"`, (err) => {
|
||||
if (err) resolve({ success: false, error: err.message });
|
||||
else resolve({ success: true });
|
||||
if (os.platform() === 'darwin') {
|
||||
let script = '';
|
||||
if (ext === 'key') {
|
||||
script = `
|
||||
tell application "Keynote"
|
||||
activate
|
||||
open (POSIX file "${target}")
|
||||
delay 1
|
||||
start (front document)
|
||||
end tell
|
||||
`;
|
||||
} else if (ext === 'pptx' || ext === 'ppt') {
|
||||
script = `
|
||||
tell application "Microsoft PowerPoint"
|
||||
activate
|
||||
open (POSIX file "${target}")
|
||||
delay 1
|
||||
run slide show of active presentation
|
||||
end tell
|
||||
`;
|
||||
}
|
||||
|
||||
if (script) {
|
||||
console.log(`Native: Launching ${ext} via AppleScript for ${target}`);
|
||||
return new Promise((resolve) => {
|
||||
exec(`osascript -e "${script.replace(/"/g, '\\\\"')}"`, (err) => {
|
||||
if (err) resolve({ success: false, error: err.message });
|
||||
else resolve({ success: true });
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,4 +131,4 @@ export function registerFileHandlers() {
|
||||
return { success: false, error: error.message };
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user