gal9 Posted March 1, 2023 Share Posted March 1, 2023 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 More sharing options...
Developers Jos Posted March 1, 2023 Developers Share Posted March 1, 2023 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 More sharing options...
gal9 Posted March 1, 2023 Author Share Posted March 1, 2023 (edited) 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 March 1, 2023 by gal9 Link to comment Share on other sites More sharing options...
Developers Jos Posted March 1, 2023 Developers Share Posted March 1, 2023 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 More sharing options...
gal9 Posted March 1, 2023 Author Share Posted March 1, 2023 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 More sharing options...
Developers Jos Posted March 1, 2023 Developers Share Posted March 1, 2023 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 More sharing options...
gal9 Posted March 6, 2023 Author Share Posted March 6, 2023 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 More sharing options...
Developers Jos Posted March 6, 2023 Developers Share Posted March 6, 2023 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 More sharing options...
gal9 Posted March 6, 2023 Author Share Posted March 6, 2023 4 minutes ago, Jos said: From the Helpfile Send(), which is more or less similar to your situation: so If I change to ControlSend() it is work without screen session. Link to comment Share on other sites More sharing options...
mistersquirrle Posted March 7, 2023 Share Posted March 7, 2023 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 More sharing options...
Zedna Posted March 8, 2023 Share Posted March 8, 2023 Look here https://www.autoitscript.com/wiki/FAQ#Why_doesn.27t_my_script_work_on_a_locked_workstation.3F Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
gal9 Posted March 20, 2023 Author Share Posted March 20, 2023 On 3/9/2023 at 12:27 AM, Zedna said: Look here https://www.autoitscript.com/wiki/FAQ#Why_doesn.27t_my_script_work_on_a_locked_workstation.3F it is not working i changed all my code to ControlSend and It still doesn't work Link to comment Share on other sites More sharing options...
Developers Jos Posted March 20, 2023 Developers Share Posted March 20, 2023 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 More sharing options...
gal9 Posted March 20, 2023 Author Share Posted March 20, 2023 6 minutes ago, Jos said: Then you have done something wrong. So what can be wrong if use only ControlSend? i see i use WinWaitActive so what can replace it Link to comment Share on other sites More sharing options...
Zedna Posted March 20, 2023 Share Posted March 20, 2023 (edited) Instead of WinWaitActive() use WinWait() as mentioned in my link. Edited March 20, 2023 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
gal9 Posted March 22, 2023 Author Share Posted March 22, 2023 On 3/20/2023 at 5:05 PM, Zedna said: Instead of WinWaitActive() use WinWait() as mentioned in my link. this line is ok? Local $sEditTitle = WinGetTitle("[ACTIVE]") Link to comment Share on other sites More sharing options...
Zedna Posted March 22, 2023 Share Posted March 22, 2023 No because active is only foreground dialog with "Press Ctrl+Alt+Del to unlock ...". No other window can have active/focused status ... gal9 1 Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
gal9 Posted March 26, 2023 Author Share Posted March 26, 2023 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 More sharing options...
Zedna Posted March 26, 2023 Share Posted March 26, 2023 ControlFocus() will not work, other functions are OK. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
gal9 Posted March 27, 2023 Author Share Posted March 27, 2023 (edited) 12 hours ago, Zedna said: ControlFocus() will not work, other functions are OK. so what can I replace? Edited March 27, 2023 by gal9 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now