Entering Data In Website Fields

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
aandrewb
Posts: 6
Joined: 18 Jul 2017, 12:02

Entering Data In Website Fields

30 Nov 2017, 06:27

Hi All,

I'm currently using AHK to enter data into a website fields from and Excel work sheet using ComObjCreate and Send.
What I would like to do now is slightly different, enter data in to the first field which has a drop down menu but can also be typed in.
The data that's going to be used for this field is going to be the same every time.

The second field doesn't have a drop down menu and is on the same window but using ComObjCreate and Send won't enter the data.
I'm using the same web application but using a another tab to open a different window.

Please can anyone advise on this?


Thank you in advance

Andrew.
User avatar
Blackholyman
Posts: 1293
Joined: 29 Sep 2013, 22:57
Location: Denmark
Contact:

Re: Entering Data In Website Fields

30 Nov 2017, 06:32

ComObjCreate and send

is not much to go by... can you tell us more maybe even show some of your code... even more helpful is a link to the website or one with similar fields
Also check out:
Courses on AutoHotkey

My Autohotkey Blog
:dance:
aandrewb
Posts: 6
Joined: 18 Jul 2017, 12:02

Re: Entering Data In Website Fields

30 Nov 2017, 06:59

Hi,

Thank you for your reply.
See below for the current code I'm using to get data from 2 cells in Excel and enter them in to separate fields.
This code was kindly provided by someone on the forum, apologies I can't remember the user name now, which I only slightly adapted.
I have taken out the website details as it's a company one and not accessible.

Thanks again

Andrew.

#Warn ; Enable warnings to assist with detecting common errors.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.

$^1::
Setkeydelay, 35

; SELECT THE EXCEL FILE TO OPEN AND MAKE A VARIABLE CONTROL FOR IT CALLED Xl
FileSelectFile, Path, 3, , Open Excel File, Excel File (*.xls; *.xlsx)
if Path =
ExitApp
Xl := ComObjCreate("Excel.Application")
Xl.Workbooks.Open(Path) ;open an existing file
Xl.Visible := True
if Errorlevel
{
MsgBox, % "Error opening excel file! Exiting..."
ExitApp
}

; Ask user to choose the sheet to open
Sheet_Titles =
global Sheet_To_Calculate := 0
loop, % xl.Sheets.Count
Sheet_Titles .= A_Index . ": " . xl.Sheets(A_Index).Name . "`n"
While Sheet_To_Calculate < 1 || Sheet_To_Calculate > xl.Sheets.Count || !IF_Integer(Sheet_To_Calculate)
inputbox, Sheet_To_Calculate, % Xl.ActiveWorkbook.Name, %Sheet_Titles%, , , , , , , , 1
if ErrorLevel
ExitApp


; ASK WHICH ROW TO START ON, DEFAULT TO 2 SINCE 1 IS USUALLY THE COLUMN TITLES
global Current_Row := -1
While Current_Row < 1 || !IF_Integer(Current_Row)
inputbox, Current_Row, % Xl.ActiveWorkbook.Name, % "Enter the row to start on.", , , , , , , , 2
if ErrorLevel
ExitApp

; THE REAL MEAT :) while the current row's I column is not blank, continue the loop
while Xl.Sheets(Sheet_To_Calculate).Range("B" . Current_Row).Value != ""
{

; Store the values into variables

B_stored := floor(Xl.Sheets(Sheet_To_Calculate).Range("B" . Current_Row).Value)
I_stored := Xl.Sheets(Sheet_To_Calculate).Range("I" . Current_Row).Value


WinActivate, http://********.html - *********


KeyWait, Ctrl, D

Click Down, 588, 179, 1

Click Up, 588, 179, 1

Sleep 500

KeyWait, Ctrl, D

Click, 489, 307, 2



; Enter B and enter once
Send %B_stored%
Sleep 500
Send {Enter}
Sleep 500



KeyWait, Ctrl, D

Click 1158, 311, 1

Sleep 500

KeyWait, Ctrl, D

Click, 1106, 390, 1



; Enter I and enter once
Send %I_stored%
Sleep 500
Send {Enter}
Sleep 500



; Move to the next row
Current_Row++
}

MsgBox, % "Done! :)"
ExitApp

IF_Integer(check_this)
{
if check_this is not integer
return false
else
return true
}

$Esc::ExitApp ;EMERGENCY EXIT HOTKEY

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Descolada, Google [Bot] and 97 guests