How to Pause in CC?

loxllxol

Client
Регистрация
21.12.2011
Сообщения
13
Благодарностей
0
Баллы
0
When I input the following code:
PHP:
// PAUSE 30 SECONDS
var result = instance.RiseMacros("Pause", new [] {"30"});
I get the error message: "Unreachable code detected"

What's the proper way to pause in CC?
 

Hungry Bulldozer

Moderator
Регистрация
12.01.2011
Сообщения
3 441
Благодарностей
834
Баллы
113
That's warning doesn't make any influence on execution, it means exactly what was said: there is line of the code that never be reached. It may be because of if-statement for instance.
btw, you can also get pause such way:
[xcode=c#]
System.Threading.Thread.Sleep(20);
[/code]
 
  • Спасибо
Реакции: bigcajones

bigcajones

Client
Регистрация
09.02.2011
Сообщения
1 216
Благодарностей
683
Баллы
113
Take out the var result = part of it. Works when you have it like this:

Код:
instance.RiseMacros("Pause", new [] {"30"});
or do what HB says!
 

loxllxol

Client
Регистрация
21.12.2011
Сообщения
13
Благодарностей
0
Баллы
0
Take out the var result = part of it. Works when you have it like this:

Код:
instance.RiseMacros("Pause", new [] {"30"});
or do what HB says!
I took off the var result = from the code, and I still get the same "Unreachable code detected" error.

Here's a bigger snippet of the code:
PHP:
// Click the button "I accept"
he = instance.GetTabByAddress("page").GetDocumentByAddress("0").FindElementByTag("form", 0).FindChildByAttribute("button", "fulltag", "button", "text", 0);
if (he.IsVoid) return -1;

he.RiseEvent("click", false);
if (tb.IsBusy) tb.WaitDownloading();
if (instance.GetTabByAddress("popup").IsBusy) instance.GetTabByAddress("popup").WaitDownloading();


return 0;
			
// PAUSE 60 SECONDS
instance.RiseMacros("Pause", new [] {"60"});
			
// ADDING LOGIN AND PASSWORD TO FILE
instance.RiseMacros("File.AppendString", new [] {"C:\\Users\\Alfie\\Dropbox\\Zenno Data\\Assets\\Emails\\hotmail-presetup.txt", login + ":" + password, "true" });
 

bigcajones

Client
Регистрация
09.02.2011
Сообщения
1 216
Благодарностей
683
Баллы
113
Is the error that you are getting on the line with the pause? Probably there is something else wrong in your code. The debug window will tell you what line the error is on, usually.
 

loxllxol

Client
Регистрация
21.12.2011
Сообщения
13
Благодарностей
0
Баллы
0
Yes, the error during debug is on the line that contains the pause.
 

Hungry Bulldozer

Moderator
Регистрация
12.01.2011
Сообщения
3 441
Благодарностей
834
Баллы
113

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