Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Describe simulator scene with gpt-4-vision #12

Open
elkraneo opened this issue Nov 19, 2023 · 1 comment
Open

Describe simulator scene with gpt-4-vision #12

elkraneo opened this issue Nov 19, 2023 · 1 comment

Comments

@elkraneo
Copy link
Contributor

// Define a function to capture the screen of the Xcode simulator app window
func captureSimulatorWindow() {
    let targetAppName = "Simulator"  // The name of the Xcode simulator app
    
    if let windowList = CGWindowListCopyWindowInfo(.optionOnScreenOnly, kCGNullWindowID) as? [[String: AnyObject]] {
        for window in windowList {
            if let windowOwnerName = window[kCGWindowOwnerName] as? String, windowOwnerName.contains(targetAppName) {
                if let windowID = window[kCGWindowNumber] as? CGWindowID {
                    let screenCaptureSession = ScreenCaptureSession(windowID: windowID)
                    
                    // Start the screen capture session for the Xcode simulator window
                    screenCaptureSession.startCapture { image, error in
                        if let image = image {
                            // Process the captured image
                            // For example, you can save the image to a file
                            saveImageToFile(image: image)
                        } else if let error = error {
                            // Handle the error
                            print("Error capturing the simulator window: \(error.localizedDescription)")
                        }
                    }
                }
            }
        }
    }
}
@elkraneo
Copy link
Contributor Author

Early experimentation here: https://github.com/elkraneo/VisionDescription

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant