Safe Haskell | None |
---|
The main Robot interface.
- data Robot a
- runRobot :: Robot a -> IO a
- runRobotWithConnection :: Robot a -> Connection -> IO a
- module Test.Robot.Types
- class Pressable x where
- moveBy :: Int -> Int -> Robot ()
- moveTo :: Int -> Int -> Robot ()
- hold :: Pressable x => x -> Robot a -> Robot a
- tap :: Pressable x => x -> Robot ()
- releaseAll :: Robot ()
- sleep :: Rational -> Robot ()
Running your robot
The Robot monad: a reader monad over IO.
runRobotWithConnection :: Robot a -> Connection -> IO aSource
Run the robot using an existing connection.
Key and button constants
module Test.Robot.Types
Doing things
Basic operations
Represents things that can be pressed: either a key on a keyboard or a button on a mouse.
Derived operations
hold :: Pressable x => x -> Robot a -> Robot aSource
hold x act
holds down x
while executing act
. It is equivalent
to the code:
press x act release x
For example, you type some text in ALL CAPS using:
hold _Shift $ mapM_ tap [_D, _U, _C, _K, _S]
Miscellaneous
releaseAll :: Robot ()Source
Release all the keys and buttons, in case some were left held down.
This is called automatically before runRobot
returns.