i need help to add the password to this script any help would be appreciated.
i been pulling hairs over this and i am still clueless.
//read the file of usernames
ReadFile>c:\usernames.txt,allFile
Separate>allFile,CRLF,usernames
If>usernames_count=0
//just exit if the file is empty
Exit>0
Endif
//create IE instance
IE_Create>0,IE[0]
//loop through the list of usernames and login for each one
Let>k=0
Repeat>k
Let>k=k+1
Let>this_username=usernames_%k%
IE_Navigate>%IE[0]%,(URL),r
IE_Wait>%IE[0]%,r
Wait>delay
Let>FrameName={""}
Let>FormName={""}
Let>FieldName={"ctl00$bodyContent$UserName"}
Let>FieldValue=this_username
IE_FormFill>%IE[0]%,str:FrameName,str:FormName,str:FieldName,str:FieldValue,0,r
Let>FrameName={""}
Let>FormName={""}
Let>FieldName={"ctl00$bodyContent$Password"}
Let>FieldValue=this_Password
IE_FormFill>%IE[0]%,str:FrameName,str:FormName,str:FieldName,str:FieldValue,0,r
Let>FrameName={""}
Let>FormName={""}
Let>TagValue={"Sign In"}
IE_ClickTag>%IE[0]%,str:FrameName,str:FormName,A,TEXT,str:TagValue,r
//do something
//log out
//DO NOT CLOSE IE just yet - we want it open so we can loop back to the navigate
//there's no point closing and reopening it ...
Until>k=usernames_count
reading username and password from text file
Moderators: Dorian (MJT support), JRL
Re: reading username and password from text file
Where will the passwords be coming from? Are they in the same file as the usernames?
I would change the line:
If>usernames_count=0
to
If>usernames_count<2
Which will also account for file does not exist.
I would change the line:
If>usernames_count=0
to
If>usernames_count<2
Which will also account for file does not exist.
Re: reading username and password from text file
both the user name and password would be in the same txt file separated by ; e.g
username1;password1
username2;password2
username3;password3
username1;password1
username2;password2
username3;password3
Re: reading username and password from text file
This should be close:
Code: Select all
//read the file of usernames
ReadFile>c:\usernames.txt,allFile
Separate>allFile,CRLF,usernames
If>usernames_count<2
//just exit if the file is empty
Exit>0
Endif
//create IE instance
IE_Create>0,IE[0]
//loop through the list of usernames and login for each one
Let>k=0
Repeat>k
Let>k=k+1
//Value becomes the "k"th line from file c:\usernames.txt
Let>Value=usernames_%k%
//Separate the line by ";" giving two items.
//"This_User_1' is the user name
//"This_User_2' is the password
Separate>Value,;,This_User
IE_Navigate>%IE[0]%,(URL),r
IE_Wait>%IE[0]%,r
Wait>delay
Let>FrameName={""}
Let>FormName={""}
Let>FieldName={"ctl00$bodyContent$UserName"}
//Enter the user name "This_User_1"
Let>FieldValue=This_User_1
IE_FormFill>%IE[0]%,str:FrameName,str:FormName,str:FieldName,str:FieldValue,0,r
Let>FrameName={""}
Let>FormName={""}
Let>FieldName={"ctl00$bodyContent$Password"}
//Enter the password "This_User_2"
Let>FieldValue=This_User_2
IE_FormFill>%IE[0]%,str:FrameName,str:FormName,str:FieldName,str:FieldValue,0,r
Let>FrameName={""}
Let>FormName={""}
Let>TagValue={"Sign In"}
IE_ClickTag>%IE[0]%,str:FrameName,str:FormName,A,TEXT,str:TagValue,r
//do something
//log out
//DO NOT CLOSE IE just yet - we want it open so we can loop back to the navigate
//there's no point closing and reopening it ...
Until>k=usernames_count
Re: reading username and password from text file
JRL sorry for the late reply recently i just got very busy. just wanted to say thank you i really appreciate you taking the time to help me sort this out. once again thank you