Jump to content

Pinging ip, wrong answer?


Recommended Posts

I Tryed to produce a script.(haha ^^ like the most here)

It should install Spybotsearch and destroy(it is a security tool)

But the part of the skript i tryed to ping the host, and used a select command does not work.

The skript always think he dont get an error, but i wwasn´t conected!!!

in command prompt it works(,. the ping is not possible)

Here is the Full script(ps,. i´m still sorry for my worse english,. i´am from Austria;-)):

#cs ----------------------------------------------------------------------------

AutoIt Version: 3.2.12.1

Author: UndeadHarlequin

Script Function:

Installiert den SpybotSD(160) und einige wichtige Plugins und ein Update von 5.8.2008

Updates:

spybotsd_advcheck

spybotsd_includes

spybotsd_tools

Plugins:

Netalyz

Filealyz

regalyz

runalyz

#ce ----------------------------------------------------------------------------

dircreate(@ProgramFilesDir&"\Security\Antispy")

opt("Mousecoordmode",2)

run("spybotsd160.exe")

WinWaitActive("Setup-Sprache auswählen","Wählen Sie die Sprache aus, die während der")

send("{tab}")

send("{enter}")

Winwaitactive("Setup - Spybot - Search & Destroy","Willkommen zum Spybot - Search & Destroy Setup-Assistenten")

send("!w")

Winwaitactive("Setup - Spybot - Search & Destroy","Lizenzvereinbarung")

Send("!a")

send("!w")

Winwaitactive("Setup - Spybot - Search & Destroy","Ziel-Ordner wählen")

send("!r")

Winwaitactive("Ordner suchen")

mouseclick("left",20,43,1,0)

Send("+{end}")

send("{del}")

send(@ProgramFilesDir&"\Security\Antispy")

Send("{enter}")

Winwaitactive("Setup - Spybot - Search & Destroy","Das Setup wird Spybot - Search & Destroy")

send("!w")

Winwaitactive("Ordner existiert bereits")

send("!j")

Winwaitactive("Setup - Spybot - Search & Destroy","Komponenten auswählen")

Send("Benutzerdefinierte")

Mouseclick("left",52,173,1,20)

MouseClick("left",52,188,1,20)

#cs

Here is the Problem. I thought he will test the Ping. As i didnt have any conaction to this ip (no lan, wlan, usw,.. ) i thought he gona do this Klick.

he didnt. So i made a Ping in cmd. lost 4 pakets,.. so It has to be an "@error",. What ist wrong?

#ce

dim $ping=ping("89.238.64.39")

select

case $ping=@error

Mouseclick("left",52,203,1,0)

dim $Updt="n"

case $ping= NOT @error

dim $Updt="j"

endselect

SEND("!w")

Winwaitactive("Setup - Spybot - Search & Destroy","Startmenü-Ordner auswählen")

send("!k")

send("!w")

Winwaitactive("Setup - Spybot - Search & Destroy","Zusätzliche Aufgaben auswählen")

send("!d")

Send("!s")

send("!w")

Winwaitactive("Setup - Spybot - Search & Destroy","Installation durchführen")

send("!i")

#cs

After the Instalation, not nesecary 4 now

Select

case $Updt="j"

;ProcessClose("processname")

;ProcessWaitClose("Deto")

run("spybotsd_advcheck.exe")

winwaitactive("Spybot - Search & Destroy Library Update Setup: Installation Folder","Space required: 574.0KB")

send(@ProgramFilesDir&"\Security\Antispy\Spybot - Search & Destroy")

send("!i")

;Nach installation

run("spybotsd_includes.exe")

winwaitactive("Spybot - Search & Destroy Include updates Setup: Installation Folder","Space required: 2.9MB")

send(@ProgramFilesDir&"\Security\Antispy\Spybot - Search & Destroy")

send("!i")

;Nach dem skript

run("spybotsd_tools.exe")

WinWaitActive("Spybot - Search & Destroy Tools update Setup: Installation Folder","Space required: 609.0KB")

send(@ProgramFilesDir&"\Security\Antispy\Spybot - Search & Destroy")

send("!i")

;nach dem skript

case $Updt="n"

;ProcessClose("processname")

EndSelect

Exit

#ce

Link to comment
Share on other sites

Help file quote:

Return Value

Success: Returns the roundtrip-time in milliseconds ( greater than 0 ).

Failure: Returns 0 if host is not pingable or other network errors occurred and sets @error. (See Remarks)

Remarks

When the function fails (returns 0) @error contains extended information:

1 = Host is offline

2 = Host is unreachable

3 = Bad destination

4 = Other errors

You have used a wrong statement:

The correct one will be either:

select
    case $ping=0
        Mouseclick("left",52,203,1,0)
        dim $Updt="n"
    case Else
        dim $Updt="j"
endselect

or

dim $ping=ping("89.238.64.39")
If @error Then
    Mouseclick("left",52,203,1,0)
    dim $Updt="n"
Else
    dim $Updt="j"
EndIf

You cannot use such a thing like "case $ping=@error" because @error is not a "return value" of this command.

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...