Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Autologin for different Sites
#1
I put some snippets together and tried to change some code.
Maybe i did something right, but it seems that i also did something wrong. :lol:
Can anybody help me to correct this and make it complete?

Function Dialog67
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

str controls = "5 6"
str e5 e6
if(!ShowDialog("Dialog67" &Dialog67 &controls)) ret

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 204 190 "Dialogin"
;3 Static 0x54000000 0x0 4 6 48 12 "user"
;4 Static 0x54000000 0x0 4 22 48 12 "password"
;5 Edit 0x54030080 0x200 54 6 96 14 ""
;6 Edit 0x54030080 0x200 54 22 96 14 ""
;7 Button 0x54032000 0x0 4 44 48 14 "Add"
;8 Button 0x54032000 0x0 4 62 48 14 "Remove"
;9 ListBox 0x54230103 0x200 54 44 96 141 ""
;10 Button 0x54032000 0x0 152 170 48 14 "Login"
;END DIALOG
;DIALOG EDITOR: "" 0x2030208 "" "" ""


ret
;messages
lpstr xfolder="$personal$\Dialogin" ;;change this
lpstr xfile="$personal$\Dialogin\YTlogin.xml" ;;and this

sel message
,case WM_INITDIALOG
,;when opening the dialog, make sure that the folder and the file exist
,if(!dir(xfile))
,,mkdir xfolder
,,_s="<x />"
,,_s.setfile(xfile)
,else
,,;if already exists, populate listbox
,,update_listbox_from_xml2 hDlg xfile
,,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case LBN_DBLCLK<<16|9
,_i=LB_SelectedItem(lParam)
,out _i
,
,case 7 ;;Add
,;get text from edit boxes
,str u p
,u.getwintext(id(5 hDlg))
,p.getwintext(id(6 hDlg))
,if(empty(u) or empty(p)) ret
,;save to file
,IXml x=CreateXml; x.FromFile(xfile)
,IXmlNode n=x.RootElement.Add("i")
,n.Add("u" u)
,n.Add("p" p)
,x.ToFile(xfile)
,;update listbox
,update_listbox_from_xml2 hDlg xfile
,
,case 8 ;;Remove
,int i=LB_SelectedItem(id(9 hDlg)); if(i<0) ret
,i=SendMessage(id(9 hDlg) LB_GETITEMDATA i 0)
,;remove from file
,x=CreateXml; x.FromFile(xfile)
,n=x.RootElement.Child("i" i+i)
,x.Delete(n)
,x.ToFile(xfile)
,update_listbox_from_xml2 hDlg xfile
,
,case IDOK
,case IDCANCEL
,case 10
,,run "firefox.exe"
,,wait 0
,,;; I tried to understand this and to read the Information from "_i=LB_SelectedItem(lParam)"
,,;; It would be much cooler if doubleclick starts the action.
,,;; The goal was to get a working auto login for different Sites...  epic fail xD
,,str v1=n.ChildValue("*") ;;get value of a child.. any child? I need the right one xD
,,n=x.Path("rootelem/_i") ;;find a node by path / SelectedItem?
,,str v2=n.Value ;;get its value
,,AutoPassword v1 v2 2 0 10
,,key TVY
ret 1

The Login Button is'nt necessary i think. It would be better if the login starts with doubleclick.
My biggest problem is to read the correct nodes in the xml when the user doulbeclicks a entry from the list.

How can i tell QM to not close a dialog if the user starts an action ?
Because i want to use the login more than once.


Whoever helps me..
Thankyou buddy! :mrgreen:
#2
To make easier to find u, I changed xml format. Now u and p are <i> attributes, not separate nodes. Also changed filename and function name.

Function dlg_xml_user_list_login
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

str controls = "5 6"
str e5 e6
if(!ShowDialog("" &dlg_xml_user_list_login &controls)) ret

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 204 190 "Dialogin"
;3 Static 0x54000000 0x0 4 6 48 12 "user"
;4 Static 0x54000000 0x0 4 22 48 12 "password"
;5 Edit 0x54030080 0x200 54 6 96 14 ""
;6 Edit 0x54030080 0x200 54 22 96 14 ""
;7 Button 0x54032000 0x0 4 44 48 14 "Add"
;8 Button 0x54032000 0x0 4 62 48 14 "Remove"
;9 ListBox 0x54230103 0x200 54 44 96 141 ""
;10 Button 0x54032000 0x0 152 170 48 14 "Login"
;END DIALOG
;DIALOG EDITOR: "" 0x2030208 "" "" ""


ret
;messages
lpstr xfolder="$personal$\Dialogin" ;;change this
lpstr xfile="$personal$\Dialogin\YTlogin2.xml" ;;and this

sel message
,case WM_INITDIALOG
,;when opening the dialog, make sure that the folder and the file exist
,if(!dir(xfile))
,,mkdir xfolder
,,_s="<x />"
,,_s.setfile(xfile)
,else
,,;if already exists, populate listbox
,,update_listbox_from_xml2 hDlg xfile
,,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
str u p
IXml x; IXmlNode n
sel wParam
,case LBN_DBLCLK<<16|9
,;g1
,_i=LB_SelectedItem(lParam)
,;out _i
,if(_i<0) ret
,
,LB_GetItemText(lParam _i u)
,x=CreateXml; x.FromFile(xfile)
,n=x.Path(F"x/i[@u='{u}']") ;;get node 'i' whose attribute 'u' matches the selected user name
,p=n.AttributeValue("p")
,out F"u={u}, p={p}"; ret ;;disable this line
,
,opt waitmsg 1
,run "firefox.exe"
,wait 1
,AutoPassword u p 2 0 10
,key TVY
,
,case 7 ;;Add
,;get text from edit boxes
,u.getwintext(id(5 hDlg))
,p.getwintext(id(6 hDlg))
,if(empty(u) or empty(p)) ret
,;save to file
,x=CreateXml; x.FromFile(xfile)
,n=x.RootElement.Add("i")
,n.SetAttribute("u" u)
,n.SetAttribute("p" p)
,x.ToFile(xfile)
,;update listbox
,update_listbox_from_xml2 hDlg xfile
,
,case 8 ;;Remove
,int i=LB_SelectedItem(id(9 hDlg)); if(i<0) ret
,i=SendMessage(id(9 hDlg) LB_GETITEMDATA i 0)
,;remove from file
,x=CreateXml; x.FromFile(xfile)
,n=x.RootElement.Child("i" i+i)
,x.Delete(n)
,x.ToFile(xfile)
,update_listbox_from_xml2 hDlg xfile
,
,case IDOK
,case IDCANCEL
,case 10
,lParam=id(9 hDlg); goto g1
ret 1

update this function too
Function update_listbox_from_xml2
Code:
Copy      Help
;/
function hDlg $xfile

;clear listbox
int h=id(9 hDlg)
SendMessage h LB_RESETCONTENT 0 0
;load file and get all <i> nodes
IXml x=CreateXml; x.FromFile(xfile)
ARRAY(IXmlNode) a; int i
x.Path("x/i" a)
;populate listbox
for i 0 a.len
,LB_Add h a[i].AttributeValue("u") i
#3
Thanks Gintaras!

It works very well. Smile

Now i need to change the AutoPassword Function (make a copy of it) because the Site uses different
Names for the Login fields. But AutoPassword is encrypted.

I already found out how to decrypt, but i dont got the password.
Can you whisper this password in my ear? Big Grin
#4
With AutoPassword use "" for user.

AutoPassword "" password

And let the macro enter user name.
#5
Cool, thats genius!
It finds the fields by itself!

Ok so there is no reason to change Fieldnames. :lol:

I found out that this function activates the checkbox "stay logged in".
Is there a way to deactivate this?

Because i use the macro to log in manually, and i dont want to have the password in my cookies.
#6
If user is "", it does not activate other fields, only password.
If user is not "", it presses Shift+Tab to activate user field. In most forms it works. Where does not work, user must be "".


Forum Jump:


Users browsing this thread: 1 Guest(s)