This is my first ever post on Stackoverflow! any help would be much appreciated.
Im an AutoIT beginner and trying to create a script that takes a string, converts it to ASCII and saves it in an array using StringToASCIIArray
What i would like to achieve is that, i need the output to be printed in a text file, so i can copy it for later use.
Ive tried using ConsoleWrite Function, the characters get printed just as i expect them to be, however it would nice if someone could point me out in the right direction to have them printed in a new text file or something. Thanks!
Here's the code:
#include <MsgBoxConstants.au3>
#include <Array.au3>
Test()
Func Test()
; Convert the string to an ASCII array.
Local $aArray = StringToASCIIArray("Hi, this is a new string")
Local $sizeArr = UBound($aArray)
For $i = 0 to $sizeArr - 1
ConsoleWrite("Chr(" & $aArray[$i] & ")" & " & ") ; need this output in a new variable?
Next
;Run("notepad.exe")
;WinWaitActive("Untitled - Notepad")
;Send($aNewArray)
EndFunc
Update
I managed to do it by creating a console application that takes an input string, converts the input to ascii and displays the formated output on the console. I can simply copy the output from there on....Not the best solution though, but it works :)
Code::
#include <MsgBoxConstants.au3>
#include <Array.au3>
myexample()
Func myexample()
Local $sInput
While True
$sInput &= ConsoleRead()
If @error Then ExitLoop
Sleep(25)
WEnd
Local $aArray = StringToASCIIArray($sInput) ; store string to array
Local $sizeArr = UBound($aArray) ; Get array size
For $i = 0 to $sizeArr - 1 ;For each element of array Do:
ConsoleWrite("Chr(" & $aArray[$i] & ")" & " & ") ;write to console ascii in Chr()
Next
EndFunc