Jump to content
Sign in to follow this  
Wb-FreeKill

Split textline into sections

Recommended Posts

Okay, im using Larry's dll to send informations between two computers, but in some way, it has a limitation of how much it can send at once, so i have to split it into pieces, and send them one and another..

This was my temporary solutions, but it aint working that well...

Is there an easier or better way to split a text line, so i can send it in pieces..?

If $ret[2] = 42 Then
$SendLength = Stringlen($SaveFiles)
$1 = Stringleft($SaveFiles,3000)
DLLCall(@WindowsDir & "\au3xtra.dll", "int", "TCPSend", "int", $socket1, "str","1," & $a[0] &","& $1)

If $SendLength > 3000 Then
$2 = StringMid($SaveFiles, 3000, 3000)
DLLCall(@WindowsDir & "\au3xtra.dll", "int", "TCPSend", "int", $socket1, "str","2," & $a[0] &","& $2)
sleep(500)
EndIf

If $SendLength > 6000 Then
$3 = StringMid($SaveFiles, 6000, 3000)
DLLCall(@WindowsDir & "\au3xtra.dll", "int", "TCPSend", "int", $socket1, "str","3," & $a[0] &","& $3)
sleep(500)
EndIf

Share this post


Link to post
Share on other sites

Okay, im using Larry's dll to send informations between two computers, but in some way, it has a limitation of how much it can send at once, so i have to split it into pieces, and send them one and another..

This was my temporary solutions, but it aint working that well...

Is there an easier or better way to split a text line, so i can send it in pieces..?

If $ret[2] = 42 Then
$SendLength = Stringlen($SaveFiles)
$1 = Stringleft($SaveFiles,3000)
DLLCall(@WindowsDir & "\au3xtra.dll", "int", "TCPSend", "int", $socket1, "str","1," & $a[0] &","& $1)

If $SendLength > 3000 Then
$2 = StringMid($SaveFiles, 3000, 3000)
DLLCall(@WindowsDir & "\au3xtra.dll", "int", "TCPSend", "int", $socket1, "str","2," & $a[0] &","& $2)
sleep(500)
EndIf

If $SendLength > 6000 Then
$3 = StringMid($SaveFiles, 6000, 3000)
DLLCall(@WindowsDir & "\au3xtra.dll", "int", "TCPSend", "int", $socket1, "str","3," & $a[0] &","& $3)
sleep(500)
EndIf

<{POST_SNAPBACK}>

Something like ?:

For $x = 1 to int(StringLen($SaveFiles)/3000)+1
    $SendString = StringMid($SaveFiles, ($x-1)*3000+1, $x*3000)
    DLLCall(@WindowsDir & "\au3xtra.dll", "int", "TCPSend", "int", $socket1, "str","2," & $a[0] &","& $SendString)
    sleep(500)
Next

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

exactly what i was looking for  :D 

But does it know when to stop sending the text, i mean when the hole text line has been sendt?

<{POST_SNAPBACK}>

this line calculates the number of time the string can be split up in portions of 3000:

For $x = 1 to int(StringLen($SaveFiles)/3000)+1

:)


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

this line calculates the number of time the string can be split up in portions of 3000:

For $x = 1 to int(StringLen($SaveFiles)/3000)+1

:)

<{POST_SNAPBACK}>

okay, thx..

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...