Jump to content

headless with AutoItX


gal9
 Share

Recommended Posts

Hi everyone,
I try to work with AutoIt in vm and I try to do it in headless mode. AutoIt works only if  rdp connects and I try to do headless mode I read and see I can do it with AutoItX I have this folder "C:\Program Files (x86)\AutoIt3\AutoItX" and I have the dll

but in "C:\Program Files (x86)\AutoIt3\Include" i don't see "AutoItX3_DLL.au3"

i try use notepad 

#include <AutoItX3_DLL.au3>

AutoItX3_Init()
AutoItX3_Run("notepad.exe")
AutoItX3_WinWaitActive("Untitled - Notepad")
AutoItX3_ControlSend("Untitled - Notepad", "", "[CLASS:Edit; INSTANCE:1]", "Hello, world!")
AutoItX3_Send("{ALTDOWN}{F4}{ALTUP}")
AutoItX3_WinWaitClose("Untitled - Notepad")
AutoItX3_Exit()

but i get an error

!->Includefile <AutoItX3_DLL.au3> not found.
>Running AU3Check (3.3.16.1)  from:C:\Program Files (x86)\AutoIt3  input:C:\Users\autotest\Desktop\notpad.au3
"C:\Users\autotest\Desktop\notpad.au3"(1,10) : error: can't open include file <AutoItX3_DLL.au3>.
#include <AutoItX3_DLL.au3>
~~~~~~~~~^
"C:\Users\autotest\Desktop\notpad.au3"(3,16) : error: AutoItX3_Init(): undefined function.
AutoItX3_Init()
~~~~~~~~~~~~~~~^
"C:\Users\autotest\Desktop\notpad.au3"(4,28) : error: AutoItX3_Run(): undefined function.
AutoItX3_Run("notepad.exe")
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\autotest\Desktop\notpad.au3"(5,45) : error: AutoItX3_WinWaitActive(): undefined function.
AutoItX3_WinWaitActive("Untitled - Notepad")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\autotest\Desktop\notpad.au3"(6,92) : error: AutoItX3_ControlSend(): undefined function.
AutoItX3_ControlSend("Untitled - Notepad", "", "[CLASS:Edit; INSTANCE:1]", "Hello, world!")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\autotest\Desktop\notpad.au3"(7,38) : error: AutoItX3_Send(): undefined function.
AutoItX3_Send("{ALTDOWN}{F4}{ALTUP}")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\autotest\Desktop\notpad.au3"(8,44) : error: AutoItX3_WinWaitClose(): undefined function.
AutoItX3_WinWaitClose("Untitled - Notepad")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\autotest\Desktop\notpad.au3"(9,16) : error: AutoItX3_Exit(): undefined function.
AutoItX3_Exit()
~~~~~~~~~~~~~~~^
C:\Users\autotest\Desktop\notpad.au3 - 8 error(s), 0 warning(s)
!>13:16:51 AU3Check ended. Press F4 to jump to next error.rc:2

 

Link to comment
Share on other sites

  • Developers

I think you are confused about what AutoItX3 exactly is: From the Helpfile in that dirtectory:

Quote

AutoItX is a DLL version of AutoIt v3 that provides a subset of the features of AutoIt via an ActiveX/COM and DLL interface. This means that you can add AutoIt-like features to your favourite scripting and programming languages, e.g. VB, VBScript, Delphi, C, C++, Kixtart, and most other languages that support the use of DLLs.

So are you trying to make an AutoIt3 Script or do you want to use some AutoIt3 function in another program/script language?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

4 minutes ago, Jos said:

I think you are confused about what AutoItX3 exactly is: From the Helpfile in that dirtectory:

So are you trying to make an AutoIt3 Script or do you want to use some AutoIt3 function in another program/script language?

i call the script from the python controller but i want the autoit to run in headless mode. and I will don't need to open the machine in RDP. for now the autoit run only if i in RDP. i compile code and call the exe i want to run the autoit without RDP

Edited by gal9
Link to comment
Share on other sites

  • Developers

Maybe you need to read my reply again as it doesn't answer the basic question. You either use the  AutoItX3 dll in Python or creat a nor AutoIt3 script which you can compile...  

The posted source is totally invalid so I have no clue where you got that information from.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

1 minute ago, Jos said:

Maybe you need to read my reply again as it doesn't answer the basic question. You either use the  AutoItX3 dll in Python or creat a nor AutoIt3 script which you can compile...  

The posted source is totally invalid so I have no clue where you got that information from.

ok, I understand AutoItX3 is not for headless mode. AutoItX is a DLL file that provides the ability to use AutoIt functions in other programming languages. but how can i do headless mode in my situation

Link to comment
Share on other sites

  • Developers
1 hour ago, gal9 said:

ok, I understand AutoItX3 is not for headless mode.

I think you misunderstand the whole not supporting headless thing!  Some commands will not work without a screen like Send() as those used windows functions require a screen session.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

On 3/1/2023 at 5:26 PM, Jos said:

I think you misunderstand the whole not supporting headless thing!  Some commands will not work without a screen like Send() as those used windows functions require a screen session.

ok if i use the "ControlSend" function instead of "Send"? because I read sends keystrokes directly to a specified control within a window

Link to comment
Share on other sites

  • Developers

From the Helpfile Send(), which is more or less similar to your situation:

Quote

When running a script on a remote computer through a program as psexec (www.sysinternals.com) or beyondexec (www.beyondlogic.org) it is necessary, specially when sending strokes to a program launch by the script with a Run() function, to use ControlSend() or other ControlXXX functions to directly communicate with the control. Send() even with Opt("SendAttachMode", 1) will not work.

 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

I have encountered some issues with using AutoIt on a work VM to do some Send and MouseClick while my RDP session was disconnected. The main problem is that when you do not have a monitor connected, or a RDP session, you do not have a... resolution? There's is no desktop 'window', things sort of stop existing in the same context as when you have a monitor or RDP session connected. I don't have a good way to describe it.

Anyways, my solution to this to allow things to still process and work while I wasn't connected to the RDP myself, was to connect the VM to itself through RDP. Yeah, it's weird, and I haven't automated having it connect to itself when no one else is connected. But before I turn off my computer I start a new RDP session on the VM to the VM, which then disconnects my RDP session because someone else (the VM itself) connected. Since it's connected and the RDP connection is able to create a virtual desktop/monitor/resolution, things like MouseClick, Send, and I assume everything else work.

We ought not to misbehave, but we should look as though we could.

Link to comment
Share on other sites

  • 2 weeks later...
  • Developers
24 minutes ago, gal9 said:

it is not working i changed all my code to ControlSend and It still doesn't work

Then you have done something wrong. ;) 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

On 3/22/2023 at 3:17 PM, Zedna said:

No because active is only foreground dialog with "Press Ctrl+Alt+Del to unlock ...".

No other window can have active/focused status ...

Now i change my script so i don't know what function use active status?
ControlListView

ControlTreeView

ControlFocus

ControlGetHandle

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...