AutoHotkey Community

It is currently May 25th, 2012, 8:45 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 27 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: June 17th, 2007, 8:24 pm 
Offline

Joined: November 10th, 2006, 5:10 am
Posts: 110
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 ?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 17th, 2007, 8:29 pm 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8647
Location: Salem, MA
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.

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
PostPosted: June 17th, 2007, 8:33 pm 
Offline

Joined: November 10th, 2006, 5:10 am
Posts: 110
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 ?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 17th, 2007, 9:49 pm 
Offline

Joined: May 13th, 2007, 5:40 pm
Posts: 47
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: works.
PostPosted: June 17th, 2007, 10:16 pm 
Offline

Joined: November 10th, 2006, 5:10 am
Posts: 110
Thank you.

I got it to work. :D

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject: what about command line
PostPosted: June 17th, 2007, 10:21 pm 
Offline

Joined: November 10th, 2006, 5:10 am
Posts: 110
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 :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 17th, 2007, 11:31 pm 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8647
Location: Salem, MA
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%

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 17th, 2007, 11:35 pm 
Online
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8775
Add the following to be the firstline of your script:

Code:
AccountNumber = %1%


:)


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Thank you.
PostPosted: June 18th, 2007, 1:27 am 
Offline

Joined: November 10th, 2006, 5:10 am
Posts: 110
AccountNumber = %1% <--- syntax reminds me of batch files now that I think of it.

Thank you.
:D


Report this post
Top
 Profile  
Reply with quote  
PostPosted: June 18th, 2007, 1:59 am 
Offline

Joined: November 10th, 2006, 5:10 am
Posts: 110
I was told I can't do it the command line :(

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 ?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 18th, 2007, 2:44 am 
Online
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8775
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


:)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 18th, 2007, 2:49 am 
Offline

Joined: November 10th, 2006, 5:10 am
Posts: 110
FileReadLine, line, c:\clients\account\www\searchresults.html, thelinewherethe-accountnumberIS

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

uhhh.. hmmm.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 18th, 2007, 2:50 am 
Offline

Joined: November 10th, 2006, 5:10 am
Posts: 110
OMG. thanks. I will try !
I was struggling.

!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 18th, 2007, 3:02 am 
Offline

Joined: November 10th, 2006, 5:10 am
Posts: 110
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 ?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 18th, 2007, 3:11 am 
Online
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8775
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. :)


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 27 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, Google Feedfetcher, SKAN and 76 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group