Page 1 of 1

Website Login

Posted: Sat Jan 14, 2012 3:32 pm
by Vitor_Boss®
I'm building a kind of a auto-cliker program and didn't found any working code. Can someone help or show me where find this?

Thank you in advance.

Re: Website Login

Posted: Sat Jan 14, 2012 6:55 pm
by luis
If it's ok for you to use the webgadget, try to look at this code for some ideas.

http://www.purebasic.fr/english/viewtop ... 09#p350209

Re: Website Login

Posted: Sun Jan 29, 2012 12:44 am
by Vitor_Boss®
Thank you, that is a perfect start. I had modify your function to improve your code.

Code: Select all

Procedure WebGadget_SetFieldText (nGadget, sFieldName.s, sValue.s)
  Protected sScript.s
  ;sScript = "document." +sForm + "." + sFieldName + ".value = " + sValue + ";"
  
  sScript = "var elements = document.getElementsByName('"+ sFieldName + "');"
  sScript + "for (var i = 0; i < elements.length; ++i)"
  sScript + "{"
  sScript + "if (elements[i].tagName.toLowerCase() == 'input')"
  sScript + "{"
  sScript + "elements[i].value='" + sValue + "';"
  sScript + "break;"
  sScript + "}"
  sScript + "}"
  
  WebGadget_ExecScript (nGadget, sScript)
EndProcedure

Re: Website Login

Posted: Sun Jan 29, 2012 12:58 am
by luis
Thank you for letting me know.

Yes, using javascript *you* can write many useful functions to expand that code.

Just not myself because I'm not very fluent in JS !

Re: Website Login

Posted: Sun Jan 29, 2012 1:08 am
by Vitor_Boss®
Sorry about that, I don't know expressions in English. What I mean is "I had modify your code to improve the login page".

Thank you very much. And I'm not a JS programmer too.