Page 1 of 1 1
Topic Options
#75196 - 2003-05-28 04:44 PM Insert remote IP into Access DB
brewdude6 Offline
Hey THIS is FUN

Registered: 2000-10-21
Posts: 280
Loc: Nashville, TN
I'm using Ver. 3.62 and need to insert the IP address of the remote computer that I'm also executing the "getdrivespace" on. The ip that is returned is the ip of the machine that the script is executed from. I'd like to enter the ip of the remote machine but haven't been able to so far.

Thanks for any help.

code:
;Setconsole ("HIDE")
$engine = "dao.dbengine.36"
$database = "c:\inetpub1\wwwroot\db1.mdb"
$dbe = olecreateobject ( "$engine" )
$dbs = Val ( "&" + olecallfunc ( $dbe, "opendatabase", "s", "$database" ))
$Space = GetDiskSpace("\\romburner\c$")
$Server = "romburner"
$Drive = "C"
Gosub "Calculate"
Gosub "WriteToFile"
$Space = GetDiskSpace("\\romburner\d$")
$Server = "romburner"
$Drive = "D"
Gosub "Calculate"
Gosub "WriteToFile"
$Space = GetDiskSpace("\\towens2k\c$")
$Server = "towens2k"
$Drive = "C"
Gosub "Calculate"
Gosub "WriteToFile"
$Space = GetDiskSpace("\\towens2k\d$")
$Server = "towens2k"
$Drive = "D"
Gosub "Calculate"
Gosub "WriteToFile"

GoTo "End"
:WriteToFile
;$X = Writeline (1, "Free Space On $Server $Drive Drive: " + "$ErrMsg" + Chr(013) + Chr(010))
$rs = olecallfunc ( $dbs, "execute", "s","INSERT INTO TABLE3 (Dato,Server,Drive,Space,Ip) VALUES ('@Date','$Server','$Drive','$ErrMsg', [B]'@ipaddress0'[/B] );")
If @error GoTo End EndIf
Return
:Calculate
Select
Case $Space < 1024 ;** Kilobytes
$Space = $Space * 100
$Units = " Kilobytes"
Case $Space => 1024 AND $Space < 1048576 ;** Megabytes
$Space = ($Space * 100) / 1024
$Units = " Megabytes"
Case $Space => 1048576 ;** Gigabytes
$Space = $Space / 10486
$Units = " Gigabytes"
EndSelect
;** Convert the $Space value to a string by adding a space to the beginning
$Space = " " + $Space
$Length = Len($Space)

;** Add the decimal point 2 spaces from the end.
$Space = SubStr($Space, 1, $Length - 2) + "." + SubStr($Space,$Length - 1, 2)
$ErrMsg = LTrim($Space)
Return
:End
If $dbe
$rs= olereleaseobject ( $dbe )
EndIf
If $dbs
$rs= olereleaseobject ( $dbs )
EndIf


_________________________
I could have made a neat retort but didn't, for I was flurried and didn't think of it till I was downstairs.
-Mark Twain

Top
#75197 - 2003-05-28 05:17 PM Re: Insert remote IP into Access DB
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Do a PING RemoteComp into a text file and parse out the resulting IP address.

BTW, I'd highly recommend to update to KiXtart 4.21, it'll make writing this much easier.
_________________________
There are two types of vessels, submarines and targets.

Top
#75198 - 2003-06-01 10:22 PM Re: Insert remote IP into Access DB
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
as soon as you have updated please have a look at any of the UDFs in our library here that contains the string 'Ping' [Big Grin]
_________________________



Top
#75199 - 2003-06-02 12:58 AM Re: Insert remote IP into Access DB
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
quick read from your code actually just returned me a hard-coded machine.
a upgrade to 4.xx would indeed give you much!
not that only you have already made codes but also you would get the support any other scripting language can give.

sadly we have only resources for 4.xx (2001) of kix but the support we have is the reason why you should really consider upgrading.

if you can't, please say so.
also, if you could, say also why.

cheers.
_________________________
!

download KiXnet

Top
Page 1 of 1 1


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

Who's Online
0 registered and 837 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.088 seconds in which 0.062 seconds were spent on a total of 12 queries. Zlib compression enabled.

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