<?php require_once 'vendor/autoload.php'; use PHPBot\DesktopManager\Factory as DesktopManagerFactory; use PHPBot\Keyboard\Keys; use PHPBot\Pointer\MouseButtons; $loop = React\EventLoop\Factory::create(); $dm = DesktopManagerFactory::create($loop); $dm->keyboard()->sendKey(Keys::ENTER())->start()->then(function () use($dm) { echo 'enteroooou'; }); $loop->run();
<?php require_once 'vendor/autoload.php'; use PHPBot\DesktopManager\Factory as DesktopManagerFactory; use PHPBot\Keyboard\Keys; use PHPBot\Pointer\MouseButtons; $loop = React\EventLoop\Factory::create(); $dm = DesktopManagerFactory::create($loop); $pipeline = $dm->createCommandPipeline($dm->keyboard()->type('gnome-terminal'), $dm->keyboard()->sendKey(Keys::ENTER()), $dm->pointer()->moveTo(10, 0), $dm->pointer()->click(MouseButtons::LEFT())); $pipeline->start()->then(function () { echo 'All done'; exit; }); $loop->run();
<?php require_once 'vendor/autoload.php'; use PHPBot\DesktopManager\Factory as DesktopManagerFactory; use PHPBot\Keyboard\Keys; use PHPBot\Pointer\MouseButtons; $loop = React\EventLoop\Factory::create(); $dm = DesktopManagerFactory::create($loop); $dm->createCommandPipeline($dm->keyboard()->sendKeys(Keys::ALT(), Keys::TAB()), $dm->pointer()->moveTo(300, 200), $dm->keyboard()->holdKey(Keys::CTRL()), $dm->pointer()->holdClick(MouseButtons::LEFT()), $dm->pointer()->moveTo(300, 680), $dm->pointer()->releaseClick(MouseButtons::LEFT()), $dm->keyboard()->releaseKey(Keys::CTRL()))->start()->then(function () { echo 'done'; }); $loop->run();