Jump to content

autoit_php - access autoit functions from php


HansHenrik
 Share

Recommended Posts

here's some PHP code to access AutoIt functions from php: 
https://github.com/divinity76/autoit_php -
 

as of writing, only 5 functions are added: MouseMove and MouseClick and _ScreenCapture_Capture and WinWaitActive and Send,

it also has support for running in Cygwin (which is where i've developed it, but it *should*, in theory, run on normal php-cli for windows as well.), is there any community interest for this? 

 

example usage

<?php
require_once("autoit.class.php");
$au = new AutoIt();
$au->MouseMove(10, 10, 5);
$au->MouseClick("left");
echo "waiting up to 5 seconds for notepad window..";
if($au->WinWaitActive("[CLASS:Notepad]","",5)){
    echo "found notepad!\n";
    $au->Send("hello from autoit_php");
}else{
    echo "timed out while waiting for notepad.\n";
}
$imageBinary = $au->_ScreenCapture_Capture();
var_dump(strlen($imageBinary), imagecreatefromstring($imageBinary));
 



(i wanted to use some autoit functions from php-cli, and google wasn't of much help this time..)

Edited by HansHenrik
Link to comment
Share on other sites

  • 1 year later...

i'm considering re-writing it using an stdin read + eval() -loop, 
the current "start a new instance of AutoIt for every command"-approach cannot (as far as i can think of..) support keeping handles around, like DllOpen() & co, but an eval-loop could do that

 

i know Eval() should usually be avoided, but.. can't think of a better way to do it either

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...