Reputation: 1
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.
Upvotes: 0
Views: 364
Reputation: 1707
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) .
Upvotes: 1