Jump to content

[SOLVED] Convert Texts in Array and ConsoleWrite


Recommended Posts

Hi AutoIt Scriptwriters! :)
I want to extract my RDPs informations and write in file/console

here is my code:

$txt = "127.0.0.1:3389@Administrator;12345" & @CRLF & "120.0.0.1:3389@Guest;54321"
$ArrayTXT = StringSplit($txt, @CRLF, 3)
For $IP In $ArrayTXT
   $Ex_IPAddress = StringRegExpReplace($IP, ":.*", "")
   $Ex_IPAddressPort = StringRegExpReplace($IP, "@.*", "")
   $Ex_DomainUsername = StringRegExpReplace(StringRegExpReplace($IP, ";.*", ""), ".*@", "")
   $Ex_Password = StringRegExpReplace($IP, ".*;", "")

   $O_RDPFile = "full ip address: " & $Ex_IPAddressPort & @CRLF & "username: " & $Ex_DomainUsername & @CRLF & "password: " & $Ex_Password & @CRLF & @CRLF
   ConsoleWrite($O_RDPFile)
Next

I want to extract texts, convert them and then show in console or write in file like this:

full ip address: 127.0.0.1:3389
username: Administrator
password: 12345

full ip address: 120.0.0.1:3389
username: Guest
password: 54321

[SOLVED] I've putted on right code here, you can use this little code if you need :)

Edited by Colduction
Link to comment
Share on other sites

1 hour ago, Colduction said:

here is my code

Apparently SRER don't scare you so you might use this one too  :)

$txt = "127.0.0.1:3389@Administrator;12345" & @CRLF & "120.0.0.1:3389@Guest;54321"

Msgbox(0,"", StringRegExpReplace($txt, '(?m)^(.*?)@(.*?);(.*)', _ 
        "full ip address: $1" & @crlf & "username: $2" & @crlf & "password: $3" & @crlf) )

 

Link to comment
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
 Share

  • Recently Browsing   0 members

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