Jump to content
Sign in to follow this  
Needle

Write without changes a text piece in file?

Recommended Posts

Needle

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

Share this post


Link to post
Share on other sites
wakillon

Which lines ?

Can you show an initial text and a like you want text ?


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

Share this post


Link to post
Share on other sites
Needle

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

Share this post


Link to post
Share on other sites
Needle

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 ] )

Share this post


Link to post
Share on other sites
wakillon

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

Share this post


Link to post
Share on other sites
Needle

wakillon

Thanks but here also are present a description in manual hyphens, and it is handwork. It would not be desirable it

Share this post


Link to post
Share on other sites
wakillon

wakillon

Thanks but here also are present a description in manual hyphens, and it is handwork. It would not be desirable it

Posted Image


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

Share this post


Link to post
Share on other sites
Needle

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

Share this post


Link to post
Share on other sites
Jos

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

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

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
wakillon

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

Try Google Translate service ! Posted Image


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

Share this post


Link to post
Share on other sites
Needle

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

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

Share this post


Link to post
Share on other sites
Needle

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

Share this post


Link to post
Share on other sites
wakillon

Please give 2 parts :

1- Text before change

2 - Text After change

It will help to understand what you want ! Posted Image


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

Share this post


Link to post
Share on other sites
Needle

Here I am stupid :mellow:

how to type in the code SciTE

dont use & @ CRLF & _

dont use FileWriteLine

Edited by Needle

Share this post


Link to post
Share on other sites
Zedna

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

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  

×