Need some suggestions for how to accomplish this

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
mightycpa
Automation Wizard
Posts: 343
Joined: Mon Jan 12, 2004 4:07 pm
Location: Vienna, VA

Need some suggestions for how to accomplish this

Post by mightycpa » Tue Jul 11, 2017 4:44 pm

I'm trying to build a little script that will take review tests for me. There are several questions on a webpage, and each question is multiple choice (choose one). I want to click on the first one, see if the answer was right or wrong, if wrong, cick on the next one, and if wrong, the next and so on, until I get the right answer. Then I want to go to the next question. An example appears below.

I think I can do the part for once I get to an individual question. What I'm not sure about is how to reliably navigate to the next question. Any ideas? Maybe find the next question mark?

Image
"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey

User avatar
Grovkillen
Automation Wizard
Posts: 1009
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Re: Need some suggestions for how to accomplish this

Post by Grovkillen » Tue Jul 11, 2017 10:36 pm

Can't you just use TAB and SPACE? TAB moves to the next selectable element, SPACE marks the radio button.
Let>ME=%Script%

Running: 15.0.24
version history

mightycpa
Automation Wizard
Posts: 343
Joined: Mon Jan 12, 2004 4:07 pm
Location: Vienna, VA

Re: Need some suggestions for how to accomplish this

Post by mightycpa » Wed Jul 12, 2017 4:55 am

I'll try and let you know! Thanks
"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey

mightycpa
Automation Wizard
Posts: 343
Joined: Mon Jan 12, 2004 4:07 pm
Location: Vienna, VA

Re: Need some suggestions for how to accomplish this

Post by mightycpa » Thu Jul 13, 2017 3:32 pm

No, that doesn't exactly work. Once a question has an answer, right or wrong, the next tab press will go to the top question (Q1) then tab through each answered question until it reaches an unanswered question.

In essence, there is no way to change an answer using the keyboard once the answer generates a right or wrong explanation.
"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey

User avatar
Grovkillen
Automation Wizard
Posts: 1009
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Re: Need some suggestions for how to accomplish this

Post by Grovkillen » Thu Jul 13, 2017 4:52 pm

And you can't get HTML elements either?

https://youtu.be/xkyb0yP5QDs
Let>ME=%Script%

Running: 15.0.24
version history

verbatim7
Newbie
Posts: 2
Joined: Mon Jun 26, 2017 7:37 pm

Re: Need some suggestions for how to accomplish this

Post by verbatim7 » Fri Jul 14, 2017 6:43 pm

Could take a long time to run but could you look for the "X" Image? i.e. the "X" is on screen hit 'Tab', otherwise hit "Space" and Advance to the Next Question (Could look for a Radio Button with Space Above it to find that).

mightycpa
Automation Wizard
Posts: 343
Joined: Mon Jan 12, 2004 4:07 pm
Location: Vienna, VA

Re: Need some suggestions for how to accomplish this

Post by mightycpa » Fri Jul 14, 2017 9:51 pm

Alas, I'm having trouble with WebRecorder thingy shown in the video:

Image
"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey

User avatar
Grovkillen
Automation Wizard
Posts: 1009
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Re: Need some suggestions for how to accomplish this

Post by Grovkillen » Sat Jul 15, 2017 12:01 pm

Reinstall Macro Scheduler.
Let>ME=%Script%

Running: 15.0.24
version history

User avatar
Phil Pendlebury
Automation Wizard
Posts: 538
Joined: Tue Jan 16, 2007 9:00 am
Contact:

Re: Need some suggestions for how to accomplish this

Post by Phil Pendlebury » Thu Jul 20, 2017 8:35 am

I would be doing it using screen recognition / capture, it is very fast when using only certain area of screen.

Capture the green "tick" as a small image.
If the text is capturable then use that for A. B. C. etc. Or capture small image of "A." "B." etc.

After each mouse move (as you already have) search left of screen for the green tick.
If it is NOT found move mouse to next letter "B." with mouse offset to click the button.
If it IS found look for next occurrence of "A." with mouse offset to get to the radio button.
Move mouse to there and do it all again.

You will be surprised how quick screen recognition can be, especially if you pair down the area being searched.
Phil Pendlebury - Linktree

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts