AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

control Internet Explorer login and form submission
Goto page 1, 2  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
drmurdoch



Joined: 10 Nov 2006
Posts: 110

PostPosted: Sun Jun 17, 2007 7:24 pm    Post subject: control Internet Explorer login and form submission Reply with quote

I have a website that is IE only. I want to find a method of logging my into a site, submit some information ... and then click search.

I would like to pass a variable to this automation script.

For FireFox, I use a program called Chicken Foot. It works well.

Is there any AHK script that controls the browser as outlined ?
Back to top
View user's profile Send private message
engunneer



Joined: 30 Aug 2005
Posts: 8255
Location: Maywood, IL

PostPosted: Sun Jun 17, 2007 7:29 pm    Post subject: Reply with quote

this is a fairly common question. you can probably make this script work. Please search the forum for javascript, bookmarklets, waiting for a page to load, IE4AHK, and related terms. Everything you need has been posted.
_________________

(Common Answers)
Back to top
View user's profile Send private message Visit poster's website
drmurdoch



Joined: 10 Nov 2006
Posts: 110

PostPosted: Sun Jun 17, 2007 7:33 pm    Post subject: it would go like this ... Reply with quote

go to the website
wait a little bit
type login
Tab
password1
Tab
password2
Tab
Enter Key
Wait
hit Tab key 14 times [Enter] or go to another web page
Wait
Hit Tab key 3 times
enter User Number (I'd like this a variable)
Hit Tab 7 times.
Enter

What is the best script to do this with ?
Back to top
View user's profile Send private message
Travley



Joined: 13 May 2007
Posts: 47

PostPosted: Sun Jun 17, 2007 8:49 pm    Post subject: Reply with quote

AHK would be a good usage for This. It'd look something like this

Code:
usernumber = whatever
login = whatever
pass1 = whatever1
pass2  = whatever2
siteurl = http://www.yoursite.com
delay = 6000 ; in milisec (6000 = 6seconds)

Run %siteurl%
Sleep, %delay%
Send %login%
Send {tab}
Send %pass1%
Send {tab}
Send %pass2%
Send {tab}
Send {Enter}
Sleep, %delay%
Send {tab 14}
Send {Enter}
Sleep, %delay%
Send {tab 3}
Send %usernumber%
Send {tab 7}
Send {Enter}
Return


It could be more simplified, but I hope this helps. I recommend checking out the AutoScriptWriter that came with AHK. I generally do what I need to do once with that running, and go back and review. Def-useful program.
Back to top
View user's profile Send private message
drmurdoch



Joined: 10 Nov 2006
Posts: 110

PostPosted: Sun Jun 17, 2007 9:16 pm    Post subject: works. Reply with quote

Thank you.

I got it to work. Very Happy

Now I just need a way of pulling the UserNumber from a program I use !

Thank you.

Code:
;
; AutoHotkey Version: 1.x
; Language:       English
; Platform:       Win9x/NT
; Author:         A.N.Other <myemail@nowhere.com>
;
; Script Function:
;   Template script (you can customize this template by editing "ShellNew\Template.ahk" in your Windows folder)
;

#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.

accoutnumber = 24601
login = mylogin
pass1 = mypass1
pass2  = mypass2
siteurl = http://www.corporateURL.com
delay = 3000 ; in milisec (6000 = 6seconds)


Run, c:\Program Files\Internet Explorer\iexplore.exe %siteurl%
Sleep, %delay%
Send %login%
Send {tab}
Send %pass1%
Send {tab}
Send %pass2%
Send {tab}
Send {Enter}
Sleep, %delay%
Send {tab}
Send https://www.corporateURL.com/results/search_frame.asp
Send {Enter}
Sleep, %delay%
Send {tab 3}
Send %usernumber%
Send {tab 7}
Send {Enter}
Return
Back to top
View user's profile Send private message
drmurdoch



Joined: 10 Nov 2006
Posts: 110

PostPosted: Sun Jun 17, 2007 9:21 pm    Post subject: what about command line Reply with quote

Is there a way pass a variable to this script ? Maybe via a command line ?

my script it called logintoaccountx.ahk

accountnumber is what I want to pass.

How might it work like this ...

c:\Program Files\AutoHotkey\Scripts\logintoaccountx.ahk 9894954934

Thank you Smile
Back to top
View user's profile Send private message
engunneer



Joined: 30 Aug 2005
Posts: 8255
Location: Maywood, IL

PostPosted: Sun Jun 17, 2007 10:31 pm    Post subject: Reply with quote

the command parameter is passed as a variable with the number of the parameter

Code:

if %0% = 1
  Msgbox, One parameter received - %1%
else
  Msgbox, No parameters (or too many) received! %0%

_________________

(Common Answers)
Back to top
View user's profile Send private message Visit poster's website
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Sun Jun 17, 2007 10:35 pm    Post subject: Reply with quote

Add the following to be the firstline of your script:

Code:
AccountNumber = %1%


Smile
Back to top
View user's profile Send private message Send e-mail
drmurdoch



Joined: 10 Nov 2006
Posts: 110

PostPosted: Mon Jun 18, 2007 12:27 am    Post subject: Thank you. Reply with quote

AccountNumber = %1% <--- syntax reminds me of batch files now that I think of it.

Thank you.
Very Happy
Back to top
View user's profile Send private message
drmurdoch



Joined: 10 Nov 2006
Posts: 110

PostPosted: Mon Jun 18, 2007 12:59 am    Post subject: sooooooooooooooooooooooo close. Reply with quote

I was told I can't do it the command line Sad

I have two ways to do it.

1) parse the results from this URL

http://127.0.0.1:8001/searchresults.html

I would look for "accountnumber: 1384411291DT" (and I would need to read the first 10 digits (not the letters, if they existed). 1384411291DT would vary depending on the account selected.

or

2) I need to read the number from a file.

The file looks like this .... and is located in this directory

c:\clients\account\www\searchresults.html

<html><body><h2>Search ...</h2>You need to write a <a href=http://groups.csail.mit.edu/uid/chickenfoot/>chickenfoot script</a> and trigger it on this page to run your custom searches. This also requires Firefox.<p/>Surname: Surname<br/>Given: SELMA<br/>(dd-mmm-yyyy) Dob1: 4-Nov-1926<br/>(dd/mm/yyyy) Dob2: 4/11/1926<br/>(mm/dd/yyyy) Dob3: 11/41926<br/>accountnumber: 1384411291DT<br/></body></html>

Ideas ?
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Mon Jun 18, 2007 1:44 am    Post subject: Reply with quote

Code:
FileRead, HTML, c:\clients\account\www\searchresults.html
SearchStr := "accountnumber: "
FoundPos  := InStr( HTML, SearchStr )
If FoundPos
   AccountNumber := SubStr( HTML, FoundPos+StrLen(SearchStr), 10 )
HTML :=

MsgBox, % AccountNumber


Smile
Back to top
View user's profile Send private message Send e-mail
drmurdoch



Joined: 10 Nov 2006
Posts: 110

PostPosted: Mon Jun 18, 2007 1:49 am    Post subject: Reply with quote

FileReadLine, line, c:\clients\account\www\searchresults.html, thelinewherethe-accountnumberIS

http://www.autohotkey.com/docs/commands/FileReadLine.htm

uhhh.. hmmm.
Back to top
View user's profile Send private message
drmurdoch



Joined: 10 Nov 2006
Posts: 110

PostPosted: Mon Jun 18, 2007 1:50 am    Post subject: Reply with quote

OMG. thanks. I will try !
I was struggling.

!
Back to top
View user's profile Send private message
drmurdoch



Joined: 10 Nov 2006
Posts: 110

PostPosted: Mon Jun 18, 2007 2:02 am    Post subject: Reply with quote

Works !

Code:
FileRead, HTML, c:\clients\account\www\searchresults.html
SearchStr := "accountnumber: "
FoundPos  := InStr( HTML, SearchStr )
If FoundPos
   AccountNumber := SubStr( HTML, FoundPos+StrLen(SearchStr), 10 )
;HTML :=
;MsgBox, % AccountNumber


I commented out the HTML and the Msgbox thing.
Should I close the If ?
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Mon Jun 18, 2007 2:11 am    Post subject: Reply with quote

Quote:
I commented out the HTML


You would know better! If searchresults.html was a 10MB file then the variable HTML will be using 10MB of memory. You cannot delete a variable once it has been created but can reset it to null, to conserve memory.

Quote:
Should I close the If ?


Not needed! That is one sweetest thing of AHK syntax. Smile
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group