Is it possible to use IE_FormFill> and the Tag of an obje
Moderators: JRL, Dorian (MJT support)
-
- Newbie
- Posts: 6
- Joined: Fri Jan 14, 2011 10:35 am
- Location: Birmingham, UK
- Contact:
Is it possible to use IE_FormFill> and the Tag of an obje
Hi All,
Sorry if this is a daft question, but i am a new to macro scripter!
I have successful written a script whereby i can extract the price of a product from a supplier's website.
Let>SPAN15_SIZE=4098
IE_ExtractTag>%IE[1]%,,SPAN,15,0,SPAN15,r
MidStr>r_6,1,r,SPAN15
What i am now trying to do is sort of reverse this type of operation and i am trying to use the IE_FormFill command to do this.
The problem i am having is that if i use the "price" identifier IE_FormFill only fills out the first price box on the page (and i need to fill around 10 boxes with the same updated price).
I was wondering if there was a way that i can specify the 'tag' of the boxes i need to update to IE_FormFill?
I would have thought this was possible but I don’t know if I’ve been staring at my computer screen too long now! I just cant seem to work out how to do it.
Any help would be greatly appreciated!!
Thanks
Sorry if this is a daft question, but i am a new to macro scripter!
I have successful written a script whereby i can extract the price of a product from a supplier's website.
Let>SPAN15_SIZE=4098
IE_ExtractTag>%IE[1]%,,SPAN,15,0,SPAN15,r
MidStr>r_6,1,r,SPAN15
What i am now trying to do is sort of reverse this type of operation and i am trying to use the IE_FormFill command to do this.
The problem i am having is that if i use the "price" identifier IE_FormFill only fills out the first price box on the page (and i need to fill around 10 boxes with the same updated price).
I was wondering if there was a way that i can specify the 'tag' of the boxes i need to update to IE_FormFill?
I would have thought this was possible but I don’t know if I’ve been staring at my computer screen too long now! I just cant seem to work out how to do it.
Any help would be greatly appreciated!!
Thanks
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Hi,
At the moment I'm afraid IE_FormFill only supports the Name or ID attributes as identifiers.
At the moment I'm afraid IE_FormFill only supports the Name or ID attributes as identifiers.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
-
- Newbie
- Posts: 6
- Joined: Fri Jan 14, 2011 10:35 am
- Location: Birmingham, UK
- Contact:
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Just specify the ID instead of the Name.
Here's the help topic with the appropriate section bolded.
FormFill
Top Previous Next
Function FormFill(IEInst:integer; frame, form, fieldname, fieldvalue, event:pchar):integer; stdcall;
Fills a form field.
IEInst: The identifier of the web browser instance to use.
frame: the name of the frame containing the form field object
form: the name of the form (can be blank if the form has no name).
fieldname: the name of the field to fill. If the field has no name but has an ID attribute, the ID attributed can be specified instead.
fieldvalue: the value to set the field value to.
event: optional parameter that can take one of the following values:
submit: forces the form to submit.
onchange: triggers the field's onchange handler if it has one.
If the field is a SELECT object it is possible to select an item based on it's index, rather than actual value, by specifying fieldvalue as:
#INDEX#:n where n is the zero based index of the item. To select all items in a multi-select SELECT object use #INDEX#:ALL
Returns the number of fields that matched the specified values if successful, 0 if unsuccessful.
Macro Scheduler Usage
Import Method (Requires Macro Scheduler 9.2)
IE_FormFill>IE0,,main_form,firstname,Fred,0,r
LibFunc Method
LibFunc>hIE,FormFill,r,IE0,,main_form,firstname,Fred,0
Here's the help topic with the appropriate section bolded.
FormFill
Top Previous Next
Function FormFill(IEInst:integer; frame, form, fieldname, fieldvalue, event:pchar):integer; stdcall;
Fills a form field.
IEInst: The identifier of the web browser instance to use.
frame: the name of the frame containing the form field object
form: the name of the form (can be blank if the form has no name).
fieldname: the name of the field to fill. If the field has no name but has an ID attribute, the ID attributed can be specified instead.
fieldvalue: the value to set the field value to.
event: optional parameter that can take one of the following values:
submit: forces the form to submit.
onchange: triggers the field's onchange handler if it has one.
If the field is a SELECT object it is possible to select an item based on it's index, rather than actual value, by specifying fieldvalue as:
#INDEX#:n where n is the zero based index of the item. To select all items in a multi-select SELECT object use #INDEX#:ALL
Returns the number of fields that matched the specified values if successful, 0 if unsuccessful.
Macro Scheduler Usage
Import Method (Requires Macro Scheduler 9.2)
IE_FormFill>IE0,,main_form,firstname,Fred,0,r
LibFunc Method
LibFunc>hIE,FormFill,r,IE0,,main_form,firstname,Fred,0
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
-
- Newbie
- Posts: 6
- Joined: Fri Jan 14, 2011 10:35 am
- Location: Birmingham, UK
- Contact:
Hi Marcus,
Thanks for that information.
So instead of using the name of the field (which in this case is 'price'):
So using the ID attribute the code would look something like this?
(using the webrecorder - it tells me the TAG is 'INPUT 2077')
Would this be correct??? Or is the ID completely different to the TAG web recorder is telling me this object's name is?
Thanks for your time!
Thanks for that information.
So instead of using the name of the field (which in this case is 'price'):
Code: Select all
Let>FrameName={""}
Let>FormName={""}
Let>FieldName={"price"} //Currently the code looks for a field called 'price'
Let>FieldValue={"%Todays_Cost_Conv%"}
IE_FormFill>%IE[1]%,str:FrameName,str:FormName,str:FieldName,str:FieldValue,0,r
(using the webrecorder - it tells me the TAG is 'INPUT 2077')
Code: Select all
Let>FrameName={""}
Let>FormName={""}
Let>FieldName={"INPUT2077"} //Now code is looking for object INPUT2077???
Let>FieldValue={"%Todays_Cost_Conv%"}
IE_FormFill>%IE[1]%,str:FrameName,str:FormName,str:FieldName,str:FieldValue,0,r
Thanks for your time!
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
No, that is not the ID.
Note that the help says that if the element does NOT have a Name then an ID can be used instead. So Name takes precedence. If it DOES have a Name entering an ID will not help.
BUt if you want the ID look at the souce of the page and you may see something like:
The ID is the bit after ID=
Note that the help says that if the element does NOT have a Name then an ID can be used instead. So Name takes precedence. If it DOES have a Name entering an ID will not help.
BUt if you want the ID look at the souce of the page and you may see something like:
Code: Select all
<input NAME="username" ID="username" ....
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
-
- Newbie
- Posts: 6
- Joined: Fri Jan 14, 2011 10:35 am
- Location: Birmingham, UK
- Contact:
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
No, 'fraid not.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?