kcvinu Posted November 27, 2022 Share Posted November 27, 2022 Hi all, I have a script which shows a GUI. I want to run this script in command prompt. Now I can run it with this command autoit3 my_script.au3 But I am not getting the program outputs in CMD. Is there any command switches for that ?. For some specific reasons, I don't want to use Scite editor or other editors. Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only) Link to comment Share on other sites More sharing options...
Nine Posted November 27, 2022 Share Posted November 27, 2022 Compile it with the directive : #AutoIt3Wrapper_Change2CUI=y Run from DOS console. Use ConsoleWrite to send messages to console. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
kcvinu Posted November 27, 2022 Author Share Posted November 27, 2022 (edited) @Nine, Thank you for the reply. I tried your suggestions but still I am facing the same problem. The command is working and my gui is running. But no outputs in CMD. This is my command.AutoIt3 "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrStdOut /in app.au3 Edited November 27, 2022 by kcvinu Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only) Link to comment Share on other sites More sharing options...
Developers Jos Posted November 27, 2022 Developers Share Posted November 27, 2022 That is because autoit3.exe isn't an console program, so the idea is you compile with that directive to make it 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...
kcvinu Posted November 29, 2022 Author Share Posted November 29, 2022 (edited) @Jos, I added "#AutoIt3Wrapper_Change2CUI=y" in the first line of my autoit source file. I think that is what Nine suggested. Please correct me if I am wrong. But still no outputs are in console. But the program is running. Edited November 29, 2022 by kcvinu Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only) Link to comment Share on other sites More sharing options...
pixelsearch Posted November 29, 2022 Share Posted November 29, 2022 (edited) <deleted> Edited November 29, 2022 by pixelsearch I thought OP was using Scite-Lite but it's not the case Link to comment Share on other sites More sharing options...
Developers Jos Posted November 29, 2022 Developers Share Posted November 29, 2022 That directive only makes the compiled program cui .. so running it with that directive doesn't do anything! 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...
jchd Posted November 30, 2022 Share Posted November 30, 2022 If you want to be able to display a console and write there in all 4 cases (GUI or CUI, compiled or not) you just need to use this: Func CW($s = "") If @Compiled Then _CUI_ConsoleWrite($s) Else _ConsoleWrite($s) EndIf EndFunc ;==>CW Func _CUI_ConsoleWrite(ByRef $s) Local Static $hDll = DllOpen("kernel32.dll") Local Static $hCon = __CUI_ConsoleInit($hDll) DllCall($hDll, "bool", "WriteConsoleW", "handle", $hCon, "wstr", $s & @LF, "dword", StringLen($s) + 1, "dword*", 0, "ptr", 0) Return EndFunc ;==>_CUI_ConsoleWrite ; internal use only Func __CUI_ConsoleInit(ByRef $hDll) DllCall($hDll, "bool", "AllocConsole") ;~ DllCall("Kernel32.dll", "bool", "SetConsoleCP", "uint", 65001) ;~ DllCall("Kernel32.dll", "bool", "SetConsoleOutputCP", "uint", 65001) Return DllCall($hDll, "handle", "GetStdHandle", "int", -11)[0] EndFunc ;==>__CUI_ConsoleInit ; Unicode-aware ConsoleWrite Func _ConsoleWrite(ByRef $s) ConsoleWrite(BinaryToString(StringToBinary($s & @LF, 4), 1)) EndFunc ;==>_ConsoleWrite CW($text) outputs the string $text to the (resp. a new) console if compiled for CUI (reps. GUI) or the SciTE console if not compiled. kcvinu 1 This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
kcvinu Posted November 30, 2022 Author Share Posted November 30, 2022 @jchd, Thank your for the code. Let me try it. I will inform you soon. Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only) Link to comment Share on other sites More sharing options...
Zedna Posted November 30, 2022 Share Posted November 30, 2022 (edited) Just important note: If you use directive #AutoIt3Wrapper_Change2CUI=y then you must compile such script with FULL Scite4Autoit3 and not only in standard Scite editor included in base Autoit instalator. EDIT: and of course you must use ConsoleWrite(...) 🙂 Edited November 30, 2022 by Zedna kcvinu 1 Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Zedna Posted November 30, 2022 Share Posted November 30, 2022 For inspiration look at my CUI progressbar example: Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
kcvinu Posted December 1, 2022 Author Share Posted December 1, 2022 @Zedna, Thank you for your suggestion. I think I need to explain a little more on this issue. So this is the scenario. I am writing a gui library based on win32 api functions like CreateWindowEx and it's siblings. But I am using the Autoit's message loop. I am just creating a window with "GuiCreate" function and replacing it's WndProc function with my own function. But then the controls like button, label etc. are creating with CreateWindowEx function. So I want to check the code is working or not. And I am using ConsoleWrite function for that. It is handy when you move your mouse over a window and then it prints some nice messages in console. This is perfectly fine in SciTE editor. You will get live outputs in console. But I am using VS Code. Currently I am using Damien's extension, but I would like to run my code in my favorite console emulator ConEmu64. Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only) 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