0

All,

When JlinkSTR91x.exe is invoked, it opens up a command prompt J-Link. In this prompt, we can type the commands. I need to do the same using AutoIt scripting. This is what I tried,

;Execution.au3


Local $foo = Run("C:\\Program Files\\SEGGER\\JLinkARM_V426b\\JLinkSTR91x.exe", "", @SW_SHOW, $STDIN_CHILD)

StdinWrite($foo,"setb 0")

ProcessWaitClose($foo)

When I run this script, J-Link prompt opens up but unable to send the command "setb 0" at this prompt. Please help.

1 Answer 1

1
Run("cmd")

$prog = WinWaitActive("C:\WINDOWS\system32\cmd.exe")

ControlSend($prog, Default, $prog, "exit")
Sleep(999)
ControlSend($prog, Default, $prog, "{Enter}")

WinWaitClose($prog)

This does theoretically what you want. Just replace the cmd with your command and insert the actual title of the prompt.You can find it out with the Info-Tool included with AutoIt. It's just a working example.

And it will even send the text when your prompt isn't active any more. You can even hide your prompt with WinSetState($prog, Default, @SW_HIDE) .

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.