08089 Posted June 24, 2019 Posted June 24, 2019 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
Moderators Melba23 Posted June 24, 2019 Moderators Posted June 24, 2019 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 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Developers Jos Posted June 24, 2019 Developers Posted June 24, 2019 @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.
08089 Posted June 24, 2019 Author Posted June 24, 2019 @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.
Developers Jos Posted June 24, 2019 Developers Posted June 24, 2019 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.
08089 Posted June 25, 2019 Author Posted June 25, 2019 @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.
Developers Jos Posted June 25, 2019 Developers Posted June 25, 2019 (edited) 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 June 25, 2019 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.
Recommended Posts