Search the Community
Showing results for tags 'cui'.
-
Hello, As I was searching this forum I came along something intresting what was new to me. CUI/GUI hybrid. Whish sounds very usefull to me to compile it all into 1 script. So i was fideling around whit it but couldn't get it to work. In the real script (not this simplified version) i got a lot of functions whish i can use whan talking to it by commandline and switches. I could not get this to work and hope somebody could give me some pointers on how to make it work. Also I was hoping iff somebody could help me whit the /? function? (I don't know how to output the help text back to the commandline or the function that can help me do it) please advice and thanks in advanced. #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_UseX64=n #AutoIt3Wrapper_Change2CUI=y #include <Process.au3> #include <Array.au3> If $CmdLine[0] = 0 Then If _ProcessGetName(ProcessGetParent(@AutoItPID)) = "cmd.exe" Then ;ConsoleWrite("Program was started in CMD" & @CRLF) If Mod($CmdLine[0], 2) <> 0 Then Exit MsgBox(16, $sTitle, "Invalid number of parameters! has to be a multiple of 2!") If $CmdLine[0] = 0 Then Exit MsgBox(16, $sTitle, "No parameters passed!") For $i = 1 To $CmdLine[0] Step 2 If $CmdLine[$i] = "/switch" Then MsgBox(64, "Passed Parameters", "/switch is " & $CmdLine[$i+1]) If $CmdLine[$i] = "/?" Then MsgBox(64, "Passed Parameters", "/? " ) Next _ArrayDisplay($CmdLine) Else #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 239, 65, 192, 124) $Button1 = GUICtrlCreateButton("Button1", 32, 24, 75, 25) $Button2 = GUICtrlCreateButton("Button2", 120, 24, 75, 25) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 button1() Case $button2 button2() EndSwitch WEnd EndIf EndIf Exit Func button1() MsgBox(16, "title", "button1()!") EndFunc Func button2() MsgBox(16, "title", "button1()!") EndFunc Func ProcessGetParent($i_PID) ;get PID from parent process done by SmOke_N Local $TH32CS_SNAPPROCESS = 0x00000002 Local $a_tool_help = DllCall("Kernel32.dll", "long", "CreateToolhelp32Snapshot", "int", $TH32CS_SNAPPROCESS, "int", 0) If IsArray($a_tool_help) = 0 Or $a_tool_help[0] = -1 Then Return SetError(1, 0, $i_PID) Local $tagPROCESSENTRY32 = _ DllStructCreate( _ "dword dwsize;" & _ "dword cntUsage;" & _ "dword th32ProcessID;" & _ "uint th32DefaultHeapID;" & _ "dword th32ModuleID;" & _ "dword cntThreads;" & _ "dword th32ParentProcessID;" & _ "long pcPriClassBase;" & _ "dword dwFlags;" & _ "char szExeFile[260]" _ ) DllStructSetData($tagPROCESSENTRY32, 1, DllStructGetSize($tagPROCESSENTRY32)) Local $p_PROCESSENTRY32 = DllStructGetPtr($tagPROCESSENTRY32) Local $a_pfirst = DllCall("Kernel32.dll", "int", "Process32First", "long", $a_tool_help[0], "ptr", $p_PROCESSENTRY32) If IsArray($a_pfirst) = 0 Then Return SetError(2, 0, $i_PID) Local $a_pnext, $i_return = 0 If DllStructGetData($tagPROCESSENTRY32, "th32ProcessID") = $i_PID Then $i_return = DllStructGetData($tagPROCESSENTRY32, "th32ParentProcessID") DllCall("Kernel32.dll", "int", "CloseHandle", "long", $a_tool_help[0]) If $i_return Then Return $i_return Return $i_PID EndIf While @error = 0 $a_pnext = DllCall("Kernel32.dll", "int", "Process32Next", "long", $a_tool_help[0], "ptr", $p_PROCESSENTRY32) If DllStructGetData($tagPROCESSENTRY32, "th32ProcessID") = $i_PID Then $i_return = DllStructGetData($tagPROCESSENTRY32, "th32ParentProcessID") If $i_return Then ExitLoop $i_return = $i_PID ExitLoop EndIf WEnd DllCall("Kernel32.dll", "int", "CloseHandle", "long", $a_tool_help[0]) Return $i_return EndFunc ;==>ProcessGetParent
-
Is there any reliable way to check what console a CUI is running under (Powershell/Powershell ISE/CMD/misc)?
-
Hi all, I am working on a application with a GUI and command prompt in 1. Currently my code looks this simple > #AutoIt3Wrapper_UseUpx=y #AutoIt3Wrapper_Change2CUI=y #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 615, 437, 192, 124) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd But when I compile this and run the compiled version there is also a command prompt shown. But I don't want this. Besides that, I also want it to be possible when I run my script from the command prompt, the program will give feedback in the command prompt where it was started from. With the setup above. This is possible with the ConsoleWrite command. Is it possible to hide the command prompt one way or another when I start the GUI? Or do I have to change my script? I hope someone can help me. Regards, lrstndm
-
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
-
Hi, would there a way to disable enable the CUI after the exe was compiled If a certain Action is being used?
-
How can I get input from the user when my program is compiled as a CUI? Thanks in advance, TD
-
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.
-
I am trying to create a script that allows me to run and use it with CMD as the interface. For example: This is the code I have so far... #AutoIt3Wrapper_Change2CUI=y ConsoleWrite("Enter PIN" & @CRLF & ":") Local $input While 1 $input &= ConsoleRead() if StringInStr($input,@CRLF) <> 0 then ExitLoop Wend if $input = "1111" & @CRLF Then ConsoleWrite("Success") Else ConsoleWrite("Failure") ConsoleWrite($input) EndIf The problem is that after it writes Enter PIN: it will not accept input and gets stuck. After I close the script, all the input I typed shows up in cmd. I want be able to run this script without opening another cmd window but I haven't been able to find relevant examples for creating a "console" application used through cmd. Can anyone help me out?
-
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