hsautogui: Haskell bindings for PyAutoGUI, a library for automating user interaction

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

Please see the README on GitHub at https://github.com/mitchellvitez/hsautogui#readme


[Skip to Readme]

Properties

Versions 0.1.0, 0.2.0, 0.2.0, 0.3.0
Change log changelog.md
Dependencies base (>=4.7 && <5), containers, cpython (>=3.5), hsautogui, mtl, template-haskell, text [details]
License BSD-3-Clause
Copyright 2020 Mitchell Vitez
Author Mitchell Vitez
Maintainer mitchell@vitez.me
Category Automation
Home page https://github.com/mitchellvitez/hsautogui#readme
Bug tracker https://github.com/mitchellvitez/hsautogui/issues
Source repo head: git clone https://github.com/mitchellvitez/hsautogui
Uploaded by MitchellVitez at 2021-01-02T05:52:49Z

Modules

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for hsautogui-0.2.0

[back to package description]

hsautogui

Haskell bindings for PyAutoGUI

About

These are straightforward Haskell bindings for PyAutoGUI, a library for automating user interaction tasks, using haskell-cpython.

This is just about the simplest possible example:

import AutoGUI
main = runAutoGUI $ write "Hello, world!"

This doesn't just print Hello, world! to the screen, but instead simulates a user typing it in.

Language Comparison

When using this library, the following Haskell and Python examples do the same thing:

import AutoGUI
import Control.Monad.IO.Class (liftIO)

main :: IO ()
main = do
  putStrLn "3 seconds until beeping begins"
  sleep 3
  runAutoGUI $
    forM_ [1..100] $ \i -> do
      write "beep"
      press [key|enter|]
      liftIO $ sleep 0.5
import pyautogui
import time

print('3 seconds until beeping begins')
time.sleep(3)

for i in range(1, 101):
    pyautogui.write('beep')
    pyautogui.press('enter')
    time.sleep(0.5)

Constructing a Key

Because not all valid Texts are valid Keys, we need a way to check that Keys are valid when creating them. This leads to mkKey :: Text -> Maybe Key. However, using the key quasiquoter, we can sidestep having to use Maybe by catching invalid keys at compile time. For example, [key|backspace|] is a valid Key which we can construct and check at compile time.

This is especially useful for some data that looks like this, where there are way too many values (and values with strange characters) for a sum type to be especially handy, but we want to check validity in some way. We generally know which keys we want to use at compile time.

Overview

General

Debug

Info

Keyboard

Keys

MessageBoxes

Mouse

Screen