Jump to content

Problem text


Recommended Posts

Local $s = "TEXT" & @CRLF & "TEXT" & @CRLF & "TEXT" & @CRLF & "TEXT" & @CRLF & "TEXT"

Local $i = 0
Local $t = Execute("'" & StringRegExpReplace($s, "(?m)\w+\R?", "Welcome' & _Inc($i) & @CRLF & '") & "'")
ConsoleWrite($t & @CRLF)


Func _Inc(ByRef $n)
    $n += 1
    Return $n
EndFunc

Bot? Can't you say "program"?

Note that if you don't want a possible extra line termination at the end, then use that instead:

Local $t = Execute("'" & StringRegExpReplace($s, "(?m)\w+(\R?)", "Welcome' & _Inc($i) & '$1' & '") & "'")

Also if you want a running counter across several uses, plus the ability to reset the counter when needed, then try this:

Local $s = "TEXT" & @CRLF & "TEXT" & @CRLF & "TEXT" & @CRLF & "TEXT" & @CRLF & "TEXT"

Local $t = Execute("'" & StringRegExpReplace($s, "(?m)\w+(\R?)", "Welcome' & _RunningCount() & '$1' & '") & "'")
ConsoleWrite($t & @CRLF)

ConsoleWrite("Another invokation" & @CRLF)
$t = Execute("'" & StringRegExpReplace($s, "(?m)\w+(\R?)", "Welcome' & _RunningCount() & '$1' & '") & "'")
ConsoleWrite($t & @CRLF)

ConsoleWrite("Reset count then yet another invokation" & @CRLF)
_RunningCount(1)
$t = Execute("'" & StringRegExpReplace($s, "(?m)\w+(\R?)", "Welcome' & _RunningCount() & '$1' & '") & "'")
ConsoleWrite($t & @CRLF)

Func _RunningCount($bReset = 0)
    Local Static $n
    $n = $bReset ? 0 : $n + 1
    Return $n
EndFunc

 

Edited by jchd

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

I meant something like that.

I would like it to change the text in Notepad++ and not show MSGBOX.

MsgBox(0, "TEST", "Load the source text")

$sTxt = ControlGetText("[CLASS:Notepad]", "", "Edit1")

$iNR=0

MsgBox(64, "Source text", $sTxt)
Do
   $iNR += 1
   $sTxt = StringReplace($sTxt, "Test", "ProgramNR" & $iNR, 1)
Until @extended=0

MsgBox(64, "Result text", $sTxt)

 

Link to comment
Share on other sites

And your issue is?

Remove your MsgBox-es and use ControlSetText at the end.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Thanks! How to make my code from random letters and numbers twice the same?

Example:

With

TestTestTest@gmail.com
TestTestTest@gmail.com
TestTestTest@gmail.com
TestTestTest@gmail.com
TestTestTest@gmail.com
TestTestTest@gmail.com

On

GAW54WG87GW8@gmail.com
GAW54WG87GW8@gmail.com
POMTE9ET74TE@gmail.com
POMTE9ET74TE@gmail.com
WOIMGPT7T21T@gmail.com
WOIMGPT7T21T@gmail.com

 

Link to comment
Share on other sites

  • Moderators

KamKam,

And what exactly is the end point of all this? What are you trying to do?

M23

P.S. And just to be absolutely clear - this is the Mod team determining the legality of the thread, so everyone else please keep out.

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

 

Link to comment
Share on other sites

Okay, another question. How to make a loop after 2 times the same is repeated and then the other repeats after 2 times but it does not end.

Example:

ABC111
ABC111
ABC222
ABC222
ABC333
ABC333
ABC444
ABC444
ABC555
ABC555

 

Link to comment
Share on other sites

  • Moderators

KamKam,

And from where do you get these "randomly select[ed] nickname and email" elements? Why do you need to randomly select one of them?

M23

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

 

Link to comment
Share on other sites

  • Moderators

KamKam,

That sounds to me as if it breaks the injunction in the Forum rules regarding not discussing game automation - so the thread is locked. Please read those rules before you post again and make sure you follow them in future.

M23

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

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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