Cmd Hide And Output Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
ArkuS
Posts: 14
Joined: 29 Nov 2019, 22:54

Cmd Hide And Output

12 Apr 2024, 19:31

Hello, I need to enable the hidden windows command line. Execute the command, enter the password and confirm it. Finally get the output from the console to the variable.

At first I did it like this and it works, but I can't download the output. This method only shows what needs to be done.

Code: Select all

Run, cmd, , Hide, PID
WinWait, ahk_pid %PID%
ControlSend,, aescrypt.exe -d -o - x.txt.aes{Enter}, ahk_pid %PID%
ControlSend,, Pass_in_Var{Enter}, ahk_pid %PID%

I found the RunCmd function that takes the output, but I don't know how to use it to enter the password and confirm it. And this is where I need help.

Code: Select all

AesPassword := RunCmd("aescrypt.exe -d -o - x.txt.aes")
if (InStr(AesPassword, "Pass_from_Var"))
{
	MsgBox, Its Working
}
1.PNG
1.PNG (48.5 KiB) Viewed 222 times
2.PNG
2.PNG (58.05 KiB) Viewed 222 times
3.PNG
3.PNG (52.47 KiB) Viewed 222 times
Last edited by ArkuS on 15 Apr 2024, 01:43, edited 1 time in total.
MrDoge
Posts: 161
Joined: 27 Apr 2020, 21:29

Re: Cmd Hide And Output/RunCmd

14 Apr 2024, 03:49

Code: Select all

cp:=ChildProcess_ConsoleSend("aescrypt -d -o - x.txt.aes")
Sleep 100
prompt:=cp.Read()
cp.ConsoleSend("apples`r")
Sleep 100
response:=cp.Read()
AesPassword:=SubStr(response,5)
if (InStr(AesPassword, "this_is_the_password")) {
    MsgBox "It's Working"
}

class ChildProcess_ConsoleSend {
    __New(CmdLine, WorkingDir:=A_WorkingDir, Codepage:="UTF-8") {
        SECURITY_ATTRIBUTES:=Buffer(3*A_PtrSize,0)
        NumPut("Int",1,SECURITY_ATTRIBUTES,2*A_PtrSize)
        DllCall("CreatePipe","Ptr*",&hReadPipe:=0,"Ptr*",&hWritePipe:=0,"Ptr",SECURITY_ATTRIBUTES,"Uint",0)
        DllCall("CreatePipe","Ptr*",&g_hChildStd_IN_Rd:=0,"Ptr*",&g_hChildStd_IN_Wr:=0,"Ptr",SECURITY_ATTRIBUTES,"Uint",0)
        DllCall("SetHandleInformation","Ptr",g_hChildStd_IN_Wr,"Uint",1,"Uint",0) ;HANDLE_FLAG_INHERIT:1
        DllCall("SetHandleInformation","Ptr",hWritePipe,"Uint",1,"Uint",1) ;HANDLE_FLAG_INHERIT:1
        DllCall("SetNamedPipeHandleState","Ptr",hReadPipe,"Uint*",&lpMode:=1,"Ptr",0,"Ptr",0) ;PIPE_NOWAIT
        STARTUPINFOW:=Buffer(9*A_PtrSize+0x20,0)
        NumPut("Uint",STARTUPINFOW.Size,STARTUPINFOW,0x0) ;cb
        NumPut("Uint",0x00000100,STARTUPINFOW,4*A_PtrSize+0x1c) ;dwFlags:STARTF_USESTDHANDLES
        NumPut("Ptr",g_hChildStd_IN_Rd,STARTUPINFOW,6*A_PtrSize+0x20) ;hStdInput
        NumPut("Ptr",hWritePipe,STARTUPINFOW,7*A_PtrSize+0x20) ;hStdOutput
        NumPut("Ptr",hWritePipe,STARTUPINFOW,8*A_PtrSize+0x20) ;hStdError
        PROCESS_INFORMATION:=Buffer(2*A_PtrSize+0x8)
        ok:=DllCall("CreateProcessW","Ptr",0,"WStr",CmdLine,"Ptr",0,"Ptr",0,"Int",1,"Uint",0x00000410,"Ptr",0,"WStr",WorkingDir,"Ptr",STARTUPINFOW,"Ptr",PROCESS_INFORMATION) ;(lpApplicationName:NULL, lpCommandLine:CmdLine, lpProcessAttributes:NULL, lpThreadAttributes:NULL, bInheritHandles:TRUE, dwCreationFlags:CREATE_NO_WINDOW|CREATE_UNICODE_ENVIRONMENT, lpEnvironment:NULL, lpCurrentDirectory:WorkingDir, lpStartupInfo:STARTUPINFOW, lpProcessInformation:PROCESS_INFORMATION)
        if (!ok) {
            throw Error("failed to create process",0,"command:" CmdLine "`nWorkingDir:" WorkingDir)
        }
        DllCall("CloseHandle","Ptr",hWritePipe)
        DllCall("CloseHandle", "Ptr",g_hChildStd_IN_Rd)
        this.fileObj:=FileOpen(hReadPipe,"h",Codepage)
        ;this.stdin_fileObj:=FileOpen(g_hChildStd_IN_Wr,"h","UTF-8")
        this.PID:=NumGet(PROCESS_INFORMATION,2*A_PtrSize,"Uint")
    }

    Read() {
        return this.fileObj.Read()
    }

    ConsoleSend(text) { ;https://www.autohotkey.com/boards/viewtopic.php?style=17&t=107780
        if !DllCall("FreeConsole", "uint", this.PID)
            throw Error("Cannot FreeConsole")
        if !DllCall("AttachConsole", "uint", this.PID)
            throw Error("Script is already attached to a console.")

        hConIn := DllCall("CreateFile", "str", "CONIN$", "uint", 0xC0000000
                , "uint", 0x3, "ptr", 0, "uint", 0x3, "uint", 0, "ptr", 0)
        if hConIn = -1
            throw Error("CreateFile")

        ir := Buffer(24, 0)             ; ir := new INPUT_RECORD
        NumPut("ushort", 1, ir, 0)      ; ir.EventType := KEY_EVENT
        NumPut("ushort", 1, ir, 8)      ; ir.KeyEvent.wRepeatCount := 1
        ; wVirtualKeyCode, wVirtualScanCode and dwControlKeyState are not needed,
        ; so are left at the default value of zero.

        Loop Parse, text ; for each character in text
        {
            NumPut("ushort", Ord(A_LoopField), ir, 14)

            NumPut("int", True, ir, 4)  ; ir.KeyEvent.bKeyDown := true
            ConsoleSendWrite(ir)

            NumPut("int", False, ir, 4) ; ir.KeyEvent.bKeyDown := false
            ConsoleSendWrite(ir)
        }

        ConsoleSendWrite(ir) {
            DllCall("WriteConsoleInput", "ptr", hconin, "ptr", ir, "uint", 1, "uint*", 0)
        }

    }
}
User avatar
ArkuS
Posts: 14
Joined: 29 Nov 2019, 22:54

Re: Cmd Hide And Output/RunCmd

14 Apr 2024, 17:37

MrDoge wrote:
14 Apr 2024, 03:49

Code: Select all

cp:=ChildProcess_ConsoleSend("aescrypt -d -o - x.txt.aes")
Sleep 100
prompt:=cp.Read()
cp.ConsoleSend("apples`r")
Sleep 100
response:=cp.Read()
AesPassword:=SubStr(response,5)
if (InStr(AesPassword, "this_is_the_password")) {
    MsgBox "It's Working"
}

class ChildProcess_ConsoleSend {
    __New(CmdLine, WorkingDir:=A_WorkingDir, Codepage:="UTF-8") {
        SECURITY_ATTRIBUTES:=Buffer(3*A_PtrSize,0)
        NumPut("Int",1,SECURITY_ATTRIBUTES,2*A_PtrSize)
        DllCall("CreatePipe","Ptr*",&hReadPipe:=0,"Ptr*",&hWritePipe:=0,"Ptr",SECURITY_ATTRIBUTES,"Uint",0)
        DllCall("CreatePipe","Ptr*",&g_hChildStd_IN_Rd:=0,"Ptr*",&g_hChildStd_IN_Wr:=0,"Ptr",SECURITY_ATTRIBUTES,"Uint",0)
        DllCall("SetHandleInformation","Ptr",g_hChildStd_IN_Wr,"Uint",1,"Uint",0) ;HANDLE_FLAG_INHERIT:1
        DllCall("SetHandleInformation","Ptr",hWritePipe,"Uint",1,"Uint",1) ;HANDLE_FLAG_INHERIT:1
        DllCall("SetNamedPipeHandleState","Ptr",hReadPipe,"Uint*",&lpMode:=1,"Ptr",0,"Ptr",0) ;PIPE_NOWAIT
        STARTUPINFOW:=Buffer(9*A_PtrSize+0x20,0)
        NumPut("Uint",STARTUPINFOW.Size,STARTUPINFOW,0x0) ;cb
        NumPut("Uint",0x00000100,STARTUPINFOW,4*A_PtrSize+0x1c) ;dwFlags:STARTF_USESTDHANDLES
        NumPut("Ptr",g_hChildStd_IN_Rd,STARTUPINFOW,6*A_PtrSize+0x20) ;hStdInput
        NumPut("Ptr",hWritePipe,STARTUPINFOW,7*A_PtrSize+0x20) ;hStdOutput
        NumPut("Ptr",hWritePipe,STARTUPINFOW,8*A_PtrSize+0x20) ;hStdError
        PROCESS_INFORMATION:=Buffer(2*A_PtrSize+0x8)
        ok:=DllCall("CreateProcessW","Ptr",0,"WStr",CmdLine,"Ptr",0,"Ptr",0,"Int",1,"Uint",0x00000410,"Ptr",0,"WStr",WorkingDir,"Ptr",STARTUPINFOW,"Ptr",PROCESS_INFORMATION) ;(lpApplicationName:NULL, lpCommandLine:CmdLine, lpProcessAttributes:NULL, lpThreadAttributes:NULL, bInheritHandles:TRUE, dwCreationFlags:CREATE_NO_WINDOW|CREATE_UNICODE_ENVIRONMENT, lpEnvironment:NULL, lpCurrentDirectory:WorkingDir, lpStartupInfo:STARTUPINFOW, lpProcessInformation:PROCESS_INFORMATION)
        if (!ok) {
            throw Error("failed to create process",0,"command:" CmdLine "`nWorkingDir:" WorkingDir)
        }
        DllCall("CloseHandle","Ptr",hWritePipe)
        DllCall("CloseHandle", "Ptr",g_hChildStd_IN_Rd)
        this.fileObj:=FileOpen(hReadPipe,"h",Codepage)
        ;this.stdin_fileObj:=FileOpen(g_hChildStd_IN_Wr,"h","UTF-8")
        this.PID:=NumGet(PROCESS_INFORMATION,2*A_PtrSize,"Uint")
    }

    Read() {
        return this.fileObj.Read()
    }

    ConsoleSend(text) { ;https://www.autohotkey.com/boards/viewtopic.php?style=17&t=107780
        if !DllCall("FreeConsole", "uint", this.PID)
            throw Error("Cannot FreeConsole")
        if !DllCall("AttachConsole", "uint", this.PID)
            throw Error("Script is already attached to a console.")

        hConIn := DllCall("CreateFile", "str", "CONIN$", "uint", 0xC0000000
                , "uint", 0x3, "ptr", 0, "uint", 0x3, "uint", 0, "ptr", 0)
        if hConIn = -1
            throw Error("CreateFile")

        ir := Buffer(24, 0)             ; ir := new INPUT_RECORD
        NumPut("ushort", 1, ir, 0)      ; ir.EventType := KEY_EVENT
        NumPut("ushort", 1, ir, 8)      ; ir.KeyEvent.wRepeatCount := 1
        ; wVirtualKeyCode, wVirtualScanCode and dwControlKeyState are not needed,
        ; so are left at the default value of zero.

        Loop Parse, text ; for each character in text
        {
            NumPut("ushort", Ord(A_LoopField), ir, 14)

            NumPut("int", True, ir, 4)  ; ir.KeyEvent.bKeyDown := true
            ConsoleSendWrite(ir)

            NumPut("int", False, ir, 4) ; ir.KeyEvent.bKeyDown := false
            ConsoleSendWrite(ir)
        }

        ConsoleSendWrite(ir) {
            DllCall("WriteConsoleInput", "ptr", hconin, "ptr", ir, "uint", 1, "uint*", 0)
        }

    }
}

Thanks for the help. I tried this, but I got this error
Przechwytywanie.PNG
(15.36 KiB) Downloaded 156 times

In the code of the Console Send(text) function there is a link to a topic which states that this function is for Autohotkey v2. Are you sure it works until v1?
MrDoge
Posts: 161
Joined: 27 Apr 2020, 21:29

Re: Cmd Hide And Output/RunCmd  Topic is solved

14 Apr 2024, 19:24

Code: Select all

cp:=new ChildProcess_ConsoleSend("aescrypt.exe -d -o - x.txt.aes")
while (cp.Peek()!=="E n t e r   p a s s w o r d :   ") {
    Sleep 100
}
cp.Reset_Peek()
cp.ConsoleSend("apples`r")
response:=cp.ReadUntilClosed()
AesPassword:=SubStr(response,5)
if (InStr(AesPassword, "this_is_the_password")) {
    MsgBox % "It's Working"
}

class ChildProcess_ConsoleSend {
    __New(CmdLine, WorkingDir:=0, Codepage:="UTF-8", includeStdErr:=true) {
        (WorkingDir==0 && WorkingDir:=A_WorkingDir)
        DllCall("CreatePipe","Ptr*",hReadPipe:=0,"Ptr*",hWritePipe:=0,"Ptr",0,"Uint",0)
        DllCall("SetHandleInformation","Ptr",hWritePipe,"Uint",1,"Uint",1) ;HANDLE_FLAG_INHERIT:1
        DllCall("SetNamedPipeHandleState","Ptr",hReadPipe,"Uint*",lpMode:=1,"Ptr",0,"Ptr",0) ;PIPE_NOWAIT
        VarSetCapacity(STARTUPINFOW,9*A_PtrSize+0x20,0)
        NumPut(9*A_PtrSize+0x20,STARTUPINFOW,0x0,"Uint") ;cb
        ;NumPut(0,STARTUPINFOW,4*A_PtrSize+0x20,"uShort") ;wShowWindow:SW_HIDE
        NumPut(hWritePipe,STARTUPINFOW,4*A_PtrSize+0x20,"Ptr") ;hStdOutput
        NumPut(0x00000101,STARTUPINFOW,4*A_PtrSize+0x1c,"Uint") ;dwFlags:STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW
        NumPut(hWritePipe,STARTUPINFOW,7*A_PtrSize+0x20,"Ptr") ;hStdOutput
        (includeStdErr && NumPut(hWritePipe,STARTUPINFOW,8*A_PtrSize+0x20,"Ptr")) ;hStdError
        VarSetCapacity(PROCESS_INFORMATION,2*A_PtrSize+0x8)
        success:=DllCall("CreateProcessW","Ptr",0,"WStr",CmdLine,"Ptr",0,"Ptr",0,"Int",1,"Uint",0x00000410,"Ptr",0,"WStr",WorkingDir,"Ptr",&STARTUPINFOW,"Ptr",&PROCESS_INFORMATION) ;CREATE_NO_WINDOW|CREATE_NEW_CONSOLE
        if (!success) {
            throw Exception("failed to create process",0,"command:" CmdLine "`nWorkingDir:" WorkingDir)
        }
        DllCall("CloseHandle","Ptr",hWritePipe)
        this.fileObj:=FileOpen(hReadPipe,"h",Codepage)
        this.PID:=NumGet(PROCESS_INFORMATION,2*A_PtrSize,"Uint")
        this.Codepage:=Codepage
        this.peekStr:=""
    }

    _Read() {
        if (this.Codepage=="UTF-8") {
            VarSetCapacity(buf,4096)
            bytesRead:=this.fileObj.RawRead(buf,4095)
            if (!bytesRead) {
                return ""
            }

            i:=0
            while (i<bytesRead) {
                if (NumGet(buf,i,"UChar")==0) {
                    NumPut(0x20,buf,i,"UChar")
                }
                ++i
            }
            NumPut(0x00,buf,i,"UChar")
            retStr:=StrGet(&buf,"UTF-8")
            VarSetCapacity(buf,0)
            return retStr
        } else {
            return this.fileObj.Read()
        }
    }

    Reset_Peek() {
        this.peekStr:=""
    }

    Peek() {
        this.peekStr.=this._Read()
        return this.peekStr
    }

    ReadUntilClosed() {
        while (DllCall("PeekNamedPipe","Ptr",this.fileObj.Handle,"Ptr",0,"Uint",0,"Ptr",0,"Uint*",lpTotalBytesAvail:=0,"Ptr",0)) {
            if (!lpTotalBytesAvail) {
                Sleep 1
            }
            this.peekStr.=this._Read()
        }
        return this.peekStr
    }

    ConsoleSend(text) { ;https://www.autohotkey.com/boards/viewtopic.php?style=17&t=107780
        if (!DllCall("AttachConsole","uint",this.PID)) {
            DllCall("FreeConsole")
            if (!DllCall("AttachConsole","uint",this.PID)) {
                Sleep 100
                DllCall("FreeConsole")
                if (!DllCall("AttachConsole","uint",this.PID)) {
                    throw Exception("Script is already attached to a console.")
                }
            }
        }

        hConIn:=DllCall("CreateFileA","AStr","CONIN$","Uint",0x40000000,"Uint",0x00000007,"Ptr",0,"Uint",3,"Uint",0,"Ptr",0) ;GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, OPEN_EXISTING
        if (hConIn == -1) {
            throw Exception("CreateFileA")
        }

        length:=StrLen(text)
        VarSetCapacity(INPUT_RECORD,0x14*2*length,0)
        ; wVirtualKeyCode, wVirtualScanCode and dwControlKeyState are not needed,
        ; so are left at the default value of zero.
        c:=1,i:=0
        while (c<=length) {
            NumPut(1,INPUT_RECORD,i+0x4,"Int")  ; ir.KeyEvent.bKeyDown := true
            NumPut(0,INPUT_RECORD,i+0x4+0x14,"Int") ; ir.KeyEvent.bKeyDown := false
            wchar:=Ord(SubStr(text,c,1))
            loop 2 {
                NumPut(wchar,INPUT_RECORD,i+0xe,"uShort") ; ir.KeyEvent.uChar.UnicodeChar := text[c]
                NumPut(1,INPUT_RECORD,i+0x0,"uShort") ; ir.EventType := KEY_EVENT
                NumPut(1,INPUT_RECORD,i+0x8,"uShort") ; ir.KeyEvent.wRepeatCount := 1
                i+=0x14
            }
            ++c
        }

        DllCall("WriteConsoleInput","Ptr",hconin,"Ptr",&INPUT_RECORD,"Uint",2*length,"Uint*",0)
    }
}
Last edited by MrDoge on 15 Apr 2024, 02:23, edited 1 time in total.
User avatar
ArkuS
Posts: 14
Joined: 29 Nov 2019, 22:54

Re: Cmd Hide And Output/RunCmd

14 Apr 2024, 22:30

MrDoge wrote:
14 Apr 2024, 19:24

Code: Select all

cp:=new ChildProcess_ConsoleSend("aescrypt.exe -d -o - x.txt.aes")
while (cp.Peek()!=="E n t e r   p a s s w o r d :   ") {
    Sleep 100
}
cp.Reset_Peek()
cp.ConsoleSend("apples`r")
response:=cp.ReadUntilClosed()
AesPassword:=SubStr(response,5)
if (InStr(AesPassword, "this_is_the_password")) {
    MsgBox % "It's Working"
}

class ChildProcess_ConsoleSend {
    __New(CmdLine, WorkingDir:=0, Codepage:="UTF-8", includeStdErr:=true) {
        (WorkingDir==0 && WorkingDir:=A_WorkingDir)
        DllCall("CreatePipe","Ptr*",hReadPipe:=0,"Ptr*",hWritePipe:=0,"Ptr",0,"Uint",0)
        DllCall("SetHandleInformation","Ptr",hWritePipe,"Uint",1,"Uint",1) ;HANDLE_FLAG_INHERIT:1
        DllCall("SetNamedPipeHandleState","Ptr",hReadPipe,"Uint*",lpMode:=1,"Ptr",0,"Ptr",0) ;PIPE_NOWAIT
        VarSetCapacity(STARTUPINFOW,9*A_PtrSize+0x20,0)
        NumPut(9*A_PtrSize+0x20,STARTUPINFOW,0x0,"Uint") ;cb
        ;NumPut(0,STARTUPINFOW,4*A_PtrSize+0x20,"uShort") ;wShowWindow:SW_HIDE
        NumPut(hWritePipe,STARTUPINFOW,4*A_PtrSize+0x20,"Ptr") ;hStdOutput
        NumPut(0x00000101,STARTUPINFOW,4*A_PtrSize+0x1c,"Uint") ;dwFlags:STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW
        NumPut(hWritePipe,STARTUPINFOW,7*A_PtrSize+0x20,"Ptr") ;hStdOutput
        (includeStdErr && NumPut(hWritePipe,STARTUPINFOW,8*A_PtrSize+0x20,"Ptr")) ;hStdError
        VarSetCapacity(PROCESS_INFORMATION,2*A_PtrSize+0x8)
        success:=DllCall("CreateProcessW","Ptr",0,"WStr",CmdLine,"Ptr",0,"Ptr",0,"Int",1,"Uint",0x00000410,"Ptr",0,"WStr",WorkingDir,"Ptr",&STARTUPINFOW,"Ptr",&PROCESS_INFORMATION) ;CREATE_NO_WINDOW|CREATE_NEW_CONSOLE
        if (!success) {
            throw Exception("failed to create process",0,"command:" CmdLine "`nWorkingDir:" WorkingDir)
        }
        DllCall("CloseHandle","Ptr",hWritePipe)
        this.fileObj:=FileOpen(hReadPipe,"h",Codepage)
        this.PID:=NumGet(PROCESS_INFORMATION,2*A_PtrSize,"Uint")
        this.Codepage:=Codepage
        this.peekStr:=""
    }

    _Read() {
        if (this.Codepage=="UTF-8") {
            bytesRead:=this.fileObj.RawRead(buf,4096)
            if (!bytesRead) {
                Sleep 100
            }

            i:=0
            while (i<bytesRead) {
                if (NumGet(buf,i,"UChar")==0) {
                    NumPut(0x20,buf,i,"UChar")
                }
                ++i
            }

            return StrGet(&buf,"UTF-8")
        } else {
            return this.fileObj.Read()
        }
    }

    Reset_Peek() {
        this.peekStr:=""
    }

    Peek() {
        this.peekStr.=this._Read()
        return this.peekStr
    }

    ReadUntilClosed() {
        while (DllCall("PeekNamedPipe","Ptr",this.fileObj.Handle,"Ptr",0,"Uint",0,"Ptr",0,"Uint*",lpTotalBytesAvail:=0,"Ptr",0)) {
            if (!lpTotalBytesAvail) {
                Sleep 1
            }
            this.peekStr.=this._Read()
        }
        return this.peekStr
    }

    ConsoleSend(text) { ;https://www.autohotkey.com/boards/viewtopic.php?style=17&t=107780
        if (!DllCall("AttachConsole","uint",this.PID)) {
            DllCall("FreeConsole")
            if (!DllCall("AttachConsole","uint",this.PID)) {
                Sleep 100
                DllCall("FreeConsole")
                if (!DllCall("AttachConsole","uint",this.PID)) {
                    throw Exception("Script is already attached to a console.")
                }
            }
        }

        hConIn:=DllCall("CreateFileA","AStr","CONIN$","Uint",0x40000000,"Uint",0x00000007,"Ptr",0,"Uint",3,"Uint",0,"Ptr",0) ;GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, OPEN_EXISTING
        if (hConIn == -1) {
            throw Exception("CreateFileA")
        }

        length:=StrLen(text)
        VarSetCapacity(INPUT_RECORD,0x14*2*length,0)
        ; wVirtualKeyCode, wVirtualScanCode and dwControlKeyState are not needed,
        ; so are left at the default value of zero.
        c:=1,i:=0
        while (c<=length) {
            NumPut(1,INPUT_RECORD,i+0x4,"Int")  ; ir.KeyEvent.bKeyDown := true
            NumPut(0,INPUT_RECORD,i+0x4+0x14,"Int") ; ir.KeyEvent.bKeyDown := false
            wchar:=Ord(SubStr(text,c,1))
            loop 2 {
                NumPut(wchar,INPUT_RECORD,i+0xe,"uShort") ; ir.KeyEvent.uChar.UnicodeChar := text[c]
                NumPut(1,INPUT_RECORD,i+0x0,"uShort") ; ir.EventType := KEY_EVENT
                NumPut(1,INPUT_RECORD,i+0x8,"uShort") ; ir.KeyEvent.wRepeatCount := 1
                i+=0x14
            }
            ++c
        }

        DllCall("WriteConsoleInput","Ptr",hconin,"Ptr",&INPUT_RECORD,"Uint",2*length,"Uint*",0)
    }
}

Thanks again. We're getting closer. Now it seems that the script is unable to find the text. It keeps looping trying to find the text.

22.PNG
(38.52 KiB) Downloaded 142 times
MrDoge
Posts: 161
Joined: 27 Apr 2020, 21:29

Re: Cmd Hide And Output/RunCmd

14 Apr 2024, 22:42

Code: Select all

while (cp.Peek()!=="E n t e r   p a s s w o r d :   ") {
    ToolTip % Clipboard:=cp.Peek()
    Sleep 100
}
what does the ToolTip or Clipboard show ?
User avatar
ArkuS
Posts: 14
Joined: 29 Nov 2019, 22:54

Re: Cmd Hide And Output/RunCmd

14 Apr 2024, 22:57

MrDoge wrote:
14 Apr 2024, 22:42

Code: Select all

while (cp.Peek()!=="E n t e r   p a s s w o r d :   ") {
    ToolTip % Clipboard:=cp.Peek()
    Sleep 100
}
what does the ToolTip or Clipboard show ?

This is exactly what it shows:
11.PNG
(17.5 KiB) Downloaded 134 times
MrDoge
Posts: 161
Joined: 27 Apr 2020, 21:29

Re: Cmd Hide And Output/RunCmd

14 Apr 2024, 23:05

replace "E n t e r p a s s w o r d : " with exactly what it shows, it should be in your Clipboard, so just paste it
at this line:

Code: Select all

while (cp.Peek()!=="E n t e r   p a s s w o r d :   ") {
User avatar
ArkuS
Posts: 14
Joined: 29 Nov 2019, 22:54

Re: Cmd Hide And Output/RunCmd

14 Apr 2024, 23:19

MrDoge wrote:
14 Apr 2024, 23:05
replace "E n t e r p a s s w o r d : " with exactly what it shows, it should be in your Clipboard, so just paste it
at this line:

Code: Select all

while (cp.Peek()!=="E n t e r   p a s s w o r d :   ") {

Thank you very much. Now everything works.
aa.PNG
(4.14 KiB) Downloaded 129 times
MrDoge
Posts: 161
Joined: 27 Apr 2020, 21:29

Re: Cmd Hide And Output

15 Apr 2024, 02:24

@ArkuS I updated the script, does it work now without having to change this line ?

Code: Select all

while (cp.Peek()!=="E n t e r   p a s s w o r d :   ") {
User avatar
ArkuS
Posts: 14
Joined: 29 Nov 2019, 22:54

Re: Cmd Hide And Output

15 Apr 2024, 12:24

@MrDoge Thanks for your continued interest. I updated it, and this line still needs to look like this to work.

Code: Select all

while (cp.Peek()!=="E n t e r   p a s s w o r d :   ") {

This is how it looks if I remove the spaces
Przechwytywanie.PNG
(39.08 KiB) Downloaded 92 times

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: IfThenElse, lechat, LuckyJoe, osail and 254 guests