Jump to content

New and dont know where to start.


corvox
 Share

Recommended Posts

Basically I want to write my own article spinner.

I write an article with 3 variations on a sentence, 3-4 sentences per paragraph.

What the script must do.

Read txt file one take line one make it variable 1, line 2 variable 2 then line 3 variable 3 then print one of the three variables to a new txt file, then continues to 4,5,6 and then prints one of them random to the txt file and continues till it reaches the end.

Save the new files.

the new files will be

random

V1-3,V4-6,V7-9

V10-12,v13-15,v16-18

v19-21,v22-24,v25-27

Saves file then repeats x amount of time (random characters when naming the file to be saved)

Is this possible?

I want it to read from the source file and fill the variables in with text that is contained on that line.then randomly choose one of the 3 variable, then move to the next 3 and choose one and so on

I assume I start with getting it to read from the source file 1st. but where can I find information on this?

Link to comment
Share on other sites

Dim $sFile = @ScriptDir & '\123.txt'
Dim $sText = FileRead($sFile)

If Not StringLen($sText) Then
    MsgBox(0x10, 'Error', 'Could not open the file "' & $sFile & '"')
    Exit
EndIf

Dim $Arr = StringSplit($sText, @CRLF, 1)
If IsArray($Arr) Then
    $sText = ''
    For $i = 1 To $Arr[0] Step 3
        If $i + 1 > $Arr[0] Or $i + 2 > $Arr[0] Then
            $sText &= $Arr[$i]
            ExitLoop
        EndIf
        
        $sText &= $Arr[$i+Random(0, 2, 1)] & @CRLF
    Next
    
    If StringRight($sText, 1) = @LF Then $sText = StringLeft($sText, StringLen($sText)-2)
    Local $aPath = StringRegExp($sFile, '^(.*\\)(.*)$', 1)
    FileWrite($aPath[0]&'('&@MON&'-'&@MDAY&'-'&@YEAR&' '&@HOUR&'-'&@MIN&'-'&@SEC&')'&$aPath[1], $sText)
EndIf

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...