Hello i want to read my email and passw from .txt

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
TLM
Posts: 1608
Joined: 01 Oct 2013, 07:52
Contact:

Re: Hello i want to read my email and passw from .txt

06 Jan 2022, 15:39

@Blastoise465 unlike MsgBox, TrayTip won't stop for your confirmation to continue.

First off, this means that if you're reading more than one line of email:password pairs,
the loop will proceed so fast that TrayTip will seem to only display the last set of values.
Conversely, if the last line of values in text file EmailPass.txt has a trailing newline, the TrayTip will be blank.

To remedy this, you have to:
  1. Trim the trailing newline from the entire list of values in Email.
  2. Add a sleep to slow down the loop or a MsgBox after TrayTip so you can see each set of values.
Here's an example using RTrim() to remove trailing newlines from the end of Email variable and Sleep to slow the loop down:

Code: Select all

FileRead, Email, C:\EmailPass.txt

CredArr := { Email : [],Password : [] }
For i, Row in StrSplit( RTrim( Email, "`n" ), "`n", "`r" ) ; <-- added RTrim( Email ) to remove trailing newlines	
{
	Cred := StrSplit( Row, [ ":", " " ] )
	CredArr.Email.Push( LTrim( Cred.1 ) ), CredArr.Password.Push( LTrim( Cred.2 ) )

	TrayTip,, % "Email " i ": " CredArr.Email[ i ] "`nPassword " i ": " CredArr.Password[ i ], 2, 0x10	
	Sleep 2000 ; A TrayTip with new values will be displayed every 2 seconds with new values if any
}

Return
hth
Blastoise465
Posts: 58
Joined: 02 Jan 2022, 20:32

Re: Hello i want to read my email and passw from .txt

06 Jan 2022, 15:55

I tried that and i can see in my system tray the script pops up then disappears right away and no traytip is displayed i also tried this to slow down more and didnt work

Code: Select all



FilereadLine, Email, C:\EmailPass.txt, 1

CredArr := {Email : [],Password : [] }
For i, Row in StrSplit( RTrim( Email, "`n" ), "`n", "`r" )
{
	Cred := StrSplit( Row, [ ":", " " ] )
	CredArr.Email.Push( LTrim( Cred.1 ) ), CredArr.Password.Push( LTrim( Cred.2 ) )
Sleep 4000
	TrayTip,, % "Email " i ": " CredArr.Email[ i ] "`nPassword " i ": " CredArr.Password[ i ], 2, 0x10	
	Sleep 4000 ; A TrayTip with new values will be displayed every 2 seconds with new values if any
}

Return

Tab::Reload
ESC::ExitApp
i think its not displaying for 2 seconds like you coded it to with the ,2 ,0x10 on any of my scripts where i add traytip the timer doesnt work for the trytip so i was typing it out like this




Code: Select all



FilereadLine, Email, C:\EmailPass.txt, 1

CredArr := {Email : [],Password : [] }
For i, Row in StrSplit( RTrim( Email, "`n" ), "`n", "`r" )
{
	Cred := StrSplit( Row, [ ":", " " ] )
	CredArr.Email.Push( LTrim( Cred.1 ) ), CredArr.Password.Push( LTrim( Cred.2 ) )
Sleep 4000
	TrayTip,, % "Email " i ": " CredArr.Email[ i ] "`nPassword " i ": " CredArr.Password[ i ]    ;, 2, 0x10	
	Sleep 2000 ; A TrayTip with new values will be displayed every 2 seconds with new values if any
}			 ; With only sleep as timer 

Return

Tab::Reload
ESC::ExitApp

Also like this with the traytip timer included


Code: Select all




FilereadLine, Email, C:\EmailPass.txt, 1

CredArr := {Email : [],Password : [] }
For i, Row in StrSplit( RTrim( Email, "`n" ), "`n", "`r" )
{
	Cred := StrSplit( Row, [ ":", " " ] )
	CredArr.Email.Push( LTrim( Cred.1 ) ), CredArr.Password.Push( LTrim( Cred.2 ) )
Sleep 4000
	TrayTip,, % "Email " i ": " CredArr.Email[ i ] "`nPassword " i ": " CredArr.Password[ i ], 2, 0x10	
	Sleep 4000 ; A TrayTip with new values will be displayed every 2 seconds with new values if any
}

Return

Tab::Reload
ESC::ExitApp




Inside my EmailPass.txt all emails are like this

Email1@Email.com:Passw1
Email2@Email.com:Passw2
Email3@Email.com:Passw3
Email4@Email.com:Passw4
Email5@Email.com:Passw5
Email6@Email.com:Passw6
Email7@Email.com:Passw7
User avatar
TLM
Posts: 1608
Joined: 01 Oct 2013, 07:52
Contact:

Re: Hello i want to read my email and passw from .txt

06 Jan 2022, 15:57

Blastoise465 wrote:
06 Jan 2022, 15:55
Email1@Email.com:Passw1
Email2@Email.com:Passw2
Email3@Email.com:Passw3
......
And you're still trying to display only the 1st pair correct?

I just noticed that you are using FileReadLine.
In this case you don't even need to loop through each line value as there's only 1 line:

Code: Select all

FileReadLine, Email, C:\EmailPass.txt, 1

Cred := StrSplit( Email, [ ":", " " ] )
CredArr := { Email : LTrim( Cred.1 ), Password : LTrim( Cred.2 ) }
TrayTip,, % "Email: " CredArr.Email "`nPassword: " CredArr.Password, 2, 0x10
BTW, I reduced all of the lines from the variables in the TrayTip text parameter but it should display either way.
This will also work:

Code: Select all

TrayTip,, 	% "Email: " CredArr.Email
			. "`nPassword: " CredArr.Password, 2, 0x10	
Blastoise465
Posts: 58
Joined: 02 Jan 2022, 20:32

Re: Hello i want to read my email and passw from .txt

06 Jan 2022, 16:58

Yes i want it to display Email1:Email1@Email.com`nPassw1:Password1.

I've tried it many different ways When I run this test only the MsgBox and ToolTip works.

Code: Select all


i := 1
CredArr_Email := "email@abc.com"
CredArr_Password := "123456"

				TrayTip,,% "Email" i ":" 		CredArr_Email
					. "`nPassword" i ":" 	CredArr_Password, 2, 0x10
					Sleep  2000
				TrayTip % "CredArr_Email. `nCredArr_Password", 2, 0x10
					Sleep 2000
				TrayTip,,Works, 2, 0x10
					Sleep  2000
				ToolTip,% "Email" i ":" 		CredArr_Email
					. "`nPassword" i ":" 	CredArr_Password
					Sleep  2000
				MsgBox % "Email" i ":" 		CredArr_Email
					. "`nPassword" i ":" 	CredArr_Password
				
				Tab::Reload
				ESC::ExitApp
				
				
User avatar
boiler
Posts: 17222
Joined: 21 Dec 2014, 02:44

Re: Hello i want to read my email and passw from .txt

06 Jan 2022, 17:02

The standalone test I posted showed that your TrayTip isn’t working for some reason. Maybe it’s a Windows settings issue or something. It may just be that Windows is flaky. I’ve noticed that when those messages are generated by other programs, sometimes they don’t show up in a timely fashion, then suddenly bunches of them come through at once. I would not rely on it for important messages.
User avatar
TLM
Posts: 1608
Joined: 01 Oct 2013, 07:52
Contact:

Re: Hello i want to read my email and passw from .txt

06 Jan 2022, 17:26

@Blastoise465 let's take a step back.

Please try running just this from a fresh script:

Code: Select all

CredArr_Email 		:= "email@abc.com"
CredArr_Password 	:= "123456"

TrayTip,, % "Email: " CredArr_Email "`nPassword: " CredArr_Password, 2, 0x10
Do you still not see a TrayTip pop up with the email and password values?
Blastoise465
Posts: 58
Joined: 02 Jan 2022, 20:32

Re: Hello i want to read my email and passw from .txt

06 Jan 2022, 17:33

When i run it nothing happens shows System tray icon for the script and dissappears instantly no traytip pops up and my notification settings in windows are all good and active
User avatar
TLM
Posts: 1608
Joined: 01 Oct 2013, 07:52
Contact:

Re: Hello i want to read my email and passw from .txt

06 Jan 2022, 18:00

Sorry I forgot to add return:

Code: Select all

CredArr_Email 		:= "email@abc.com"
CredArr_Password 	:= "123456"

TrayTip,, % "Email: " CredArr_Email "`nPassword: " CredArr_Password, 2, 0x10
return

Esc::ExitApp ; <-- press escape to exit
Blastoise465
Posts: 58
Joined: 02 Jan 2022, 20:32

Re: Hello i want to read my email and passw from .txt

06 Jan 2022, 18:41

Doesnt work even w return I changed what you just posted to a MsgBox and works fine :/

Honestly since the traytips for me are either inconsistent or not working at all i can do something like this

Image

When I CheckBox Twitter then hit login it will read Email1:PassW1 from line 1 and if the email is in line 1 it will show

Email1:Email1@Email.com
PassW1:Password1
Status:Successful

Then continue my script and log me in to the website

If Email1:PassW1 from line 1 is not present then i want the ReadOnlyBox to say

Email1:Failed
PassW1:Failed
Status:Waiting


Will it be much harder this way for the ReadOnlyBox to show the Email1:PassW1:Status: instead of TrayTip?
Attachments
LoginSocials.png
LoginSocials.png (41.53 KiB) Viewed 1167 times
User avatar
boiler
Posts: 17222
Joined: 21 Dec 2014, 02:44

Re: Hello i want to read my email and passw from .txt

06 Jan 2022, 19:01

Blastoise465 wrote: Will it be much harder this way for the ReadOnlyBox to show the Email1:PassW1:Status: instead of TrayTip?
It is just as easy to have the ReadOnly Edit control show the status. You would just use GuiControl to update the text it displays.
amateur+
Posts: 655
Joined: 09 Oct 2021, 15:43

Re: Hello i want to read my email and passw from .txt

06 Jan 2022, 20:15

This function sends email, then sends {Tab}, then sends password, then sends {Enter}
Use SendInputEmailAndPassw(2) to input the second email+password, use SendInputEmailAndPassw(3) to input the third, and SendInputEmailAndPassw() or SendInputEmailAndPassw(1) to input the first.

Code: Select all

SendInputEmailAndPassw(pLineNumber := 1) {
	FileReadLine, EmailPassw, EmailPass.txt, % pLineNumber
	for each, value in StrSplit( EmailPassw, [ ":", A_Space, A_Tab ] ) 
		SendInput, % value ? value . (each = 1 ? "`t" : "`n") : ""
}
Or you can use absolutely the same logic with Loop, Parse:

Code: Select all

SendInputEmailAndPassw(pLineNumber := 1) {
	FileReadLine, EmailPassw, EmailPass.txt, % pLineNumber
	Loop, Parse, EmailPassw, % ": `t" 
		SendInput, % A_LoopField ? A_LoopField . (A_Index = 1 ? "`t" : "`n") : ""
}
And here are variants of these functions that allow to use ":" in passwords. You can test them on these examples:

Code: Select all

john@gmail.com:123:4b4:rtrs	
marta@gmail.com:zx6:7890	

Code: Select all

SendInputEmailAndPassw(pLineNumber := 1) {
	FileReadLine, EmailPassw, EmailPass.txt, % pLineNumber
	Loop, Parse, EmailPassw, % ": `t" 
	{	Pos += StrLen(A_LoopField) + 1
		SendInput, % A_LoopField ? (A_LoopField . (A_Index = 1 ? "`t" : (SubStr(EmailPassw, Pos, 1) != ":" ? "`n" : ":"))) : ""
	}
}

Code: Select all

SendInputEmailAndPassw(pLineNumber := 1) {
	FileReadLine, EmailPassw, EmailPass.txt, % pLineNumber
	for each, value in StrSplit( EmailPassw, [ ":", A_Space, A_Tab ] ) {
		Pos += StrLen(value) + 1
		SendInput, % value ? (value . (each = 1 ? "`t" : (SubStr(EmailPassw, Pos, 1) != ":" ? "`n" : ":"))) : ""
	}
}
Have found any drawback in my code or approach? Please, point it out. /The moderator ordered to remove the rest of the signature, I had obeyed.
And I really apologize for our russian president. Being a citizen of an aggressor country is very shameful. Personally I tried to avoid this trying to defend elections from fraud being a member of the election commission of one of the precincts but only was subjected to a hooligan attack and right before the vote count was illegally escorted from the polling station and spent the night behind bars (in jail) in a result of illegal actions of corrupt policemen.
Blastoise465
Posts: 58
Joined: 02 Jan 2022, 20:32

Re: Hello i want to read my email and passw from .txt

06 Jan 2022, 23:22

boiler wrote:
06 Jan 2022, 19:01
Blastoise465 wrote: Will it be much harder this way for the ReadOnlyBox to show the Email1:PassW1:Status: instead of TrayTip?
It is just as easy to have the ReadOnly Edit control show the status. You would just use GuiControl to update the text it displays.
How would i goo about doing that i tried to but i just hit dead ends for hours and try so many ways from google n it doesnt work
amateur+
Posts: 655
Joined: 09 Oct 2021, 15:43

Re: Hello i want to read my email and passw from .txt

07 Jan 2022, 00:55

What is the name of your Guicontrol (your "readonlybox")?
Read about GuiControlID here: https://www.autohotkey.com/docs/commands/GuiControl.htm
Put here the line where you initilize it. And it will be better if you post all your code (at least "gui"-part) here.

Once you know your guicontrol name, you can put it in this code below instead of YourGUIControlID.

Code: Select all

i := LineNumber ; Number of the row in your file.
Text :=  LineExist ; You should earlier set "LineExist := true" if email exists in chosen row of the file and set it false otherwise.
    ? "Email" . i . ":" . CredArr.Email[i] . "`n" . "Password" . i . ":" . CredArr.Password[i] . "`n" . "Status:Successful"
    : "Email" . i . ":Failed`nPassW" . i . ":Failed`nStatus:Waiting"
GuiControl, , YourGUIControlID, % Text
P.S. And don't read google, search in the documentation first.
Have found any drawback in my code or approach? Please, point it out. /The moderator ordered to remove the rest of the signature, I had obeyed.
And I really apologize for our russian president. Being a citizen of an aggressor country is very shameful. Personally I tried to avoid this trying to defend elections from fraud being a member of the election commission of one of the precincts but only was subjected to a hooligan attack and right before the vote count was illegally escorted from the polling station and spent the night behind bars (in jail) in a result of illegal actions of corrupt policemen.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: DaveF, peter_ahk and 219 guests