Jump to content

Search the Community

Showing results for tags 'filewritetoarray'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Location


WWW


Interests

Found 2 results

  1. hi all, reviewing the forum, this thread is applicable: I wanted to know if there is now a better way to do this? In essence, I load a tab delimited txt file into an array (works well). I used tab, as some fields in the original csv contains commas. However, I needed autoit to manipulate this array, and output it as a csv. IF my array contains items with a comma, without double quotes around the field, then how best do I get a csv out of this? My current workaround is to filewritefromarray tab delimited, then open it in excel and save as a csv. I will need to check this to see how the address fields behave that contain a comma. Any thoughts would be appreciated.
  2. Hi, I've written two scripts - a sender and a receiver - that sends a file across a TCP connection. The sender reads the file, then splits it in to chunks and populates it in an array. It then creates a TCP connection to the the receiver and sends the chunks across. The receiver populates the chunks in to an array on it's side of the network, then, once it has received all the chunks, writes the file to disk using the _FileWriteFromArray function. All is working well, as expected, however, the _FileWriteFromArray function appears to prepend and tail the output file with a carriage return (hex: 0D 0A). Is there any way to disable this functionality? The data integrity needs to be 100% intact as the send and receive binaries will be md5'd and compared. Thanks for your time, Crisko SEND SCRIPT: #include <File.au3> #include <Array.au3> FileDelete("C:\testlog.log") hotkeyset("{Esc}","quit") $destinationIPAddress = $CmdLine[1] $destinationPort = $CmdLine[2] $sendFile = FileRead ($CmdLine[3]) $fileLength = StringLen($sendFile) $chunkSize = 0 ;Local $fileArray ;_FileReadToArray($sendFile, $fileArray) ;MsgBox(0, "", $fileLength) FileDelete("C:\testlog.log") $Success = false $i = 2 $remainder = 1 While $Success == False If $remainder <> 0 Then ;logwrite("If statement executed") $i = $i + 1 Else ;logwrite("Else statement executed") $chunkSize = $i If $chunkSize > 1023 AND $chunkSize < 8097 Then $Success = true ExitLoop Else $Success = False $i = $i + 1 EndIf EndIf $remainder = Mod ($fileLength, $i) ;logwrite("Divider is: " & $i & " | Remainder is: " & $remainder) WEnd IniWrite("\\diskstation\public\xFPTool\config.ini", "System", "chunkSize", $chunkSize) ;MsgBox (0, "", $chunkSize, 5) $chunkCount = $fileLength / $chunkSize IniWrite("\\diskstation\public\xFPTool\config.ini", "System", "chunkCount", $chunkCount) Local $avSendFileChunked[$chunkCount + 1] $startDividePoint = 1 For $split = 1 to $chunkCount Step + 1 $endDividePoint = $startDividePoint + $chunkSize $avSendFileChunked[$split] = StringMid($sendFile, $startDividePoint, $endDividePoint) ;logwrite("Split iteration: " & $split & " | Start Divide Point: " & $startDividePoint & " | End Divide Point: " & $endDividePoint & " | Array Count: " & $avSendFileChunked[$split]) $startDividePoint = $endDividePoint + 1 Next TCPStartup() Do $ConnectedSocket = TCPConnect($destinationIPAddress, $destinationPort) ;Sleep(2500) Until $ConnectedSocket <> -1 For $sendCount = 1 to $chunkCount Step + 1 ;$sendData = StringtoBinary($avSendFileChunked[$sendCount]) $sendStatus = TCPSend($ConnectedSocket, $avSendFileChunked[$sendCount]) ;logwrite("Send Iteration: " & $sendCount & " ||| Send Status: " & $sendStatus) Next TCPCloseSocket($ConnectedSocket) TCPShutdown() Func logwrite($data) FileOpen("C:\testlog.log", 9) FileWriteLine("C:\testlog.log", $data) FileClose("C:\testlog.log") EndFunc Func quit() Exit EndFunc Exit RECEIVE SCRIPT: #include <String.au3> #include <File.au3> FileDelete("C:\testlog2.log") hotkeyset("{Esc}","quit") $localIPAddress = @IPAddress1 $listeningPort = $CmdLine[1] $xFPSenderModule = "C:\xFP Sender\xFP_Sender.exe" $sendFile = $CmdLine[2] $remoteIPAddress = $CmdLine[3] $chunkSize = IniRead("\\diskstation\public\xFPTool\config.ini", "System", "chunkSize", "") $chunkCount = IniRead("\\diskstation\public\xFPTool\config.ini", "System", "chunkCount", "") Local $avChunkedFile[$chunkCount + 1] TCPStartup() $mainSocket = TCPListen($localIPAddress, $listeningPort) If $mainSocket = -1 Then Exit $connectedSocket = -1 Do $connectedSocket = TCPAccept($mainSocket) Until $connectedSocket <> -1 For $i = 1 to $chunkCount Step +1 $avChunkedFile[$i] = TCPRecv($connectedSocket, $chunkSize) ;logwrite($avChunkedFile[$i]) Next _FileWriteFromArray("C:\output.bin", $avChunkedFile) TCPCloseSocket($connectedSocket) TCPShutdown() Func logwrite($data) FileOpen("C:\testlog2.log", 9) FileWriteLine("C:\testlog2.log", $data) FileClose("C:\testlog2.log") EndFunc Func quit() Exit EndFunc Exit
×
×
  • Create New...