Jump to content

Search the Community

Showing results for tags 'console'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office


  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office


  • Forum
  • AutoIt


  • Community Calendar

Found 21 results

  1. Use this UDF to add a console gui to your script (with log file): It uses the Hidden Autoit window (that you probably didn't even know existed) Closing Console window will terminate script. example of console: #include-once #include <GuiEdit.au3> EnableConsoleGui("example.log") ;example: ;------------------------ ConsoleWrite ("Hello World") For $i = 1 To 10 ConsoleWrite (".") Sleep(200) Next ConsoleWrite ("done") ConsoleWrite(@CRLF) ConsoleWrite ("close me to exit"&@CRLF) While 1 Sleep(1000) WEnd ;------------------------ ;end of example code Func EnableConsoleGui($Logfile="") ;EnableConsoleGUI ;by Daniel Barnes 20/04/2018 ;Uses AutoIt's Hidden window as a console (output only) Global $pidChild ;if we don't have a parent (as the parent window would have our script name) If Not WinExists(StringTrimRight(@ScriptName,4)) Then Opt("TrayIconHide",1) ;get Autoit's hidden window handle local $hWnd = WinGetHandle(AutoItWinGetTitle()) ;move the autoit hidden window to the middle of the screen WinMove($hWnd, "", (@DesktopWidth / 2) - 250, (@DesktopHeight / 2) - 250, 500, 500) ;get the Handle of the edit box in Autoit's hidden window $hEditBox = ControlGetHandle($hWnd,"","[CLASS:Edit; INSTANCE:1]") ;show it WinSetState($hWnd, "", @SW_SHOW) ;set its title = our script name WinSetTitle($hWnd,"",StringTrimRight(@ScriptName,4)) ;Spawn a child "copy" of the script, enabling reading of its console... If @Compiled Then ;2 = $STDOUT_CHILD. This avoids requiring the AutoItConstants.au3 in this sample code $pidChild= Run( FileGetShortName(@ScriptFullPath),@ScriptDir,"",2) Else ;2 = $STDOUT_CHILD. This avoids requiring the AutoItConstants.au3 in this sample code $pidChild= Run( FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath),@ScriptDir,"",2) EndIf OnAutoItExitRegister("EnableConsoleGui_CloseChildPID") ;read the console, while the child window exists (and the console window is visible) While ProcessExists($pidChild) $ConsoleRead = StdoutRead($pidChild) If $ConsoleRead then $text = StringLeft(ControlGetText($hWnd,"",$hEditBox),65535) If $Logfile Then FileWrite($Logfile,$ConsoleRead) $text &= $ConsoleRead ControlSetText($hWnd,"",$hEditBox,$text) ConsoleWrite($ConsoleRead) ;scroll to bottom of console edit window _GUICtrlEdit_SetSel($hEditBox, 65535, 65535) endif Sleep(250) WEnd exit endif EndFunc Func EnableConsoleGui_CloseChildPID() ;if this func isn't used ;when you close the console gui ;the child "clone" of your script will keep running ProcessClose($pidChild) EndFunc
  2. ConsoleReader

    Hi. While programming I often use ConsoleWrite() for debugging. If the script isn’t to big I often don’t do extra logging but let my ConsoleWrite()’s inside. Sometimes difficulties appear later when @compiled and weeks are gone. So my first thought often is let’s run the script and catch the console outs of my script. So I coded a console reader. There are two ways to start the buggy script. First via $cmdline send to the reader and second with drag’n’drop onto the readers gui. #include <AutoItConstants.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <ColorConstants.au3> #include <StaticConstants.au3> #include <array.au3> #include <WinAPIProc.au3> #include <GuiEdit.au3> #include <GuiRichEdit.au3> Opt("GUIOnEventMode", 1) Global $data = "" Global $g_aPID = [0] Global $g_bFreeze = False Global $g_iZaehler = 0 Global $g_hGUI = GUICreate("Console: StdoutRead" , 800, 800, -1, -1, $WS_OVERLAPPEDWINDOW + $WS_CLIPCHILDREN, $WS_EX_ACCEPTFILES) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") Global $text = GUICtrlCreateEdit("",10,30,780,760, $ES_AUTOVSCROLL + $WS_VSCROLL + $ES_READONLY + $ES_NOHIDESEL) GUICtrlSetState(-1, $GUI_DROPACCEPTED); + $GUI_FOCUS) GUICtrlSetFont(-1, 9, -1, -1, "Lucida Console") GUICtrlSetResizing(-1, $GUI_DOCKBORDERS) GUISetOnEvent($GUI_EVENT_DROPPED, "_Dropped") _GUICtrlEdit_SetLimitText($text, 8388608) ; a filesize about 1mb Global $g_LaZeilen = GUICtrlCreateLabel("Zeilen: " & StringFormat("% 5d", $g_iZaehler), 680, 10, 100, 9, $SS_LEFTNOWORDWRAP, $WS_EX_LAYERED) GUICtrlSetFont(-1, 9, -1, -1, "Lucida Console") GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKSIZE) Global $g_hCbFreeze = GUICtrlCreateCheckbox("&Freeze", 13, 5, 90) GUICtrlSetFont(-1, 9, -1, -1, "Lucida Console") GUICtrlSetResizing(-1, $GUI_DOCKALL) GUICtrlSetOnEvent($g_hCbFreeze, "_Freeze") Global $g_hBuCopy = GUICtrlCreateButton("&Copy All", 125, 5, 70, 20) GUICtrlSetFont(-1, 9, -1, -1, "Lucida Console") GUICtrlSetResizing(-1, $GUI_DOCKALL) GUICtrlSetOnEvent($g_hBuCopy, "_Copy") GUISetState(@SW_SHOW) If $CmdLine[0] > 0 Then _ViaCmdline() _GUICtrlEdit_AppendText($text, $CmdLine[1] & @CRLF) EndIf Global $sText = StringFormat("% 5d", $g_iZaehler) & @TAB _GUICtrlEdit_AppendText($text, $sText) Local $nextline While 1 If $g_aPID[0] > 0 Then $nextline = _ConsoleReadLine() $nextline = StringReplace($nextline, @CRLF, @CRLF & StringFormat("% 5d", $g_iZaehler) & @TAB) $sText = $nextline If $g_bFreeze = False Then _GUICtrlEdit_AppendText($text, $sText) EndIf GUICtrlSetData($g_LaZeilen, "Zeilen: " & StringFormat("% 5d", $g_iZaehler)) EndIf _ProcessExist() WEnd #region - Funcs Func _ConsoleReadLine() Local $Result,$crPos While True _ProcessExist() For $i = 1 To $g_aPID[0] $data &= StdoutRead($g_aPID[$i]) If @error Then ExitLoop Next $crPos = StringInStr($data, @CRLF) If $crPos Then $Result = StringLeft($data, $crPos) & @CRLF $data = StringRight($data, StringLen($data) - $crPos) $g_iZaehler += 1 Return $Result EndIf WEnd Return SetError(1, 1, $data) EndFunc Func _Dropped() Local $hPID = Run(@GUI_DragFile, "", Default, $STDERR_MERGED) ConsoleWrite("DROP: " & $hPID & " " & @GUI_DragFile & @CRLF) _ArrayAdd($g_aPID, $hPID) $g_aPID[0] = UBound($g_aPID) - 1 EndFunc Func _ViaCmdline() Local $hPID = Run($CmdLine[1], "", Default, $STDERR_MERGED) ConsoleWrite("CMDLINE: " & $hPID & " " & $CmdLine[1] & @CRLF) _ArrayAdd($g_aPID, $hPID) $g_aPID[0] = UBound($g_aPID) - 1 EndFunc Func _Freeze() $g_bFreeze = Not $g_bFreeze ConsoleWrite("FREEZE: " & $g_bFreeze & @CRLF) GUICtrlSetState($text, $GUI_FOCUS) EndFunc Func _Copy() ConsoleWrite("COPY" & @CRLF) ClipPut(GUICtrlRead($text)) EndFunc Func _ProcessExist() For $i = $g_aPID[0] To 1 Step - 1 If Not ProcessExists($g_aPID[$i]) Then ConsoleWrite("GONE: " & $g_aPID[$i] & @CRLF) _ArrayDelete($g_aPID, $i) $g_aPID[0] = UBound($g_aPID) - 1 EndIf Next EndFunc Func _Exit() If $CmdLine[0] = 0 Then ; if reader is started by $cmdline then no script will exit but reader For $i = 1 To $g_aPID[0] ConsoleWrite("KILL: " & $g_aPID[$i] & " " & _WinAPI_GetProcessFileName($g_aPID[$i]) & @CRLF) ProcessClose($g_aPID[$i]) Next EndIf ConsoleWrite("EXIT" & @CRLF) Exit EndFunc #endregion Funcs Maybe someone will find it useful too. One last remark. If only one script is given via $cmdline to the reader no scripts will exit if consolereader exits. But otherwise all scripts dropped onto the readers gui will exit too. This is by design. If you want to change this do it inside func _exit(). Regards, Conrad P.S. Possibly some #includes are not necessary anymore but have been while scripting.
  3. I am running the tomcat batch file through autoit and need to wait until the below line I get in console output. But when I am trying to read the console output using the ProcessEx UDF, I am getting only the partial output. So, can you please suggest how to handle this.
  4. Hi everyone! I want to programmatically alter the structure of a large number of PDF which have different sizes and orientation, and come from different generators. To do this I need to be able to capture different parameters describing their layout. I use a console tool called pdfInfo (part of the xpdf public domain suite) which provides me with everything I need. The idea is first to run pdfInfo against my pdf file redirecting the console's output to a text file. And then to load and parse the text file to get the parameters I need. The only problem is that no output file is ever created. I've looked through the forums and saw a number of threads loosely related to this but none of the suggested solutions (like using StdoutRead) has worked for me. I should say maybe that I'm running Win10. So here's the code that doesn't work: $pdfInfo = "f:\pdfinfo.exe" $pdfTest = "f:\test.pdf" RunWait(chr(34) & $pdfInfo & " -box " & $pdfTest & " > f:\log.txt", "", @SW_HIDE) If you use in a console the command line: f:\pdfinfo.exe -box f:\test.pdf > f:\log.txt it works perfectly. But the piece of code above does not create the log.txt file. So any idea what I am doing wrong. Thanks for any help!
  5. I am running my compiled application as a console application and need to prevent any internal errors from being displayed as a gui message, but rather display it as a console message only. An example of such an error would be a bad array reference (out of bounds). Does anyone know how to do this or point me in the right direction?
  6. I normally launch things silently, but now I want to launch a batch (.cmd) file and have it run as normal displaying it's standard output to the user. Whether I use ShellExecuteWait or RunWait, the command prompt window is displayed, but the output is blank (although I know that the batch file is processing normally because it also produces a log file). If this is because AutoIt is re-directing the standard I/O of the batch file/console window, is there a way I can bypass the I/O redirection? Thanks, TXTechie
  7. Hi, I updated to the last version. Since then a lot of functions are not working. For instance expanding abbreviation. My au3abbrev.properties are correct and abbrev.properties are including both import lines. The abbreviation is red but won't expand. Neither with space nor Ctrl+B. Debug to msgbox and console not working, list functions, jump to function, open include too. SciTE Jump works. Block and box comment too. I have the feeling all functions especially for autoit are not working. Any help? Regards, Conrad
  8. I have an app that rips .ts files, but I'm having a problem seeing the the error message ffmpeg is displaying because the console window closes right after the message is rendered. If I manually type the equivalent command from the command line, the .ts file rips ok, so I'm guessing it's not the command itself that is the issue. How do I get the console window to remain open when running it through my autoIt app? Code in question... Thanks Source code.exe
  9. Hello, I have a console application that works with command line arguments which I don't have its source code, & I want to create a GUI for it to make it easier. My problem is how to make the GUI application calls the console application & handle its output results to display it in the GUI application with a progressbar or somthing ? Please look at the "X265 Command Line Options" https://x265.readthedocs.org/en/default/cli.html MeGUI is only a GUI app for the cli apps : http://sourceforge.net/p/meguimodproj/code/HEAD/tree/MeGUI Mod/ Help me please
  10. Hi everyone Can someone guide me to the right direction with this question? I need a simple example for getting the mouse coordinates and other input events (using api calls, not mousegetpos) on a console window (return the x and y cell) https://msdn.microsoft.com/en-us/library/windows/desktop/ms684239(v=vs.85).aspx UDF link where I get the code from: https://github.com/MattDiesel/au3-console/blob/master/Console.au3 A c++ example that does exactly what i'm looking for: https://msdn.microsoft.com/en-us/library/windows/desktop/ms685035(v=vs.85).aspx The code in the attachments helps a lot but I don't quite understand it, what code of it is necessary and is there a way more 'simple/less code' way to do this (like the c++ example) Thanks, TheAutomator test.au3
  11. A fullscreen console with custom commands! Introduction: Hi everyone! This funny project started as a question in the help section: https://www.autoitscript.com/forum/topic/174404-edit-detect-key-before-updating-content/ I'd like to share this script with everyone that is interested. Why would I want it? You like the old style fullscreen console (like in the old day's), You can add custom commands, You can customize the font a lot more compared to cmd.exe, You can share ideas or add tweaks to the script. Still to do: Write a simple custom programming language to implement this tool. Writing a little help file / pdf to describe my little programming language. Add little sound effects like a beep if there is a syntax error (optional). Clean up and modify Console.Au3 content. Add an option to have to type a login password (optional). Make an optional installer that also gives scripts for this tool a custom icon and open with command. ...Call Neo? Thanks to: xxaviarxx: debugging, some ideas. jguinch: debugging, adding a bunch of tweaks and ideas. kylomas: debugging, new ideas. Edits and updates: Added usage of tab key in edit control Edit has focus now on startup I'm currently rewriting a simple custom programming language to implement this tool. UDF download: Console.au3 Regards TheAutomator
  12. Hi all, Sometimes we need to know instantly what our array contains. For this, i have made a little function to print your array in console. You may use this function in MsgBox too. Here is the code. #cs ---------------------------------------------------------------------------- AutoIt Version: Author: kcvinu Script Function: Sometimes we need to see what an array or a list contains. And this script will help you to see the all elements without a loop Example : If you have an array like this = Local $MyArray[4] = ['Red','Green','Blue','Yellow'] You need to use the fuction like this = PrintList($MyArray) Result : It will print your Array in Console like this [Red,Green,Blue,Yellow] Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here Func PrintList($List) If IsArray($List) Then Local $txt = "" For $i = 0 to UBound($List) -1 $txt = $txt & "," & $List[$i] Next Local $out = StringMid($txt,2) Global $Result = "[" & $out & "]" ConsoleWrite($Result) Return $Result Else MsgBox(0, "List Error", "Variable is not an array or a list") EndIf EndFunc ;==>PrintList PrintList.au3
  13. Hi All, I've been experimenting with the colour options for the SciTE script editor included with AutoIT's full installation, and seem to be having a bit of trouble achieving the colours I'm after.... After reading the given documentation for ConsoleWrite (the function i'm trying to use), I can see that the default colours are chosen with the following parameters: ! = Red > = Blue - = Orange + = Green However, I'm receiving the following; As you can see, the output is still formatted with colours, Only they're not what I was expecting. I assume this is a setting in SciTE rather than the AutoIT language, Has anyone come across any settings within SciTE regarding console colouring? I've been through various properties and settings for SciTE. but can't seem to find anything that references console or colour. May sound like i'm grasping at straws a bit here, But I'm after formatting certain outputs with red text more than anything. Any help is greatly appreciated. Kind Regards Javi.
  14. Hello, I'm having some troubles using hotkeyset() in a console window.. Is it my fault or is it just not possible? (using the 'Console.au3' UDF here) #include <Console.au3> HotKeySet('{ESC}','stop') Global $input While True Cout("Enter your name: ") cin($input) system("pause") WEnd Func stop() exit EndFunc Thanks. TheAutomator.
  15. How do you read the STDout stream from an already running process? I know you can launch a program via run() with flags to get the SDTout stream, but being able to change and re-run a script without needing to restart the running process would be very useful In this thread, it is suggested that one could use the GetStartupInfo methiod, but I'm not sure how to call it or what dll it's in '?do=embed' frameborder='0' data-embedContent>> Edit: Here is my attempt at changing it to autoit. I'm confused as to how you're supposed to specify what process you're trying to get the stream of, and am probably doing it wrong. $STARTUPINFO=DllStructCreate("" & _ "DWORD cb;" & _ "ptr lpReserved;" & _ "ptr lpDesktop;" & _ "ptr lpTitle;" & _ "DWORD dwX;" & _ "DWORD dwY;" & _ "DWORD dwXSize;" & _ "DWORD dwYSize;" & _ "DWORD dwXCountChars;" & _ "DWORD dwYCountChars;" & _ "DWORD dwFillAttribute;" & _ "DWORD dwFlags;" & _ "USHORT wShowWindow;" & _ "USHORT cbReserved2;" & _ "ptr lpReserved2;" & _ "HANDLE hStdInput;" & _ "HANDLE hStdOutput;" & _ "HANDLE hStdError;") DllCall("Kernel32.dll","none","GetStartupInfo","ptr",DllStructGetPtr($STARTUPINFO)) $handle = DllStructGetData($STARTUPINFO,"hStdOutput") #include <Constants.au3> Local $line While 1 $line = StdoutRead($handle) If @error Then ExitLoop if StringLen($line) > 3 Then ConsoleWrite($line) WEnd I appreciate any help
  16. I created many programs designed AutoIT, Update it through my FTP server and web site. The process of compiling and sending automated updating obviously using AutoIT. Sometimes I have problems with this, however, because I can not for the moment from my program manager to check the contents of SciTE Console. Can anyone suggest a function that reads the contents of SciTE Console ? I'll be in the future, felt obliged. edit: add tags
  17. With reference to I found an intresting SciTE console example https://code.google.com/p/scite-for-lua/ '> Does SciTE using ConsoleWrite is possible to display the message in the console with backlight as it is shown in the example. If it is not currently possible, and taking into account that it was hard to develop a beta version of AutoIT is it possible to add such functionality?
  18. Hi all, I'm developing a console program (program.exe) that takes file A and produces file B. What I wanted to know is what is the convention for passing files as arguments on the command line? In other words is it convention to do: program.exe "C:folderfile.abc" or is it convention to use the CWD: cd c:folder Program.exe file.abc Both will require different code internally. I want to know this because I am developing a program and need to know which to use. Also, is it convention to pass command line switches before or after the main input argument? Thanks in advance.
  19. Hey everyone, I was wondering if there was a way to use ConsoleWrite() to execute a command? I am looking to execute a command from an AutoIt program (a console app in this case), within the same shell as said AutoIT program was launched. ConsoleWrite() seemed to be the closest command available, as it writes directly to the StdOut stream. Perhaps there is an other command that I am ignorant of however, such as a way to use Run() to write to the same stream as ConsoleWrite()? As always, any help is much appreciated!
  20. What I am attempting to do is use AutoIt to read and write to the minecraft (bukkit) console The console itself comes up as a cmd window when you start the jar with a .bat file. So far I have been able to read FROM StdoutRead, but I have had less success writing TO the console and getting any kind of response. Here is the server, example .bat file, and the following script: #include <GuiEdit.au3> OnAutoItExitRegister("close") hotkeyset("{ENTER}","enter") $GUI = GUICreate("MC Console Wrapper", 514, 251, 192, 124) $Edit = GUICtrlCreateEdit("", 8, 8, 497, 209, 2101312) $Input = GUICtrlCreateInput("", 8, 224, 497, 21) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $temp = FileFindFirstFile("*.bat") $server = run(FileFindNextFile($TEMP),@WorkingDir,default,0x7) ConsoleWrite($server&@CRLF) While 1 $temp = "" $temp = StderrRead($server) if @extended > 2 then GUICtrlSetData($Edit,guictrlread($Edit)&@CRLF&$temp) _GUICtrlEdit_Scroll($Edit, 7) EndIf $temp = StdoutRead($server) if @extended > 2 then GUICtrlSetData($Edit,guictrlread($Edit)&@CRLF&$temp) _GUICtrlEdit_Scroll($Edit, 7) EndIf $nMsg = GUIGetMsg() Switch $nMsg Case -3 Exit EndSwitch WEnd func enter() if WinActive($gui) Then If guictrlread($Input) <> "" Then StdinWrite($server,guictrlread($Input)) consolewrite(@error&@CRLF) GUICtrlSetData($Input,"") EndIf Else hotkeyset("{ENTER}") send("{enter}") hotkeyset("{ENTER}","enter") EndIf EndFunc func close() Do ProcessClose("java.exe") until ProcessExists("java.exe") = 0 EndFuncAny help would be appreciated
  21. Hide CUI

    Hi guys, I would like to create an application that uses CUI, and consolewrite. At compiling I set the CUI enabled and It works well. #AutoIt3Wrapper_Change2CUI=y Now I have only one question: Is there any way to hide/delete the CUI? (I write something on it, let it be there for some sec, then it would disappear) Thanks a lot: Unc3nZureD