Sign in to follow this  
Followers 0
johnfive

Some questions

4 posts in this topic

Hi, i've got a problem with autoitX and php-cli :

When i execute the following script, i've got a problem with @SW_HIDE, maybe with the @.

CODE

<?php

$oShell = new COM("WScript.Shell");

$oAutoIt = new COM("AutoItX3.Control");

$oShell->Run('C:\WINDOWS\NOTEPAD.EXE');

$var = '@SW_HIDE';

$oAutoIt->WinSetState("Sans titre - Bloc-notes", "", $var);

$oAutoIt->WinWait("Sans titre - Bloc-notes","");

$oAutoIt->WinWaitActive("Sans titre - Bloc-notes","");

$oAutoIt->Send("test");

$oAutoIt->Sleep(3000);

$var = '@SW_SHOW';

$oAutoIt->WinSetState("Sans titre - Bloc-notes", "", $var);

?>

I have made this little script to see the possibilities of autoitX with php, but I have this problem :

Fatal error: Uncaught exception 'com_exception' with message 'Parameter 0:

Le type ne correspond pas.

' in C:\hide\php-cli\autoit.php:9

Stack trace:

#0 C:\hide\php-cli\autoit.php(9): com->WinSetState('Sans titre - Bl...', '', '@SW_HIDE')

#1 {main}

thrown in C:\hide\php-cli\autoit.php on line 9

Second question, where i can get documentation about autoitx with PHP-CLI ?

Third question, how can i get the width and the heigh of a computer screen, to know exactly what is the resolution used ?

Thank you.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You are supposed to pass a number, not a string.

$oAutoIt->WinSetState("Sans titre - Bloc-notes", "", $var);

should be

$oAutoIt->WinSetState("Sans titre - Bloc-notes", "", $oAutoIt.SW_HIDE);

etc.

As for documentation, Start>Programs>AutoIt v3>Extras>AutoItX>Help file.

AutoItX does not have a way to read the screen size.

Edited by Richard Robertson

Share this post


Link to post
Share on other sites

Thank you for your answer Richard, but that's doesn't work too !!

I've tried with this script :

CODE

<?php

$oShell = new COM("WScript.Shell");

$oAutoIt = new COM("AutoItX3.Control");

$oShell->Run('C:\WINDOWS\NOTEPAD.EXE');

$oAutoIt->WinSetState("Sans titre - Bloc-notes", "", $oAutoIt.SW_SHOW);

$oAutoIt->WinWait("Sans titre - Bloc-notes","");

$oAutoIt->WinWaitActive("Sans titre - Bloc-notes","");

$oAutoIt->Send("test");

$oAutoIt->Sleep(3000);

$oAutoIt->WinSetState("Sans titre - Bloc-notes", "", $oAutoIt.SW_SHOW);

?>

And the following error is return to me :

CODE

Notice: Use of undefined constant SW_SHOW - assumed 'SW_SHOW' in C:\hide\php-cli\autoit.php on line 7

Catchable fatal error: Object of class com could not be converted to string in C:\hide\php-cli\autoit.php on line 7

I've found the documentation, and if i want get the screen size is only to hide the cursor of the mouse in the corner right down of screen, maybe there are another solution to hide it ?

Thank you.

Share this post


Link to post
Share on other sites

Oh, sorry. That should have been $oAutoIt->SW_SHOW. I put a . instead of a -> because I'm not used to PHP objects.

Share this post


Link to post
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
Sign in to follow this  
Followers 0