How to write Variables element in C#

  • Автор темы Автор темы yozoo
  • Дата начала Дата начала

yozoo

Client
Регистрация
08.11.2012
Сообщения
36
Реакции
0
Баллы
6
Hi guys,

The Code:
Emulator.MouseClick(instance.ActiveTab.Handle, MouseButton.Left, MouseButtonEvent.Click, 105, 335);

if i use Variables element to replace 105, and 335, like {-Variable.Variableleft-} and {-Variable.Variabletop-}

how can i write the code again. Thanks

i have tried to write:
1.
Emulator.MouseClick(instance.ActiveTab.Handle, MouseButton.Left, MouseButtonEvent.Click, project.Variables["Variableleft"].Value, project.Variables["Variableleft"].Value);

2.
int inta = project.Variables["Variableleft"].Value;
int intb = project.Variables["Variabletop"].Value;
Emulator.MouseClick(instance.ActiveTab.Handle, MouseButton.Left, MouseButtonEvent.Click, inta, intb);

3.
string inta = project.Variables["Variableleft"].Value;
string intb = project.Variables["Variabletop"].Value;
Emulator.MouseClick(instance.ActiveTab.Handle, MouseButton.Left, MouseButtonEvent.Click, inta, intb);

but all of them not work for me.
 
Hi guys,

The Code:
Emulator.MouseClick(instance.ActiveTab.Handle, MouseButton.Left, MouseButtonEvent.Click, 105, 335);

if i use Variables element to replace 105, and 335, like {-Variable.Variableleft-} and {-Variable.Variabletop-}

how can i write the code again. Thanks

i have tried to write:
1.
Emulator.MouseClick(instance.ActiveTab.Handle, MouseButton.Left, MouseButtonEvent.Click, project.Variables["Variableleft"].Value, project.Variables["Variableleft"].Value);

2.
int inta = project.Variables["Variableleft"].Value;
int intb = project.Variables["Variabletop"].Value;
Emulator.MouseClick(instance.ActiveTab.Handle, MouseButton.Left, MouseButtonEvent.Click, inta, intb);

3.
string inta = project.Variables["Variableleft"].Value;
string intb = project.Variables["Variabletop"].Value;
Emulator.MouseClick(instance.ActiveTab.Handle, MouseButton.Left, MouseButtonEvent.Click, inta, intb);

but all of them not work for me.
The variables of your project are string value, but the coordinates for method are integer value. You must convert your variable to the integer value. For this in C# exist the static class - Convert. It can convert all simple types, to the another type.
Here code:
C#:
Развернуть Свернуть Копировать
int inta = Convert.ToInt32(project.Variables["Variableleft"].Value);
int intb = Convert.ToInt32(project.Variables["Variabletop"].Value);
Emulator.MouseClick(instance.ActiveTab.Handle, MouseButton.Left, MouseButtonEvent.Click, inta, intb);
 
  • Оценить
Реакции: pyk и yozoo

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