How to Pause in CC?

loxllxol

Client
Joined
Dec 21, 2011
Messages
13
Reaction score
0
Points
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
Joined
Jan 12, 2011
Messages
3,441
Reaction score
837
Points
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]
 
  • Thank you
Reactions: bigcajones

bigcajones

Client
Joined
Feb 9, 2011
Messages
1,228
Reaction score
685
Points
113
Take out the var result = part of it. Works when you have it like this:

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

loxllxol

Client
Joined
Dec 21, 2011
Messages
13
Reaction score
0
Points
0
Take out the var result = part of it. Works when you have it like this:

Code:
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
Joined
Feb 9, 2011
Messages
1,228
Reaction score
685
Points
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
Joined
Dec 21, 2011
Messages
13
Reaction score
0
Points
0
Yes, the error during debug is on the line that contains the pause.
 

Hungry Bulldozer

Moderator
Joined
Jan 12, 2011
Messages
3,441
Reaction score
837
Points
113
Yes, the error during debug is on the line that contains the pause.
A string with a pause in itself, has nothing in common with this warning. The thing is that after return 0; nothing will run.
 

Users Who Are Viewing This Thread (Total: 1, Members: 0, Guests: 1)