Jump to content
Macro Express Forums

Ping Site functionality... ME3 vs. MEpro


Recommended Posts

In Macro Express 3, the Ping Site command returns a detailed string of text (including the response time).

 

It looks like in Macro Express Pro, the PING SITE command only returns whether or not the ping was successful. So basically, it has the same functionality as the "IF PING SUCCESSFUL" command.

 

Am I missing something? Is there a way to get the detailed string (my concern is response time) from a ping in MEpro?

Link to comment
Share on other sites

I don't use the Ping command but I get the same short string that you reported. You could use the Date/Time command before and after to calculate the time for a response.

 

Thanks for the idea... but ping response is recorded in milliseconds... i dont think the date/time command will provide that specific or precise a record. It really just seems that PRO has taken a step backwards from ME3 in this case.

edit>correct me if i'm wrong here, though. your solution could be completely valid and here i am just dismissing it :P

Link to comment
Share on other sites

The date/time command can give results down to millisecs. Not 100% accurate because time for commands to be executed will be included. After extracting the before and after times into variables with Date/Time Set Variable you use Variable Modify Date/Time to do the subtraction and then extract seconds and milliseconds. The time may not be the same as was measured with ME3. It depends how that command was configured. I've no idea why MEPro is different to ME3.

Link to comment
Share on other sites

This will not be of any use if you don't use AutoIt. Below is macro running an External Script. It returns the Ping (send + return) in T[2]% in millisecs or an error message. The input and outputs can be set however user wishes. To determine bad ping check to see if %T[2]% contains "Error". I've only done limited testing. It seems to work fine if you miss off the www.

 

Variable Set String %T[1]%: Prompt
External Script: AutoIt // Ping URL or IP address
Text Box Display: Ping Send and Return Time (milliseconds) to %T[1]%

<VARIABLE SET STRING Option="\x01" Destination="%T[1]%" Prompt="Enter URL or IP     eg www.google.com   74.125.95.103\r\nTimeout is set in External Script to 4 secs" Mask="FALSE" OnTop="FALSE" Left="Center" Top="Center" Monitor="0"/>
<EXTERNAL SCRIPT Language="AutoIt" Dest="%T[2]%" Script=";URL or IP entered via %T[1]% in Parameters\r\n\r\n$address = $cmdline[1]\r\n;Msgbox(0,\"Status\", $address)\r\n$var = Ping($address, 4000)\r\nIf $var Then\r\n    ConsoleWrite($var)\r\nElse\r\n;Msgbox(0,\"Status\", @error)\r\n	If @error = 1 Then\r\n			ConsoleWrite(\"Error: Host is offline\")\r\n	ElseIf  @error = 2 Then\r\n			ConsoleWrite(\"Error: Host is unreachable\")\r\n	ElseIf  @error = 3 Then\r\n			ConsoleWrite(\"Error: Bad destination\")\r\n	ElseIf  @error = 4 Then\r\n			ConsoleWrite(\"Error: Other\")\r\n	EndIf\r\nEndIf\r\n" Parameters="%T[1]%" _COMMENT="Ping URL or IP address"/>
<TEXT BOX DISPLAY Title="Ping Send and Return Time (milliseconds) to %T[1]%" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\lang4105\\f0\\fs16 \r\n\\par \\pard\\qc %T[2]%\\lang1033\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="378" Height="115" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>

 

Code revised from first posting - could not get error messages to work with Case Select or Switch.

Edited by JohnS
Link to comment
Share on other sites

  • 3 weeks later...

I suggest that you first request this as a feature from ISS.

 

Second I suggest you use the Windows Ping command as a work-around. Use the Program Launch command like I did here

<PROGRAM LAUNCH Path="ping.exe" Mode="\x03" Parameters="192.168.2.2" Default_Path="TRUE" Wait="1" Get_Console="TRUE" Console_Dest="%Test%"/>

Notice I'm running it as hidden so nothing is apparent to the user. In this case I'm pinging 192.168.2.2 but you will change that to suit your needs. Now all you need to do is grab whatever relevant data you like from %Test% variable. If you need help with that let me know but I didn't want to muddy the waters by including that at this point. With this command result you could either use the average result at the bottom or you could use the "-n 1" parameter to have it ping only once. Just type "Ping -?" at a command prompt to get a complete list of parameters. The benefit of one ping is the quickness of execution. But often pings miss and that's why by default the ping command pings 5 times and gives an average.

 

BTW if you choose to capture the command output MEP will wait for the command to complete before moving forward.

Link to comment
Share on other sites

I suggest that you first request this as a feature from ISS.

 

Second I suggest you use the Windows Ping command as a work-around. Use the Program Launch command like I did here

<PROGRAM LAUNCH Path="ping.exe" Mode="\x03" Parameters="192.168.2.2" Default_Path="TRUE" Wait="1" Get_Console="TRUE" Console_Dest="%Test%"/>

Notice I'm running it as hidden so nothing is apparent to the user. In this case I'm pinging 192.168.2.2 but you will change that to suit your needs. Now all you need to do is grab whatever relevant data you like from %Test% variable. If you need help with that let me know but I didn't want to muddy the waters by including that at this point. With this command result you could either use the average result at the bottom or you could use the "-n 1" parameter to have it ping only once. Just type "Ping -?" at a command prompt to get a complete list of parameters. The benefit of one ping is the quickness of execution. But often pings miss and that's why by default the ping command pings 5 times and gives an average.

 

BTW if you choose to capture the command output MEP will wait for the command to complete before moving forward.

 

Cory... this is so awesome. I didn't even know you could run command line processes hidden. This is a huge deal for me. hahaha.

Thanks,

 

theSteve

Link to comment
Share on other sites

I suggest that you first request this as a feature from ISS.

 

Second I suggest you use the Windows Ping command as a work-around. Use the Program Launch command like I did here

<PROGRAM LAUNCH Path="ping.exe" Mode="\x03" Parameters="192.168.2.2" Default_Path="TRUE" Wait="1" Get_Console="TRUE" Console_Dest="%Test%"/>

Notice I'm running it as hidden so nothing is apparent to the user. In this case I'm pinging 192.168.2.2 but you will change that to suit your needs. Now all you need to do is grab whatever relevant data you like from %Test% variable. If you need help with that let me know but I didn't want to muddy the waters by including that at this point. With this command result you could either use the average result at the bottom or you could use the "-n 1" parameter to have it ping only once. Just type "Ping -?" at a command prompt to get a complete list of parameters. The benefit of one ping is the quickness of execution. But often pings miss and that's why by default the ping command pings 5 times and gives an average.

 

BTW if you choose to capture the command output MEP will wait for the command to complete before moving forward.

 

Cory: I'm unfamiliar with the world of Pings. I tried that macro out of curiosity but got 4 failed requests with that address 192.168.2.2. Is that to be expected?

 

--

Terry, East Grinstead, UK

Link to comment
Share on other sites

I tried that macro out of curiosity but got 4 failed requests with that address 192.168.2.2. Is that to be expected?

Each device (computer, printer, router, etc.) on your network has a unique IP address. The 192.168.2.2 IP address is a local, non-routable, address. Change it to an address of a device on your own local address or use the domain name of a server somewhere on the internet. However, for security reasons, some servers do not respond to pings.

 

By default, most network equipment uses 192.168.0.x addresses.

Link to comment
Share on other sites

Each device (computer, printer, router, etc.) on your network has a unique IP address. The 192.168.2.2 IP address is a local, non-routable, address. Change it to an address of a device on your own local address or use the domain name of a server somewhere on the internet. However, for security reasons, some servers do not respond to pings.

 

By default, most network equipment uses 192.168.0.x addresses.

 

Thanks Kevin.

 

--

Terry, East Grinstead, UK

Link to comment
Share on other sites

Wiki on Ping

Just Google "Ping How To" and there are about a zillion tutorials. It's one of the fundamental network troubleshooting utilities that exists in almost every operating system in the last 20 years. Also you can type "Ping /?" at a command prompt to see all the available parameters, syntax and usage. But as Kevin warned many paranoid and ill-informed admins disable Ping (ICMP) because they there is a common myth that doing so will somehow make you invisible to hackers which is completely bunk.

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...