// Name: Query Claude and ChatGPT Desktop Apps
// Description: Automatically runs a query in both Claude and ChatGPT desktop applications
// Author: arvindcr4
// GitHub: arvindcr4
import "@johnlindquist/kit"
const query = await arg("Enter your query to send to both AI assistants:")
if (!query.trim()) {
await div(md("No query provided. Exiting..."))
exit()
}
await hide()
// Function to send query to an app
const sendQueryToApp = async (appName: string, query: string) => {
try {
// Focus the app
await applescript(`
tell application "${appName}"
activate
end tell
`)
await wait(1000) // Wait for app to focus
// Type the query
await keyboard.type(query)
await wait(500)
// Press Enter to send
await keyboard.tap(Key.Enter)
return true
} catch (error) {
console.log(`Failed to send query to ${appName}: ${error.message}`)
return false
}
}
// Send to Claude desktop app
const claudeSuccess = await sendQueryToApp("Claude", query)
await wait(2000) // Wait between apps
// Send to ChatGPT desktop app
const chatgptSuccess = await sendQueryToApp("ChatGPT", query)
// Show results
let results = []
if (claudeSuccess) results.push("✅ Claude")
if (chatgptSuccess) results.push("✅ ChatGPT")
if (!claudeSuccess) results.push("❌ Claude (app not found or failed)")
if (!chatgptSuccess) results.push("❌ ChatGPT (app not found or failed)")
await div(md(`
# Query Results
**Query sent:** "${query}"
**Status:**
${results.map(result => `- ${result}`).join('\n')}
${results.filter(r => r.includes('✅')).length === 0 ?
'\n⚠️ Make sure both Claude and ChatGPT desktop apps are installed and accessible.' :
'\n🎉 Query sent successfully! Check the apps for responses.'}
`))