0

I created a HTML file, loaded it into IE and now I would like to add lines to the TextArea contained in the HTML Page.

<FORM NAME="driver">
   <textarea cols="100" name="Protocol" rows="20"></textarea></p>
   <input name="Mail_Folder" type="text" />
   <input name="CloseApp"    type="button" value="Exit"                 onclick="CloseLoop()" />
   <input name="FormatText"  type="button" value="Process Excel Sheet"  onclick="ProcessExcel()" />
   <input type="hidden" name="Loop" value="TRUE">
</FORM>

Now I use this HTML file with the code:

$ie = new-object -com "InternetExplorer.Application
$ie.navigate2($GuiFile)
$ie.Visible = $true

and I write into the table with:

$ie.Document.getElementById("Protocoll").value = "Text"

this works fine. However I am not able to insert new lines, when I use "\n", "\r\n" or
, nothing, it appears literally. What am I missing ?

Thank you very much for every hint. Yours, Eryk

  • Try ` ` as per this question: https://stackoverflow.com/questions/39325414/line-break-in-html-with-n?#answer-39325879 – mjsqu May 15 '18 at 23:43

1 Answers1

0

Nope. This works fine when I use Javascript to write into the text area. When I use Powershell and DOM the text is interpreted as pure text. I see in the text area:

TRUE&#10;&#13;NO ACTION&#10;&#13;TRUE&#10;&#13;NO ACTION&#10;&#13;

Another possibility would be to let it write in with javascript and call the javascript function from powershell. But this is a little bit tricky.

  • Another little bit "stupid" but working possibility is to define a string which is as long as the textfield, information from the param "cols", therefore I do not write explizit a newline, but it appears as it would be there. –  May 16 '18 at 08:47