Jump to content
Sign in to follow this  
dickjones007

select part of the text

Recommended Posts

dickjones007

is it possible to write the code that will open text file, then find specified word and move cursor to it.

then select all text after that word and delete it?

Share this post


Link to post
Share on other sites
UEZ

Try this:

If @OSArch = "X64" Then
    $au3dir = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\AutoIt v3\AutoIt", "InstallDir")
Else
    $au3dir = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt", "InstallDir")
EndIf
$sFile = FileRead($au3dir & "\Examples\_ReadMe_.txt")
$sSearch = "installed."
$sLen = StringLen($sSearch) - 1
$sNew = StringLeft($sFile, StringInStr($sFile, $sSearch) + $sLen)
MsgBox(0, "New Text", "Before: " & @LF & $sFile & @LF & @LF & "After: " & @LF & $sNew)

It will load the _ReadMe_.txt from AutoIt\Examples dir, search for "installed." and copy the text from start until "installed.".

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
dickjones007

Try this:

If @OSArch = "X64" Then
    $au3dir = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\AutoIt v3\AutoIt", "InstallDir")
Else
    $au3dir = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt", "InstallDir")
EndIf
$sFile = FileRead($au3dir & "\Examples\_ReadMe_.txt")
$sSearch = "installed."
$sLen = StringLen($sSearch) - 1
$sNew = StringLeft($sFile, StringInStr($sFile, $sSearch) + $sLen)
MsgBox(0, "New Text", "Before: " & @LF & $sFile & @LF & @LF & "After: " & @LF & $sNew)

It will load the _ReadMe_.txt from AutoIt\Examples dir, search for "installed." and copy the text from start until "installed.".

Br,

UEZ

thanks very much

that was a lot of help

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  

×