Hello i want to read my email and passw from .txt
-
- Posts: 58
- Joined: 02 Jan 2022, 20:32
Hello i want to read my email and passw from .txt
Hello I was trying to find out how I can read a txtfile with my Emails and passwords saved in the format Email:Password each line will have a different email and password for my different socials and websites I frequent. in my script i will have a hotkey load a specific website and then i want to be able to enter the Email and password in to the email:password fields with a (SendInput, Email) and different hotkey for (SendInput, Password) i have the scripts working for clicking some sites just need to figure out how to read from file and tell that (Email):(Password)
Re: Hello i want to read my email and passwfrom .txt
You would use FileRead to read the text file contents into a variable. Then you can split the lines using either a parsing loop or StrSplit() using `n as the delimiter and `r as the character to omit (in case your file uses both). Then you can either use RegExMatch() or StrSplit() again to separate each email from its password based on the : delimiter.
-
- Posts: 58
- Joined: 02 Jan 2022, 20:32
Re: Hello i want to read my email and passwfrom .txt
So here is my code it takes Email from Email:Passw and makes a traytip
I also want to take the password and do same thing but when I run the code for password it get the last password on my email list that contains 7 emails and passw
How can I read line one but get the password as I already can get the email? And Is it possible to add timestamp for last time that Email password combination used in a traytip?
Thank you so much for your quick response
Code: Select all
fileread, Email, EmailPass.txt
for i, row in Loopobj:=strsplit(Email,"`n","`r"){
pos:=instr(Row,"m:",,0,1)
traytip,Entering as email, % substr(Row,1,pos), 2, 0x10
return
}
return
I also want to take the password and do same thing but when I run the code for password it get the last password on my email list that contains 7 emails and passw
Code: Select all
fileread, Email, EmailPass.txt
for k, v in strsplit(Email,[":"," "])
if(instr(v,":"))
emails.=v "`n"
msgbox % v
return
How can I read line one but get the password as I already can get the email? And Is it possible to add timestamp for last time that Email password combination used in a traytip?
Thank you so much for your quick response
Re: Hello i want to read my email and passwfrom .txt
You can parse the email & password combinations all in one loop like this:The CredArr stores the values so you can use them elsewhere later on.
If you want to do everything in one loop, you don't need the storage array:
Please see the docs for further information.
hth
Code: Select all
fileread, Email, EmailPass.txt
CredArr := { Email : [], Password : [] } ; <-- Credential array to store the emails & passwords
For i, Row in StrSplit( Email, "`n", "`r" )
{
Cred := StrSplit( Row, [ ":", " " ] )
CredArr.Email.Push( Cred.1 ), CredArr.Password.Push( Cred.2 )
msgbox % "Email " i ": " CredArr.Email[ i ]
. "`nPassword " i ": " CredArr.Password[ i ]
}
Return
If you want to do everything in one loop, you don't need the storage array:
Code: Select all
fileread, Email, EmailPass.txt
For i, Row in StrSplit( Email, "`n", "`r" )
{
Cred := StrSplit( Row, [ ":", " " ] )
msgbox % "Email " i ": " Cred.1
. "`nPassword " i ": " Cred.2
}
hth
-
- Posts: 58
- Joined: 02 Jan 2022, 20:32
Re: Hello i want to read my email and passwfrom .txt
Awesome thank you so much so if i want to only read first row what would i change in that code? also can i use the email in a SendInput,Email from first row then press enter then use the password and use it in a SendInput,Passwordfrom first row?? i tried %Email% and "Email" and wouldnt insert it from the file only would insert the text %Email% and "Email"
Re: Hello i want to read my email and passwfrom .txt
You can swap FileRead with FileReadLine:Blastoise465 wrote: ↑03 Jan 2022, 11:13Awesome thank you so much so if i want to only read first row what would i change
Code: Select all
FileReadLine, Email, EmailPass.txt, 1
Cred := StrSplit( Email, [ ":", " " ] )
Msgbox % "1st Email: " Cred.1 "`n1st Password: " Cred.2
return
Code: Select all
fileread, Email, EmailPass.txt
Creds := StrSplit( Email, "`n", "`r" )
Cred := StrSplit( Creds.1, [ ":", " " ] )
Msgbox % "1st Email: " Cred.1 "`n1st Password: " Cred.2
return
You have to use an Expression in SendInput.Blastoise465 wrote: ↑03 Jan 2022, 11:13can i use the email in a SendInput,Email from first row then press enter then use the password and use it in a SendInput,Passwordfrom first row??
Assuming you're using the storage Array an the Enter key as the hotkey:
Code: Select all
FileRead, Email, Email.txt
CredArr := { Email : [], Password : [] }
For i, Row in StrSplit( Email, "`n", "`r" )
{
Cred := StrSplit( Row, [ ":", " " ] )
CredArr.Email.Push( Cred.1 ), CredArr.Password.Push( Cred.2 )
}
return
Enter: ; Long Form Hotkey
if ( !cnt )
{
SendInput % CredArr.Email.1 ; the % forces expression mode
cnt := 1
}
else
{
SendInput % CredArr.Password.1
cnt := 0
}
return
htms
-
- Posts: 58
- Joined: 02 Jan 2022, 20:32
Re: Hello i want to read my email and passwfrom .txt
IT works Many thanks to you all for the help! and i noticed one thing about the last script it works but it adds a space infront off email and password i tried eliminating spaces but got an error is there a specific way to remove the spaces from you code output? saying wrong password with spaces in front?
Code: Select all
FileRead, Email, Email.txt
CredArr := { Email : [], Password : [] }
For i, Row in StrSplit( Email, "`n", "`r" )
{
Cred := StrSplit( Row, [ ":", " " ] )
CredArr.Email.Push( Cred.1 ), CredArr.Password.Push( Cred.2 )
}
return
Enter: ; Long Form Hotkey
if ( !cnt )
{
SendInput % CredArr.Email.1 ; the % forces expression mode
cnt := 1
}
else
{
SendInput % CredArr.Password.1
cnt := 0
}
return
Re: Hello i want to read my email and passwfrom .txt
Trim() will remove any leading spaces and tabs from the front and end. Use LTrim() if you specifically only want to trim space from the front end.Blastoise465 wrote: ↑ is there a specific way to remove the spaces from you code output? saying wrong password with spaces in front?
Code: Select all
SendInput % Trim(CredArr.Email.1)
It would actually be better to trim them at the time they are added to the array instead of when you send the output:
Code: Select all
CredArr.Email.Push( Trim(Cred.1) ), CredArr.Password.Push( Trim(Cred.2) )
-
- Posts: 58
- Joined: 02 Jan 2022, 20:32
Re: Hello i want to read my email and passwfrom .txt
Ive tried putting both of those scripts in multiple spots and doesnt work sometimes itll only show one character of the email or password
Ive tried in these few spots didnt work kept the space or only showed one character in message box
Code: Select all
Find_Image:
Stop:=0
While(Stop=0)
{
;Loop
filereadLine, Email, C:\EmailPass.txt,1
CredArr := { Email : [], Password : [] } ; <-- Credential array to store the emails & passwords
CredArr.Email.Push( Trim(Cred.1) ), CredArr.Password.Push( Trim(Cred.2) );;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
For i, Row in StrSplit( Email, "`n", "`r" )
{
(CredArr.Email.Push( Trim(Cred.1) ), CredArr.Password.Push( Trim(Cred.2) ));;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Cred := StrSplit( Row, [ ":", " " ] )
CredArr.Email.Push( Trim(Cred.1) ), CredArr.Password.Push( Trim(Cred.2) );;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
CredArr.Email.Push( Cred.1 ), CredArr.Password.Push( Cred.2 )
msgbox % "Email " i ": " CredArr.Email[ i ]
. "`nPassword " i ": " CredArr.Password[ i ]
CredArr.Email.Push( Trim(Cred.1) ), CredArr.Password.Push( Trim(Cred.2) );;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
}
Ive tried in these few spots didnt work kept the space or only showed one character in message box
Re: Hello i want to read my email and passwfrom .txt
This type of change with the addition of the Trim() function:
...is meant to go in place of this line:
...not in addition to it.
If you had a line that was working before except the output had a space before it like you described before, then adding Trim() as suggested can only remove the space. It wouldn't do anything else. It's hard to tell what you've done because you show the same or similar lines repeated in the same group of line. Show the code you had before, and show what you did after (this time only trying to implement the Trim() into existing lines, not adding new lines).
Code: Select all
CredArr.Email.Push( Trim(Cred.1) ), CredArr.Password.Push( Trim(Cred.2) )
Code: Select all
CredArr.Email.Push( Cred.1 ), CredArr.Password.Push( Cred.2 )
If you had a line that was working before except the output had a space before it like you described before, then adding Trim() as suggested can only remove the space. It wouldn't do anything else. It's hard to tell what you've done because you show the same or similar lines repeated in the same group of line. Show the code you had before, and show what you did after (this time only trying to implement the Trim() into existing lines, not adding new lines).
Re: Hello i want to read my email and passwfrom .txt
Not sure how to make it clearer than this...
This part of the code:
...would become this:
Only one line was changed to trim the spaces around a couple of the array elements. No lines were added.
This part of the code:
Code: Select all
CredArr := { Email : [], Password : [] }
For i, Row in StrSplit( Email, "`n", "`r" )
{
Cred := StrSplit( Row, [ ":", " " ] )
CredArr.Email.Push( Cred.1 ), CredArr.Password.Push( Cred.2 )
}
return
Code: Select all
CredArr := { Email : [], Password : [] }
For i, Row in StrSplit( Email, "`n", "`r" )
{
Cred := StrSplit( Row, [ ":", " " ] )
CredArr.Email.Push( Trim(Cred.1) ), CredArr.Password.Push( Trim(Cred.2) ) ; <<< this line was changed
}
return
Only one line was changed to trim the spaces around a couple of the array elements. No lines were added.
-
- Posts: 58
- Joined: 02 Jan 2022, 20:32
Re: Hello i want to read my email and passw from .txt
Ok so this is all the code for wheat I am trying to do with test gui from CivReborn youtube channel help
It isnt working maybe I have something else entered wrong in this code?
Code: Select all
#SingleInstance, Force
if not A_IsAdmin
Run *RunAs "%A_ScriptFullPath%"
SetWorkingDir,%A_ScriptDir%
CoordMode,Mouse,Screen
CoordMode,Pixel,Screen
Gui,2:+AlwaysOnTop
Gui,2:Add,Button,x10 y10 w200 h20 gFind_IconImage,Login
Gui,2:Add,Button,x10 w200 h20 gGui_1,Load / Reload Icon
Gui,2:Add,Text,x10 ,Press Numpad 1 to stop
Gui,2:Show,x1000 y200
return
2GuiClose:
ExitApp
Find_IconImage:
Stop:=0
While(Stop=0)
{
;Loop
filereadLine, Email, C:\EmailPass.txt,1
CredArr := { Email : [], Password : [] } ; <-- Credential array to store the emails & passwords
For i, Row in StrSplit( Email, "`n", "`r" )
{
Cred := StrSplit( Row, [ ":", " " ] )
CredArr.Email.Push( LTrim(Cred.1) ), CredArr.Password.Push( LTrim(Cred.2) )
CredArr.Email.Push( Cred.1 ), CredArr.Password.Push( Cred.2 )
msgbox % "Email " i ": " CredArr.Email[ i ]
. "`nPassword " i ": " CredArr.Password[ i ]
}
;ImageSearch, OutputVarX, OutputVarY, X1, Y1, X2, Y2, ImageFile
ImageSearch, Loc_X, Loc_Y, 0,0, A_ScreenWidth, A_ScreenWidth,C:\IconImage.png
if(ErrorLevel=2)
{
TrayTip,,= 2`nSomething is wrong`n, 2, 0x10
return
}
else if(ErrorLevel=1)
{
TrayTip,,`nWaiting for Icon`n, 2, 0x10
Stop:=0
return
}
else if(ErrorLevel=0)
tx:=Loc_X+(posw//2)
ty:=Loc_Y+(posh//2)
MouseMove,Loc_X+(posw//2) ,Loc_Y+(posh//2)
Click, %tx% %ty%
TrayTip,,`nFound! Logging in`n, 2, 0x10
MouseMove, 1130, 480
Sleep 5
Click
Sleep 5
Click
Sleep 5
Send, {Ctrl Down} {a Down}
Sleep 5
Send, {Ctrl Up} {a Up}
Sleep 5
{
SendInput % CredArr.Email.1
cnt := 1
}
Sleep 5
MouseMove, 1130, 530
Sleep 5
Click
Sleep 5
Click
Sleep 5
Send, {Ctrl Down} {a Down}
Sleep 5
Send, {Ctrl Up} {a Up}
Sleep 5
{
SendInput % CredArr.Password.1
cnt := 0
}
Sleep 50
;Send, {Enter 1}
Sleep 50
return
}
GuiContextMenu:
Gui,1:Destroy
return
Move_Window:
Random,new_x,0,A_ScreenWidth-posw
Random,new_y,0,A_ScreenHeight-posh
Gui,1:Show,x%New_x% y%new_y%
return
Gui_1()
{
global
Gui,1:Destroy
Gui,1:Margin,0,0
Gui,1:+AlwaysOnTop -caption +Owner2
Gui,1:Add,Picture,x0 y0 vClip_Picture gMove_Window,C:\IconImage.png
GuiControlGet,pos,1:pos,Clip_Picture
Gui,1:Show, AutoSize
}
Tab::
Stop:=1
reload
ESC::ExitApp
It isnt working maybe I have something else entered wrong in this code?
Re: Hello i want to read my email and passw from .txt
I thought I couldn’t make it more clear that you wouldn’t have more than one version of the same line (the exact same as each other but one version trims spaces), so why do you have both of these two lines in your code? :
Code: Select all
CredArr.Email.Push( LTrim(Cred.1) ), CredArr.Password.Push( LTrim(Cred.2) )
CredArr.Email.Push( Cred.1 ), CredArr.Password.Push( Cred.2 )
-
- Posts: 58
- Joined: 02 Jan 2022, 20:32
Re: Hello i want to read my email and passw from .txt
Well I tried it with those lines in different spots and wouldn't work. I also tried each line alone in few spots and none will remove spaces I'm new to this and seems like a easy thing to fix but I've tried multiple different Solutions and it hasn't worked. In the text file there is no spaces But when i sendinput from the first line of the file it inputs spaces there is spaces it also shows in the message box with spaces
Email1: EmailEmail@Email.com
Passw1: PasswPasswPassw
Email1: EmailEmail@Email.com
Passw1: PasswPasswPassw
Code: Select all
filereadLine, Email, C:\EmailPass.txt,1
CredArr := {Email : [],Password : [] } ; <-- Credential array to store the emails & passwords
For i, Row in StrSplit( Email, "`n", "`r" )
{
Cred := StrSplit( Row, [ ":", " " ] )
CredArr.Email.Push( LTrim(Cred.1) ), CredArr.Password.Push( LTrim(Cred.2) ) ; <<< this line was changed
MsgBox % "Email " i ": " CredArr.Email[ i ]
. "`nPassword " i ": " CredArr.Password[ i ]
Re: Hello i want to read my email and passw from .txt
That’s because your MsgBox has spaces (the ones inside the sets of quotation marks), not because the data contains spaces. If you don’t want spaces in the MsgBox output, remove them. That line would be like this with the output spaces removed:
Code: Select all
MsgBox % "Email" i ":" CredArr.Email[ i ]
. "`nPassword" i ":" CredArr.Password[ i ]
-
- Posts: 58
- Joined: 02 Jan 2022, 20:32
Re: Hello i want to read my email and passw from .txt
Is it possible to make that msgbox a TrayTip??
I tried this way and it didnt work
If that can be a trayTip that would be so cool!
Code: Select all
MsgBox % "Email" i ":" CredArr.Email[ i ]
. "`nPassword" i ":" CredArr.Password[ i ]
Code: Select all
TrayTip,, % "Email" i ":" CredArr.Email[ i ]
. "`nPassword" i ":" CredArr.Password[ i ], 2, 0x10
Re: Hello i want to read my email and passw from .txt
There’s no reason it couldn’t be. Did you try it?
-
- Posts: 58
- Joined: 02 Jan 2022, 20:32
Re: Hello i want to read my email and passw from .txt
yes I tried like this it doesn't show me the traytip nothing happens script just continues
Code: Select all
TrayTip,, % "Email" i ":" CredArr.Email[ i ]
. "`nPassword" i ":" CredArr.Password[ i ]
Re: Hello i want to read my email and passw from .txt
Try running the following as a standalone test script and see if it produces a TrayTip. It does for me.
Code: Select all
i := 1
CredArr_Email := "email@abc.com"
CredArr_Password := "123456"
TrayTip,, % "Email" i ":" CredArr_Email
. "`nPassword" i ":" CredArr_Password
-
- Posts: 58
- Joined: 02 Jan 2022, 20:32
Re: Hello i want to read my email and passw from .txt
I tried it and it did not work so I tried this to double check and with MsgBox did work
Code: Select all
i := 1
CredArr_Email := "email@abc.com"
CredArr_Password := "123456"
MsgBox % "Email" i ":" CredArr_Email
. "`nPassword" i ":" CredArr_Password
;Tab::Reload