Crazy Error in Code Creator

bigcajones

Client
Регистрация
09.02.2011
Сообщения
1 216
Благодарностей
682
Баллы
113
I just recorded a template in CC and I'm getting an error when debugging. Here's the code.
Код:
HtmlElement he = null;
            Document[] document = instance.ActiveTab.AllDocuments.Documents;
            foreach (Document document in document)
            {
                he = document.FindElementById("publicoton_home_submit");
                if (!he.IsVoid && !he.IsNull) break;
It is telling me that I can't have document in document. Why would it record like that if it isn't right? Who built this thing? :ca:

Type Time Message
10:50:01 ActionGroup1.cs A local variable named 'document' cannot be declared in this scope because it would give a different meaning to 'document', which is already used in a 'parent or current' scope to denote something else. [Row 153; Column 22]
10:50:01 ActionGroup1.cs A local variable named 'document' cannot be declared in this scope because it would give a different meaning to 'document', which is already used in a 'parent or current' scope to denote something else. [Row 136; Column 22]
10:50:01 ActionGroup1.cs A local variable named 'document' cannot be declared in this scope because it would give a different meaning to 'document', which is already used in a 'parent or current' scope to denote something else. [Row 42; Column 22]
 

shade

Client
Регистрация
19.11.2010
Сообщения
580
Благодарностей
346
Баллы
63
I just recorded a template in CC and I'm getting an error when debugging. Here's the code.
Код:
HtmlElement he = null;
            Document[] document = instance.ActiveTab.AllDocuments.Documents;
            foreach (Document document in document)
            {
                he = document.FindElementById("publicoton_home_submit");
                if (!he.IsVoid && !he.IsNull) break;
It is telling me that I can't have document in document. Why would it record like that if it isn't right? Who built this thing? :ca:

Type Time Message
10:50:01 ActionGroup1.cs A local variable named 'document' cannot be declared in this scope because it would give a different meaning to 'document', which is already used in a 'parent or current' scope to denote something else. [Row 153; Column 22]
10:50:01 ActionGroup1.cs A local variable named 'document' cannot be declared in this scope because it would give a different meaning to 'document', which is already used in a 'parent or current' scope to denote something else. [Row 136; Column 22]
10:50:01 ActionGroup1.cs A local variable named 'document' cannot be declared in this scope because it would give a different meaning to 'document', which is already used in a 'parent or current' scope to denote something else. [Row 42; Column 22]
Код:
HtmlElement he = null;
Document[] documents = instance.ActiveTab.AllDocuments.Documents;

foreach (Document document in documents)
{
       he = document.FindElementById("publicoton_home_submit");
       if (!he.IsVoid && !he.IsNull) break;
}
I replaced one variable "document" to "documents"
Код:
Document[] documents = instance.ActiveTab.AllDocuments.Documents;
 

bigcajones

Client
Регистрация
09.02.2011
Сообщения
1 216
Благодарностей
682
Баллы
113
I got it fixed by adding a numeral to the end of each document in documents so it looks like
Код:
foreach (Document document1 in document)
            {
                he = document1.FindElementById("publicoton_home_submit");
                if (!he.IsVoid && !he.IsNull) break
etc....

but why is it recording like that. We shouldn't have to go in and change the code everytime when recording something I don't believe.
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)