Jump to content

Write without changes a text piece in file?


Recommended Posts

Hey guys !

I need to keep in file.txt many lines of the text , keeping all blanks and signs

On similarity of it text

<layout version="1.0">
    <window x="2560" y="0" w="1609" h="1200" screen="1">
        <splitter orientation="1">
            <split size="1064"></split>
            <splitter orientation="1">
                <split size="63"></split>
                <dock id="" hideTitles="1" activePageId="Toolbar.1">
                    <page id="Toolbar.1"></page>

Thanks, excuse for my bad English :mellow:

Edited by Needle
Link to comment
Share on other sites

I used FileWriteLine but it isn't convenient

It is necessary for me all lines at once instead of on one

The original text

Root {
 inputs 0
 name SideBySide_mov.nk
 format "2048 1556 0 0 2048 1556 1 2K_Super_35(full-ap)"
 proxy_type scale
 proxy_format "1024 778 0 0 1024 778 1 1K_Super_35(full-ap)"
 views "left #ff0000
 right #00ff00"
}

I wrote so but it isn't convenient

FileWriteLine($filem, "Root {")
    FileWriteLine($filem, " inputs 0")
    FileWriteLine($filem, " name SideBySide_mov.nk")
    FileWriteLine($filem, ' format "2048 1556 0 0 2048 1556 1 2K_Super_35(full-ap)" ')
    FileWriteLine($filem, " proxy_type scale")
    FileWriteLine($filem, ' proxy_format "1024 778 0 0 1024 778 1 1K_Super_35(full-ap)"')
    FileWriteLine($filem, ' views "left #ff0000')
    FileWriteLine($filem, 'right #00ff00"')
    FileWriteLine($filem, "}")

Thanks that you have responded :mellow:

Edited by Needle
Link to comment
Share on other sites

Excuse but I probably that that not absolutely I understand,

I don't need that that to replace,

I need to keep the text in a primordial form,

without doing it to postfates with the help FileWriteLine

in help

Replace text in a string based on regular expressions.

StringRegExpReplace ( "test", "pattern", "replace", [ count ] )

Link to comment
Share on other sites

Do you mean this ?

$_Text = "Root {" & @CRLF & _
         " inputs 0" & @CRLF & _
         " name SideBySide_mov.nk" & @CRLF & _
         ' format "2048 1556 0 0 2048 1556 1 2K_Super_35(full-ap)"' & @CRLF & _
         " proxy_type scale" & @CRLF & _
         ' proxy_format "1024 778 0 0 1024 778 1 1K_Super_35(full-ap)' & @CRLF & _
         ' views "left #ff0000' & @CRLF & _
         'right #00ff00"' & @CRLF & _
         "}" & @CRLF

ConsoleWrite ( "$_Text : " & $_Text & @Crlf )
FileWrite ( $filem, $_Text )

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

  • Developers

excuse for my bad English :mellow: excuse excuse excuse excuse

No need for that, just try to better explain what you want. :)

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.
  :)

Link to comment
Share on other sites

спасибо за помощь ваш вариант тоже не подходит так как придется делать работу руками добавляя & @CRLF & _

Thanks for your help option is also not suitable as hand will do the job by adding & @ CRLF & _

Link to comment
Share on other sites

similar Python

example 1

string = """ bla bla bla """

example 2

string = """
Root {
 inputs 0
 name SideBySide_mov.nk
 format "2048 1556 0 0 2048 1556 1 2K_Super_35(full-ap)"
 proxy_type scale
 proxy_format "1024 778 0 0 1024 778 1 1K_Super_35(full-ap)"
 views "left #ff0000
 right #00ff00"
}"""

as will autoitscript ? :)

excuse for my bad English :mellow:

Edited by Needle
Link to comment
Share on other sites

  • 5 weeks later...

Here I am stupid :mellow:

how to type in the code SciTE

dont use & @ CRLF & _

dont use FileWriteLine

I doubt there is no direct way

but there is indirect way for this.

You can write your large multiline text to separate TXT file and then add this file as resource file

it will be included in your compiled EXE file.

At runtime you can load this large multiline TXT file by _ResourceGetAsString()

Look at my Resources UDF:

Edited by Zedna
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...