Count the number of pictures

Asked by Ju1+i-我. on 2018-06-13

        while (true) {
            s.wait(1.1);
            if (s.exists(s1.prop("sm378")) != null) {
                s.wait(1.1);
                List<Match> a378 = (List<Match>) s.findAll(s1.prop("sm378"));
                count = count + a378.size() ;
            }
            else{
                count = count + 0;
                s.wait(1.1);
            }
            if (s.exists(s1.prop("summary")) != null) {
                break;
            }else {
                s.wait(1.1);
                s.type(Key.F11,Key.SHIFT);
                s.wait(1.1) ;
            }
        }

Exception in thread "main" java.lang.ClassCastException: org.sikuli.script.Finder cannot be cast to java.util.List

how to solve this problem?

Question information

Language:
English Edit question
Status:
Answered
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2018-06-13
Last reply:
2018-06-13
RaiMan (raimund-hocke) said : #1

Your Java IDE should have told you, that Region::findAll() returns java.util.Iterator<Match> and not List<Match>.

Can you help with this problem?

Provide an answer of your own, or ask Ju1+i-我. for more information if necessary.

To post a message you must log in.