Skip to content

Instantly share code, notes, and snippets.

@Enchan1207
Created April 10, 2021 06:28
Show Gist options
  • Save Enchan1207/9bacb5f9fc48ba902b91543ff10f863c to your computer and use it in GitHub Desktop.
Save Enchan1207/9bacb5f9fc48ba902b91543ff10f863c to your computer and use it in GitHub Desktop.
Swiftでマウスを動かす
//
// main.swift
// MousemoveEx
//
// Created by EnchantCode on 2021/04/10.
//
import Foundation
import CoreGraphics
let mainDisplayID = CGMainDisplayID()
let destination: CGPoint = .init(x: 100, y: 100)
let result = CGDisplayMoveCursorToPoint(mainDisplayID, destination)
switch result{
case .success:
print("success!")
default:
print("unknown: \(result)")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment