Jump to content
Macro Express Forums

Need Help: If Y, repeat, if x continue...


jarichardusa

Recommended Posts

Okay, this is what I'm trying to do and can't for the life of me figure out the proper way to accomplish it. I've read the how-to's and such but they don't seem to cover it. The script I'm trying to create is to ping a website, if the ping is successful, repeat after x amounts of minutes. If the ping is unsuccessful, then continue on with the script to do another task, and after that second task is completed start from the beginning again (with the pinging) and on and on forever...

 

I guess my problem is where to put the repeats in relation to the events. How to get the script to start over if the ping is successful or continue on with the script if not.

 

Basically, in a nutshell:

 

::Position A

 

if ping successful...

go to position A

if ping unsuccessful

do this task

go to position A

 

repeated indefinately.

 

If this were BASIC I'd be all set...

 

Thank you all for any help you might be able to provide.

Link to comment
Share on other sites

Okay, this is what I'm trying to do and can't for the life of me figure out the proper way to accomplish it. I've read the how-to's and such but they don't seem to cover it. The script I'm trying to create is to ping a website, if the ping is successful, repeat after x amounts of minutes. If the ping is unsuccessful, then continue on with the script to do another task, and after that second task is completed start from the beginning again (with the pinging) and on and on forever...

 

I guess my problem is where to put the repeats in relation to the events. How to get the script to start over if the ping is successful or continue on with the script if not.

 

Basically, in a nutshell:

 

::Position A

 

if ping successful...

go to position A

if ping unsuccessful

do this task

go to position A

 

repeated indefinately.

 

If this were BASIC I'd be all set...

 

Thank you all for any help you might be able to provide.

 

 

JA

 

Read over the "and, or and xor" commands and look at the example macros. They helped me.

 

+++++

Get text in t1 (i dont have the program in front of me so i cant remember the right command) at screen/window coordinates.

if var %t1% contains !

 

continue next step

 

ELSE

 

delay 30 second

 

End if

+++++

and

+++++

program run "cmd.exe"

text type "ping thisisthewebsite.com"

then use the

if var %t1% contains !

 

continue next step

 

ELSE

 

delay 30 second

 

End if

 

+++++

 

I hope this helps. I will look around again when i get home and open up the laptop. I hope this kind of got you heading in the right direction.

 

Mbone

Link to comment
Share on other sites

Thank you Mbone for your reply, though I'll be honest and say I was a bit confused, I'm not super saavy when it comes to programming stuff. This is what I have so far:

------------------------------------------------------

Repeat Start (Repeat 10000 times)

If Ping Successful: "www.yahoo.com"

Else

Web Site: http://www.jackalwireless.net/hotspot/index.php [Default Browser - Wait to load]

Macro Playback Speed: Normal Speed

Mouse Move Screen 854, 198

Mouse Left Button Down

Mouse Left Button Up

Delay 6869 Milliseconds

Mouse Move Screen 1010, 13

Mouse Left Button Down

Mouse Left Button Up

Delay 3444 Milliseconds

Mouse Move Screen 898, 745

End If

Repeat End

-----------------------------------------------------

 

It works to a point, but I can't figure out the right spot to put the repeats to make the script actually stop if the ping is successful and start the script all over again, thus continuously just pinging, unless the ping comes up unsuccessful in which case it should continue with rest. Basically, what I'm trying to accomplish is that I use a wifi to connect to my internet provider. In order to have online access a webpage must be accessed and a log-in completed. Well, at times, the wifi provided drops my link, thus I have to go back to the website and log back in. If I'm trying to download a lengthy file or something, and I go to work, the whole day is wasted if the link is dropped. So my macro is to ping a website repeatedly and if the ping works, then wait a bit and ping again. If the ping does not go though, that probably means the link got booted, so open the browser, which will automatically bring up the login page to the provider, and click on a button to log-in (username and password are filled in automatically by the browser). Once the button is clicked, go back to the beginning of the script and begin the processess of pinging over again.

 

What I'm getting with the above script is just constantly acting as if the ping is unsucessful. Every 30 seconds the browser is opened up, the website gone to, and the button clicked, whether I have internet access at the time or not. So, basically, I don't know what I'm doing wrong with the above.

 

Again, any help would be greately appreciated.

Link to comment
Share on other sites

Thank you Mbone for your reply, though I'll be honest and say I was a bit confused, I'm not super saavy when it comes to programming stuff. This is what I have so far:

------------------------------------------------------

Repeat Start (Repeat 10000 times)

If Ping Successful: "www.yahoo.com"

Else

Web Site: http://www.jackalwireless.net/hotspot/index.php [Default Browser - Wait to load]

Macro Playback Speed: Normal Speed

Mouse Move Screen 854, 198

Mouse Left Button Down

Mouse Left Button Up

Delay 6869 Milliseconds

Mouse Move Screen 1010, 13

Mouse Left Button Down

Mouse Left Button Up

Delay 3444 Milliseconds

Mouse Move Screen 898, 745

End If

Repeat End

-----------------------------------------------------

 

It works to a point, but I can't figure out the right spot to put the repeats to make the script actually stop if the ping is successful and start the script all over again, thus continuously just pinging, unless the ping comes up unsuccessful in which case it should continue with rest. Basically, what I'm trying to accomplish is that I use a wifi to connect to my internet provider. In order to have online access a webpage must be accessed and a log-in completed. Well, at times, the wifi provided drops my link, thus I have to go back to the website and log back in. If I'm trying to download a lengthy file or something, and I go to work, the whole day is wasted if the link is dropped. So my macro is to ping a website repeatedly and if the ping works, then wait a bit and ping again. If the ping does not go though, that probably means the link got booted, so open the browser, which will automatically bring up the login page to the provider, and click on a button to log-in (username and password are filled in automatically by the browser). Once the button is clicked, go back to the beginning of the script and begin the processess of pinging over again.

 

What I'm getting with the above script is just constantly acting as if the ping is unsucessful. Every 30 seconds the browser is opened up, the website gone to, and the button clicked, whether I have internet access at the time or not. So, basically, I don't know what I'm doing wrong with the above.

 

Again, any help would be greately appreciated.

 

Try this and let me know. Sorry i did kind of confuse myself. sometimes the hands do something but my brain is saying something else. I am not the best at it but it helps me when people give me an idea, right or wrong.

 

 

If Ping Successful: "www.yahoo.com"

Delay 300seconds (adjust to what ever you like)

Else

 

the way you have it set up it will keep going 10k and then stop.

 

and also you could open a command line do ping www.thewebsite.com /t that will keep the ping going if you want to run that in the background.

 

Mbone

Link to comment
Share on other sites

This is what I have so far:

------------------------------------------------------

Repeat Start (Repeat 10000 times)

If Ping Successful: "www.yahoo.com"

Else

Web Site: http://www.jackalwireless.net/hotspot/index.php [Default Browser - Wait to load]

Macro Playback Speed: Normal Speed

Mouse Move Screen 854, 198

Mouse Left Button Down

Mouse Left Button Up

Delay 6869 Milliseconds

Mouse Move Screen 1010, 13

Mouse Left Button Down

Mouse Left Button Up

Delay 3444 Milliseconds

Mouse Move Screen 898, 745

End If

Repeat End

-----------------------------------------------------

I think you've just about got it. What you'll want to do is one of two things:

 

1) This will ensure the macro runs over and over ad infinitum until you manually cancel it:

Repeat Until %T1% <> %T1%
 If Ping Successful: "www.yahoo.com"
 Else
Web Site: http://www.jackalwireless.net/hotspot/index.php [Default Browser - Wait to load]

// Here you you will put your macro commands to log you back into your service.

 End If
Repeat End

 

<REP3:08:000002:000001:0001:1:01:T1><IFPING:00005:www.yahoo.com><ELSE><HTTP2:1:T:http://www.jackalwireless.net/hotspot/index.php><REM2:><REM2:Here you you will put your macro commands to log you back into your service.><REM2:><ENDIF><ENDREP>

 

By telling the macro to repeat until %T1% does not equal %T1% you're essentially telling the macro to repeat forever, because T1,

obviously, will always equal T1.

 

2) Or you could drop the Repeat altogether and just set the "If/Else" statement macro to activate on a schedule (rather than with a

hotkey or shortkey. Set the schedule for every, say, 5 minutes between the hours of 6:00am through 9:00pm (or indefinitely).

 

If you stick with the Repeat option, you might want to add a Timing delay before the Else command, otherwise the ping will go out

very rapidly as the macro repeats. This may or may not affect your performance (I honestly don't know).

What I'm getting with the above script is just constantly acting as if the ping is unsucessful. Every 30 seconds the browser is opened up,

the website gone to, and the button clicked, whether I have internet access at the time or not. So, basically, I don't know what I'm

doing wrong with the above.

 

Again, any help would be greately appreciated.

As far as the "Else" being triggered, even when the Ping should have been successful, you may want to consider increasing

the If Ping Successful maximum time to wait (the default is 5 seconds, but maybe 15 seconds would be better for your situation).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...