Jump to content
Sign in to follow this  
08089

If want to replace the string that behind the character "pipe" will failed - (Moved) - (Locked)

Recommended Posts

Hi all,

I need to replace the value behind the character "pipe". but it also replace another similar strings ....

For example,

the test.text have below strings

howdoyouturnthison|TRUE
hiiammemory|FALSE
howdoyouturnt2638|TRUE
hiiam666978|FALSE

And I want to replace "howdoyouturnthison|TRUE" to "howdoyouturnthison|FALSE"

But it also replace "howdoyouturnt2638|TRUE" to "howdoyouturnthison|FALSE" because "|".  

This is my code..

#include <File.au3>

$Base = (@ScriptDir & "\test.txt")

FileOpen($Base)
$x = _FileCountLines($Base)

For $i = 1 to $x
    $line0 = FileReadLine($Base, $i)
    $line = String($line0)
    $sTextToFind = $line

    If StringRegExp("howdoyouturnthison"&"/|"&"TRUE", $sTextToFind) Then

        _FileWriteToLine($Base, $i, "howdoyouturnthison|False", True)

    EndIf

Next

msgbox(0,'Result','Finished')

Is there some pattern that would resolve this issue? 

Thank you for the help

 

Share this post


Link to post
Share on other sites

Moved to the appropriate forum, as the Developer General Discussion forum very clearly states:

Quote

General development and scripting discussions. If it's super geeky and you don't know where to put it - it's probably here.


Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums.

Moderation Team


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

@08089, This looks very much like Age of Empires so please also first read our forum rules before continuing as we have strict rules for game automations.

Jos


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

@Jos, Sorry to had caused you misunderstand. But I didn't try to wrote a script for automation of Age of Empires. These strings just the samples.... I just need to change some switchs of the another file because of work demands.

Share this post


Link to post
Share on other sites
1 hour ago, 08089 said:

These strings just the samples

Seriously?, you just took some example data used for  game but really don't need it for that but something else .....right?

 


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

@JosI'm serious! These data not from any games. Actually these data not the real code I want to write. I made up these strings. The inspiration indeed from Age of Empires...

If it make you feel I want to do the game automation. you misunderstand. Sorry about that. 

Share this post


Link to post
Share on other sites

 

5 hours ago, 08089 said:

These data not from any games

 

5 hours ago, 08089 said:

The inspiration indeed from Age of Empires

...  serious right! So one joins the forum to be able to post a question and uses data that is game related (not inspired) and this insist the question isn't ,

Not convinced ...   thus:

Unfortunately you appear to have missed the Forum rules on your way in. Please read them now - particularly the bit about not discussing game automation - and then you will understand why you will get no help and this thread will now be locked.

See you soon with a legitimate question I hope.

The Moderation team

 

Edited by Jos

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
Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...