Prompting a user for input with WebRecorder
Moderators: JRL, Dorian (MJT support)
Prompting a user for input with WebRecorder
Is this possible? I have a process to automate, however it requires a user to enter a value specific to each process run. Is there a way to get a popup box, ask for the input (string) and then return those results to the web form field?
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Yes. WebRecorder creates Macro Scheduler code. So you can edit the script in Macro Scheduler and use any Macro Scheduler function you like. Sounds like the Input function is what you need, but you could also design your own dialogs with the custom dialog designer.
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?
Ok...it seems that I'm using the GetCheckBox wrong or something because it continues to return 0. Is this function usable with IE? Here's my code:
For the object_caption value, I've tried both the text next to the checkbox ("Enable DHCP") and the actual checkbox name, IPDHCPENABLE, with neither working. The problem either lies with that or with the window_title value (also guessing at this since it's what everything else uses in the script).
TIA
Jon
Code: Select all
Let>FrameName={"main content"}
Let>FormName={""}
GetCheckBox>%IE[0]%,IPDHCPENABLE,dhcp
If>dhcp=1,checked,unchecked
Label>checked
Label>end
Label>unchecked
Let>FrameName={"main content"}
Let>FormName={""}
Let>TagValue={"vac.255.IPDHCPENABLE:1"}
IE_ClickTag>%IE[0]%,str:FrameName,str:FormName,INPUT,CHECKBOX,str:TagValue,r
Label>end
TIA
Jon
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
GetCheckBox/SetCheckBox work with regular windows - regular checkbox controls - windowed controls. Checkboxes in web pages are not windowed controls - they are HTML elements - part of the page itself. So GetCheckBox/SetCheckBox cannot work with web page controls.
You need to use WebRecorder's ClickTag function. However, you have noticed that this clicks it but gives you no way of knowing whether or not it is already checked.
What is needed is a new function to return the CHECKED property of a checkbox, or a version of the FormFill function which lets you specifically set the CHECKED property of checkboxes. This isn't there yet, but you have identified a need and we will get on to it immediately!
You need to use WebRecorder's ClickTag function. However, you have noticed that this clicks it but gives you no way of knowing whether or not it is already checked.
What is needed is a new function to return the CHECKED property of a checkbox, or a version of the FormFill function which lets you specifically set the CHECKED property of checkboxes. This isn't there yet, but you have identified a need and we will get on to it immediately!
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?
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
In the mean time I have just spotted a workaround. You can use the ExtractTag function.
Use the tag extraction wizard. Click on the checkbox. It will create some code something like this:
Let>INPUT5_SIZE=4098
LibFunc>hIE,ExtractTag,r,%IE[0]%,,INPUT,5,0,INPUT5
MidStr>r_6,1,r,INPUT5
This was created when recording against the contact form on our site, clicking on the subscribe checkbox there.
Now, change that zero, in the penultimate field, which I have bolded, to a 1.
This will return something like this:
When the box is NOT checked it will return:
Note that when the checkbox is checked the word CHECKED appears in the tag. And when it is not checked the word CHECKED does NOT appear.
So, we can put this together and do something like this:
So now you can determine whether or not you should ClickTag it.
Hope this helps.
Use the tag extraction wizard. Click on the checkbox. It will create some code something like this:
Let>INPUT5_SIZE=4098
LibFunc>hIE,ExtractTag,r,%IE[0]%,,INPUT,5,0,INPUT5
MidStr>r_6,1,r,INPUT5
This was created when recording against the contact form on our site, clicking on the subscribe checkbox there.
Now, change that zero, in the penultimate field, which I have bolded, to a 1.
This will return something like this:
Code: Select all
<INPUT type=checkbox CHECKED size=30 value=SUBSCRIBED name=subscribe>
Code: Select all
<INPUT type=checkbox size=30 value=SUBSCRIBED name=subscribe>
So, we can put this together and do something like this:
Code: Select all
Let>INPUT5_SIZE=4098
LibFunc>hIE,ExtractTag,r,%IE[0]%,,INPUT,5,1,INPUT5
MidStr>r_6,1,r,INPUT5
Position>CHECKED,Input5,1,p
If>p=0
MessageModal>Not Checked
Else
MessageModal>Checked
Endif
Hope this helps.
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?
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Or if you're using the Imports method, replace the LibFunc line with:
IE_ExtractTag>%IE[0]%,,INPUT,5,1,INPUT5,r
IE_ExtractTag>%IE[0]%,,INPUT,5,1,INPUT5,r
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?
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Yes, look at the WebRecorder help file. Topic called "IEAuto.DLL Functions".
Run WebRecorder, clieck Help/Contents. Or hit F1. Or Start/Programs/WebRecorder Help.
Run WebRecorder, clieck Help/Contents. Or hit F1. Or Start/Programs/WebRecorder Help.
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?
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
The "r" is the return variable. I could have called it "Fred". Call it "Result" if you think it makes it less confusing. It is just the name of the variable that stores the results of the function. r has the return code. r_6 the HTML returned as it relates to the 6th parameter which is a buffer.
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?