Page 1 of 1 1
Topic Options
#171327 - 2006-12-11 09:05 PM Assigning Ping Success to Variable
jesseboy Offline
Lurker

Registered: 2005-11-07
Posts: 1
I need to make a script that runs when a user logs in and does a check to see if their internet connection is active, and if so, copies a file to a certain location. My thoughts were to somehow have the script check to see if ping is successful and if so run the copy command. here is what I have but I am not skilled in batch file scripting or kixtart too much. Below is the idea but it doesn't work.

Code:

IF /i ("ping google.com") EQU (1)

THEN

	copy c:\somefile.exe c:\somelocation
ELSE

	exit




thanks for any help

Top
#171328 - 2006-12-11 09:18 PM Re: Assigning Ping Success to Variable [Re: jesseboy]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
I would suggest looking in the UDF Forum and you will find many options there to give you a head start on what you are attempting.
_________________________
Today is the tomorrow you worried about yesterday.

Top
#171342 - 2006-12-12 02:55 AM Re: Assigning Ping Success to Variable [Re: Gargoyle]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
No need for any UDF. SHELL to ping and it returns @Error. It's just that easy.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#171490 - 2006-12-14 08:41 AM Re: Assigning Ping Success to Variable [Re: Les]
Björn Offline
Korg Regular
*****

Registered: 2005-12-07
Posts: 953
Loc: Stockholm, Sweden.
Code:
if NOT @LOGONMODE
Break On
EndIf

Dim $SO,$DO
$SO = SetOption("Explicit","On")
$SO = SetOption("NoVarsInStrings","On")
$SO = SetOption("NoMacrosInStrings","On")

$DO = OSPing(”ftp.sunet.se”)

Function OSPing($sComputer)
Shell '"'+%COMSPEC%+'" /c ping -n 1 '+$sComputer+' |find /C "TTL=" >nul'
$OSPing = NOT @ERROR
EndFunction
_________________________
as long as it works - why fix it?
If it doesn't work - kix-it!

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (mole) and 1300 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.051 seconds in which 0.023 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org