Sign in to follow this  
Followers 0
programer

How to login to a site and click a button?

6 posts in this topic

Hello,

I´m new at AutoIt and program languages, and I have to make a script to log in to a site and click a button. And it has to do that in a hidden way, so nobody in front of the computer could see the script running.

I´ve tried some things, but still have problems =(

BlockInput (1)
SplashTextOn("", "", 1440, 900, 0, 0, 0)

I used SplashTextOn to hide the CMD.EXE window. Ugly! is there a better way to do that?

Opt("WinTitleMatchMode", 2)
run("C:\windows\system32\cmd.exe /c taskkill /f /im firefox.exe")
WinWaitClose("C:\WINDOWS\system32\cmd.exe","")

Taskkill to avoid other Firefox instances running, that could make a tab bar appear, or other problems.

SplashTextOn("", "", 1440, 31, 0, 872, 0)

To hide the taskbar, so nobody can see I will run FF. Very ugly. Any better way?

Sleep(200)
run("C:\Program Files\Mozilla Firefox\firefox.exe http://www.autoitscript.com/forum/")
WinWaitActive("Mozilla Firefox","")
WinSetTrans("Mozilla Firefox", "",1)

WinSetTrans to make FF window invisible.

Sleep(6000)

Sleep to make sure the webpage has loaded. But sometimes it´s not enought, and the script continues before the page is loaded.

WinActivate("AutoIt Forums - Mozilla Firefox","")
WinSetState("AutoIt Forums - Mozilla Firefox","", @SW_MAXIMIZE)
WinWaitActive("AutoIt Forums - Mozilla Firefox","")
Send("{TAB}{TAB}{TAB}{TAB}{ENTER}")
Sleep(4000)
Send("{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}USERNAME{TAB}PASSWORD{ENTER}")
Sleep(3000)
SplashOff()
WinSetTrans("Mozilla", "",255)
BlockInput (0)

Before trying TAB and ENTER commands, I tried MouseClick, but I had a problem: people would see the mouse point "walking" on the screen!

Well, more than the problems I said before, the biggest problem is: sometimes it works, sometimes not, because the the TAB command puts the cursor in the wrong field. =(

Does anyone can help me?

Here goes the entire code, if anyone could test it for me (without blockinput and killtask firefox parts)

Thank you all!

PS: i havent started working in the "time" part (run the script in a specific daytime). I accept sugestions too. I need to make the script run Firefox on Mondays, Wednesdays and Fridays, at 3:00PM

;BlockInput (1)
SplashTextOn("", "", 1440, 900, 0, 0, 0)
Opt("WinTitleMatchMode", 2)
;run("C:\windows\system32\cmd.exe /c taskkill /f /im firefox.exe")
;WinWaitClose("C:\WINDOWS\system32\cmd.exe","")
SplashTextOn("", "", 1440, 31, 0, 872, 0)
Sleep(200)
run("C:\Program Files\Mozilla Firefox\firefox.exe http://www.autoitscript.com/forum/")
WinWaitActive("Mozilla Firefox","")
WinSetTrans("Mozilla Firefox", "",1)
Sleep(6000)
WinActivate("AutoIt Forums - Mozilla Firefox","")
WinSetState("AutoIt Forums - Mozilla Firefox","", @SW_MAXIMIZE)
WinWaitActive("AutoIt Forums - Mozilla Firefox","")
Send("{TAB}{TAB}{TAB}{TAB}{ENTER}")
Sleep(4000)
Send("{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}USERNAME{TAB}PASSWORD{ENTER}")
Sleep(3000)
SplashOff()
WinSetTrans("Mozilla", "",255)
BlockInput (0)

Share this post


Link to post
Share on other sites



programer,

And it has to do that in a hidden way, so nobody in front of the computer could see the script running.

And why do you need the script to run like this? :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

:)

sorry...

i had never joined a progamming/script forum, and as I said, I know nothing about programming and script.

so, I don´t know how much people could consider a script "suspect".

actually, u could ignore the "hidden" part. I just want it to work... may be "completely visible", if this is the only way.

to answer your question: I dont want anyone to see that i´m logging in to a site, and that there is a acript that contains my password inside it and types my password. just for safety. :P

but, as I said, this is not the main objetive. if I could make it work visible, it would be enough...

programer,

And why do you need the script to run like this? :)

M23

Edited by programer

Share this post


Link to post
Share on other sites

programer,

a acript that contains my password inside it

Do you share this machine with anyone? Because if you do it is trivial to get your password and log in in your place. :)

And it looks as if you want to automate your login here:

run("C:\Program Files\Mozilla Firefox\firefox.exe http://www.autoitscript.com/forum/")

so I suggest you read this before you go any further. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

programer,

Do you share this machine with anyone? Because if you do it is trivial to get your password and log in in your place. :)

And it looks as if you want to automate your login here:

run("C:\Program Files\Mozilla Firefox\firefox.exe http://www.autoitscript.com/forum/")

so I suggest you read this before you go any further. :P

M23

In fact, in normal circunstances the machine is used only by me. But it´s in a room where someone could use it when i´m out (i´m at work).

BUT these people don´t know much about computers, so I don´t think they could get my password this way. Well, if u could suggest a solution for this, I would be ok, but I think it´s not absolutely necessary right know.

About the login automation, I am sorry for having not read the "Website abuse". I put the forum address in my script just as an example. Now I see that was the worst example I could use... :)

Thank you.

Share this post


Link to post
Share on other sites

programer,

OK, let us start again as if none of the above existed. :)

You want to code a script which logs you into a specific site using FireFox and you do not want anyone to see your password while this is going on.

Is that a good description of your request?

If so, then I suggest you use Stilgar's FF.au3 UDF which allows you to do lots of things with FireFox - if you have a certain plug-in (I do not use FireFox myself so I cannot be more specific). There is even a log-in function here. :)

However, I repeat that putting your password into the script is NOT secure, although if you search the forum you will find a number of ways to make it as secure as possible within the encryption limits of AutoIt. :P

I hope that helps.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0